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.
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/CoreExport.h"
10 #include "core/html/track/TrackBase.h"
14 class CORE_EXPORT VideoTrack final
: public GarbageCollectedFinalized
<VideoTrack
>, public TrackBase
, public ScriptWrappable
{
15 DEFINE_WRAPPERTYPEINFO();
16 USING_GARBAGE_COLLECTED_MIXIN(VideoTrack
);
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
&);
44 VideoTrack(const String
& id
, const AtomicString
& kind
, const AtomicString
& label
, const AtomicString
& language
, bool selected
);
47 bool isValidKind(const AtomicString
& kind
) const override
{ return isValidKindKeyword(kind
); }
48 AtomicString
defaultKind() const override
;
53 DEFINE_TRACK_TYPE_CASTS(VideoTrack
, TrackBase::VideoTrack
);
57 #endif // VideoTrack_h