Chromium Code Reviews| Index: Source/core/html/track/VideoTrack.cpp |
| diff --git a/Source/core/html/track/VideoTrack.cpp b/Source/core/html/track/VideoTrack.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a75239f7e632020dd9153760b222a609f2e150f2 |
| --- /dev/null |
| +++ b/Source/core/html/track/VideoTrack.cpp |
| @@ -0,0 +1,89 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| +#include "core/html/track/VideoTrack.h" |
| + |
| +#include "core/html/track/VideoTrackList.h" |
| + |
| +namespace WebCore { |
| + |
| +VideoTrack::VideoTrack(HTMLMediaElement* mediaElement, const AtomicString& id, const AtomicString& kind, const AtomicString& label, const AtomicString& language) |
| + : TrackBase(TrackBase::VideoTrack, label, language, id) |
| + , m_selected(false) |
| +{ |
| + ASSERT(mediaElement); |
| + ASSERT(!id.isEmpty()); |
| + |
| + ScriptWrappable::init(this); |
| + setKind(kind); |
| + setMediaElement(mediaElement); |
| +} |
| + |
| +VideoTrack::~VideoTrack() |
| +{ |
| +} |
| + |
| +void VideoTrack::setSelected(bool selected) |
| +{ |
| + if (selected == m_selected) |
| + return; |
| + |
| + m_selected = selected; |
| + if (mediaElement()) |
| + mediaElement()->selectedVideoTrackChanged(m_selected ? id() : AtomicString()); |
|
Inactive
2014/03/08 03:05:59
nullAtom
acolwell GONE FROM CHROMIUM
2014/03/08 19:56:42
Done.
|
| +} |
| + |
| +const AtomicString& VideoTrack::alternativeKeyword() |
| +{ |
| + DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicString::ConstructFromLiteral)); |
| + return keyword; |
| +} |
| + |
| +const AtomicString& VideoTrack::captionsKeyword() |
| +{ |
| + DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("captions", AtomicString::ConstructFromLiteral)); |
| + return keyword; |
| +} |
| + |
| +const AtomicString& VideoTrack::mainKeyword() |
| +{ |
| + DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::ConstructFromLiteral)); |
| + return keyword; |
| +} |
| + |
| +const AtomicString& VideoTrack::signKeyword() |
| +{ |
| + DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("sign", AtomicString::ConstructFromLiteral)); |
| + return keyword; |
| +} |
| + |
| +const AtomicString& VideoTrack::subtitlesKeyword() |
| +{ |
| + DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("subtitles", AtomicString::ConstructFromLiteral)); |
| + return keyword; |
| +} |
| + |
| +const AtomicString& VideoTrack::commentaryKeyword() |
| +{ |
| + DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString::ConstructFromLiteral)); |
| + return keyword; |
| +} |
| + |
| +bool VideoTrack::isValidKind(const AtomicString& kind) const |
| +{ |
| + return (kind == alternativeKeyword()) |
| + || (kind == captionsKeyword()) |
| + || (kind == mainKeyword()) |
| + || (kind == signKeyword()) |
| + || (kind == subtitlesKeyword()) |
| + || (kind == commentaryKeyword()); |
| +} |
| + |
| +AtomicString VideoTrack::defaultKind() const |
|
Inactive
2014/03/08 03:05:59
const AtomicString& ?
acolwell GONE FROM CHROMIUM
2014/03/08 19:56:42
Requires changing base class. Will defer to anothe
|
| +{ |
| + return AtomicString(); |
|
Inactive
2014/03/08 03:05:59
nullAtom
acolwell GONE FROM CHROMIUM
2014/03/08 19:56:42
Done.
|
| +} |
| + |
| +} |