Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / html / track / VideoTrack.cpp
blob30f968437d7a42ee52641e8f44431edddcc808f1
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 #include "config.h"
6 #include "core/html/track/VideoTrack.h"
8 #include "core/html/HTMLMediaElement.h"
10 namespace blink {
12 VideoTrack::VideoTrack(const String& id, const AtomicString& kind, const AtomicString& label, const AtomicString& language, bool selected)
13 : TrackBase(TrackBase::VideoTrack, label, language, id)
14 , m_selected(selected)
16 setKind(kind);
19 VideoTrack::~VideoTrack()
23 DEFINE_TRACE(VideoTrack)
25 TrackBase::trace(visitor);
28 void VideoTrack::setSelected(bool selected)
30 if (selected == m_selected)
31 return;
33 m_selected = selected;
35 if (mediaElement()) {
36 WebMediaPlayer::TrackId selectedTrackId = trackId();
37 mediaElement()->selectedVideoTrackChanged(selected ? &selectedTrackId : 0);
41 const AtomicString& VideoTrack::alternativeKeyword()
43 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicString::ConstructFromLiteral));
44 return keyword;
47 const AtomicString& VideoTrack::captionsKeyword()
49 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("captions", AtomicString::ConstructFromLiteral));
50 return keyword;
53 const AtomicString& VideoTrack::mainKeyword()
55 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::ConstructFromLiteral));
56 return keyword;
59 const AtomicString& VideoTrack::signKeyword()
61 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("sign", AtomicString::ConstructFromLiteral));
62 return keyword;
65 const AtomicString& VideoTrack::subtitlesKeyword()
67 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("subtitles", AtomicString::ConstructFromLiteral));
68 return keyword;
71 const AtomicString& VideoTrack::commentaryKeyword()
73 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString::ConstructFromLiteral));
74 return keyword;
77 bool VideoTrack::isValidKindKeyword(const String& kind)
79 return (kind == alternativeKeyword())
80 || (kind == captionsKeyword())
81 || (kind == mainKeyword())
82 || (kind == signKeyword())
83 || (kind == subtitlesKeyword())
84 || (kind == commentaryKeyword())
85 || (kind == emptyAtom);
88 AtomicString VideoTrack::defaultKind() const
90 return emptyAtom;
93 } // namespace blink