Chromium Code Reviews| Index: Source/core/html/track/VideoTrackList.cpp |
| diff --git a/Source/core/html/track/VideoTrackList.cpp b/Source/core/html/track/VideoTrackList.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0c3b210684ba0bd11330136c78b5af2b0f312335 |
| --- /dev/null |
| +++ b/Source/core/html/track/VideoTrackList.cpp |
| @@ -0,0 +1,68 @@ |
| +// 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/VideoTrackList.h" |
| + |
| +#include "core/html/HTMLMediaElement.h" |
| +#include "core/html/track/VideoTrack.h" |
| + |
| +namespace WebCore { |
| + |
| +VideoTrackList::~VideoTrackList() |
| +{ |
| +} |
| + |
| +VideoTrackList::VideoTrackList(HTMLMediaElement* owner) |
| + : TrackBaseList(owner) |
| + , m_selectedIndex(-1) |
| +{ |
| + ScriptWrappable::init(this); |
| +} |
| + |
| +VideoTrack* VideoTrackList::anonymousIndexedGetter(unsigned index) const |
| +{ |
| + return static_cast<VideoTrack*>(getByIndex(index)); |
| +} |
| + |
| +VideoTrack* VideoTrackList::getTrackById(const AtomicString& id) const |
| +{ |
| + return static_cast<VideoTrack*>(getById(id)); |
| +} |
| + |
| +const AtomicString& VideoTrackList::interfaceName() const |
| +{ |
| + return EventTargetNames::VideoTrackList; |
| +} |
| + |
| +ExecutionContext* VideoTrackList::executionContext() const |
| +{ |
| + return owner()->executionContext(); |
|
fs
2014/02/24 10:32:36
See comment in AudioTrackList::executionContext().
acolwell GONE FROM CHROMIUM
2014/03/07 22:08:43
Done.
|
| +} |
| + |
| +void VideoTrackList::trackSelected(VideoTrack* track) |
| +{ |
| + AtomicString oldTrackID; |
| + AtomicString newTrackID; |
| + |
| + if (m_selectedIndex != -1) { |
| + VideoTrack* oldSelectedTrack = anonymousIndexedGetter(m_selectedIndex); |
| + oldSelectedTrack->clearSelected(); |
| + oldTrackID = oldSelectedTrack->id(); |
| + } |
| + |
| + if (track) { |
| + m_selectedIndex = getIndex(track); |
| + newTrackID = track->id(); |
| + } else { |
| + m_selectedIndex = -1; |
| + } |
| + |
| + if (owner()) |
| + owner()->didSelectedVideoTrackChange(oldTrackID, newTrackID); |
| + |
| + scheduleChangeEvent(); |
| +} |
| + |
| +} |