Chromium Code Reviews| OLD | NEW |
|---|---|
| (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/VideoTrackList.h" | |
| 7 | |
| 8 #include "core/html/HTMLMediaElement.h" | |
| 9 #include "core/html/track/VideoTrack.h" | |
| 10 | |
| 11 namespace WebCore { | |
| 12 | |
| 13 VideoTrackList::~VideoTrackList() | |
| 14 { | |
| 15 } | |
| 16 | |
| 17 VideoTrackList::VideoTrackList(HTMLMediaElement* owner) | |
| 18 : TrackBaseList(owner) | |
| 19 , m_selectedIndex(-1) | |
| 20 { | |
| 21 ScriptWrappable::init(this); | |
| 22 } | |
| 23 | |
| 24 VideoTrack* VideoTrackList::anonymousIndexedGetter(unsigned index) const | |
| 25 { | |
| 26 return static_cast<VideoTrack*>(getByIndex(index)); | |
| 27 } | |
| 28 | |
| 29 VideoTrack* VideoTrackList::getTrackById(const AtomicString& id) const | |
| 30 { | |
| 31 return static_cast<VideoTrack*>(getById(id)); | |
| 32 } | |
| 33 | |
| 34 const AtomicString& VideoTrackList::interfaceName() const | |
| 35 { | |
| 36 return EventTargetNames::VideoTrackList; | |
| 37 } | |
| 38 | |
| 39 ExecutionContext* VideoTrackList::executionContext() const | |
| 40 { | |
| 41 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.
| |
| 42 } | |
| 43 | |
| 44 void VideoTrackList::trackSelected(VideoTrack* track) | |
| 45 { | |
| 46 AtomicString oldTrackID; | |
| 47 AtomicString newTrackID; | |
| 48 | |
| 49 if (m_selectedIndex != -1) { | |
| 50 VideoTrack* oldSelectedTrack = anonymousIndexedGetter(m_selectedIndex); | |
| 51 oldSelectedTrack->clearSelected(); | |
| 52 oldTrackID = oldSelectedTrack->id(); | |
| 53 } | |
| 54 | |
| 55 if (track) { | |
| 56 m_selectedIndex = getIndex(track); | |
| 57 newTrackID = track->id(); | |
| 58 } else { | |
| 59 m_selectedIndex = -1; | |
| 60 } | |
| 61 | |
| 62 if (owner()) | |
| 63 owner()->didSelectedVideoTrackChange(oldTrackID, newTrackID); | |
| 64 | |
| 65 scheduleChangeEvent(); | |
| 66 } | |
| 67 | |
| 68 } | |
| OLD | NEW |