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

Side by Side Diff: Source/core/html/track/AudioTrack.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/AudioTrack.h"
7
8 #include "core/html/track/AudioTrackList.h"
9
10 namespace WebCore {
11
12 AudioTrack::AudioTrack(AudioTrackList* owner, const AtomicString& id, const Atom icString& kind, const AtomicString& label, const AtomicString& language)
13 : TrackBase(TrackBase::AudioTrack, label, language, id)
14 , m_owner(owner)
15 , m_enabled(false)
16 {
17 ScriptWrappable::init(this);
18 setKind(kind);
19 }
20
21 AudioTrack::~AudioTrack()
22 {
23 }
24
25 void AudioTrack::setEnabled(bool enabled)
26 {
27 if (enabled == m_enabled)
28 return;
29
30 m_enabled = enabled;
31
32 if (m_owner)
33 m_owner->trackEnabled(id(), m_enabled);
34 }
35
36 const AtomicString& AudioTrack::alternativeKeyword()
37 {
38 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicStrin g::ConstructFromLiteral));
39 return keyword;
40 }
41
42 const AtomicString& AudioTrack::descriptionsKeyword()
43 {
44 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("descriptions", AtomicStri ng::ConstructFromLiteral));
45 return keyword;
46 }
47
48 const AtomicString& AudioTrack::mainKeyword()
49 {
50 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::Cons tructFromLiteral));
51 return keyword;
52 }
53
54 const AtomicString& AudioTrack::mainDescriptionsKeyword()
55 {
56 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main-desc", AtomicString: :ConstructFromLiteral));
57 return keyword;
58 }
59
60 const AtomicString& AudioTrack::translationKeyword()
61 {
62 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("translation", AtomicStrin g::ConstructFromLiteral));
63 return keyword;
64 }
65
66 const AtomicString& AudioTrack::commentaryKeyword()
67 {
68 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString ::ConstructFromLiteral));
69 return keyword;
70 }
71
72 bool AudioTrack::isValidKind(const AtomicString& kind) const
73 {
74 return (kind == alternativeKeyword())
75 || (kind == descriptionsKeyword())
76 || (kind == mainKeyword())
77 || (kind == mainDescriptionsKeyword())
78 || (kind == translationKeyword())
79 || (kind == commentaryKeyword());
80 }
81
82 AtomicString AudioTrack::defaultKind() const
83 {
84 return AtomicString();
85 }
86
87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698