Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(691)

Side by Side Diff: Source/core/html/track/VideoTrack.cpp

Issue 170233009: Initial implementation of AudioTrack, AudioTrackList, VideoTrack, and VideoTrackList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@blink-master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "config.h"
6 #include "core/html/track/VideoTrack.h"
7
8 #include "core/html/track/VideoTrackList.h"
9
10 namespace WebCore {
11
12 VideoTrack::VideoTrack(VideoTrackList* owner, const AtomicString& id, const Atom icString& kind, const AtomicString& label, const AtomicString& language)
13 : TrackBase(TrackBase::VideoTrack, label, language, id)
14 , m_owner(owner)
15 , m_selected(false)
16 {
17 ScriptWrappable::init(this);
18 setKind(kind);
19 }
20
21 VideoTrack::~VideoTrack()
22 {
23 }
24
25 void VideoTrack::setSelected(bool selected)
26 {
27 if (selected == m_selected)
28 return;
29
30 m_selected = selected;
31 if (m_owner)
32 m_owner->trackSelected(m_selected ? this : 0);
33 }
34
35 const AtomicString& VideoTrack::alternativeKeyword()
36 {
37 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicStrin g::ConstructFromLiteral));
38 return keyword;
39 }
40
41 const AtomicString& VideoTrack::captionsKeyword()
42 {
43 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("captions", AtomicString:: ConstructFromLiteral));
44 return keyword;
45 }
46
47 const AtomicString& VideoTrack::mainKeyword()
48 {
49 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::Cons tructFromLiteral));
50 return keyword;
51 }
52
53 const AtomicString& VideoTrack::signKeyword()
54 {
55 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("sign", AtomicString::Cons tructFromLiteral));
56 return keyword;
57 }
58
59 const AtomicString& VideoTrack::subtitlesKeyword()
60 {
61 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("subtitles", AtomicString: :ConstructFromLiteral));
62 return keyword;
63 }
64
65 const AtomicString& VideoTrack::commentaryKeyword()
66 {
67 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString ::ConstructFromLiteral));
68 return keyword;
69 }
70
71 bool VideoTrack::isValidKind(const AtomicString& kind) const
72 {
73 return (kind == alternativeKeyword())
74 || (kind == captionsKeyword())
75 || (kind == mainKeyword())
76 || (kind == signKeyword())
77 || (kind == subtitlesKeyword())
78 || (kind == commentaryKeyword());
79 }
80
81 AtomicString VideoTrack::defaultKind() const
82 {
83 return AtomicString();
84 }
85
86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698