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

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

Issue 284513003: Implement AudioTrack, AudioTrackList, VideoTrack, and VideoTrackList (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: nits Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/track/AudioTrack.h ('k') | Source/core/html/track/AudioTrack.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/HTMLMediaElement.h"
9
10 namespace WebCore {
11
12 AudioTrack::AudioTrack(const String& id, const AtomicString& kind, const AtomicS tring& label, const AtomicString& language, bool enabled)
13 : TrackBase(TrackBase::AudioTrack, label, language, id)
14 , m_enabled(enabled)
15 {
16 ScriptWrappable::init(this);
17 setKind(kind);
18 }
19
20 AudioTrack::~AudioTrack()
21 {
22 }
23
24 void AudioTrack::setEnabled(bool enabled)
25 {
26 if (enabled == m_enabled)
27 return;
28
29 m_enabled = enabled;
30
31 if (mediaElement())
32 mediaElement()->audioTrackChanged();
33 }
34
35 const AtomicString& AudioTrack::alternativeKeyword()
36 {
37 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicStrin g::ConstructFromLiteral));
38 return keyword;
39 }
40
41 const AtomicString& AudioTrack::descriptionsKeyword()
42 {
43 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("descriptions", AtomicStri ng::ConstructFromLiteral));
44 return keyword;
45 }
46
47 const AtomicString& AudioTrack::mainKeyword()
48 {
49 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::Cons tructFromLiteral));
50 return keyword;
51 }
52
53 const AtomicString& AudioTrack::mainDescriptionsKeyword()
54 {
55 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main-desc", AtomicString: :ConstructFromLiteral));
56 return keyword;
57 }
58
59 const AtomicString& AudioTrack::translationKeyword()
60 {
61 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("translation", AtomicStrin g::ConstructFromLiteral));
62 return keyword;
63 }
64
65 const AtomicString& AudioTrack::commentaryKeyword()
66 {
67 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString ::ConstructFromLiteral));
68 return keyword;
69 }
70
71 bool AudioTrack::isValidKind(const AtomicString& kind) const
72 {
73 return (kind == alternativeKeyword())
74 || (kind == descriptionsKeyword())
75 || (kind == mainKeyword())
76 || (kind == mainDescriptionsKeyword())
77 || (kind == translationKeyword())
78 || (kind == commentaryKeyword());
79 }
80
81 AtomicString AudioTrack::defaultKind() const
82 {
83 return emptyAtom;
84 }
85
86 }
OLDNEW
« no previous file with comments | « Source/core/html/track/AudioTrack.h ('k') | Source/core/html/track/AudioTrack.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698