Keep auxilliary media objects on the heap always.
[chromium-blink-merge.git] / third_party / WebKit / Source / core / html / track / VideoTrack.h
blobd31eec91c4f97f3f2341d2d9c77269e5c5aa0ae4
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef VideoTrack_h
6 #define VideoTrack_h
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/CoreExport.h"
10 #include "core/html/track/TrackBase.h"
12 namespace blink {
14 class CORE_EXPORT VideoTrack final : public GarbageCollectedFinalized<VideoTrack>, public TrackBase, public ScriptWrappable {
15 DEFINE_WRAPPERTYPEINFO();
16 USING_GARBAGE_COLLECTED_MIXIN(VideoTrack);
17 public:
18 static VideoTrack* create(const String& id, const AtomicString& kind, const AtomicString& label, const AtomicString& language, bool selected)
20 return new VideoTrack(id, kind, label, language, selected);
23 ~VideoTrack() override;
24 DECLARE_VIRTUAL_TRACE();
26 bool selected() const { return m_selected; }
27 void setSelected(bool);
29 // Set selected to false without notifying the owner media element. Used when
30 // another video track is selected, implicitly deselecting this one.
31 void clearSelected() { m_selected = false; }
33 // Valid kind keywords.
34 static const AtomicString& alternativeKeyword();
35 static const AtomicString& captionsKeyword();
36 static const AtomicString& mainKeyword();
37 static const AtomicString& signKeyword();
38 static const AtomicString& subtitlesKeyword();
39 static const AtomicString& commentaryKeyword();
41 static bool isValidKindKeyword(const String&);
43 private:
44 VideoTrack(const String& id, const AtomicString& kind, const AtomicString& label, const AtomicString& language, bool selected);
46 // TrackBase
47 bool isValidKind(const AtomicString& kind) const override { return isValidKindKeyword(kind); }
48 AtomicString defaultKind() const override;
50 bool m_selected;
53 DEFINE_TRACK_TYPE_CASTS(VideoTrack, TrackBase::VideoTrack);
55 } // namespace blink
57 #endif // VideoTrack_h