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 #ifndef TrackBaseList_h |
| 6 #define TrackBaseList_h |
| 7 |
| 8 #include "core/events/EventTarget.h" |
| 9 #include "core/html/HTMLMediaElement.h" |
| 10 |
| 11 namespace WebCore { |
| 12 |
| 13 class GenericEventQueue; |
| 14 class TrackBase; |
| 15 |
| 16 class TrackBaseList : public RefCounted<TrackBaseList>, public EventTargetWithIn
lineData { |
| 17 REFCOUNTED_EVENT_TARGET(TrackBaseList); |
| 18 |
| 19 public: |
| 20 TrackBaseList(HTMLMediaElement* owner); |
| 21 ~TrackBaseList(); |
| 22 |
| 23 unsigned length() const { return m_tracks.size(); } |
| 24 TrackBase* getByIndex(unsigned index) const; |
| 25 TrackBase* getById(const AtomicString& id) const; |
| 26 unsigned getIndex(TrackBase*) const; |
| 27 |
| 28 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
| 29 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); |
| 30 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); |
| 31 |
| 32 void clearOwner() { m_owner = 0; } |
| 33 HTMLMediaElement* owner() const { return m_owner; } |
| 34 |
| 35 void add(TrackBase*); |
| 36 void remove(const String& id); |
| 37 void removeAll(); |
| 38 |
| 39 void scheduleChangeEvent(); |
| 40 |
| 41 private: |
| 42 void scheduleTrackEvent(const AtomicString& eventName, PassRefPtr<TrackBase>
); |
| 43 |
| 44 HTMLMediaElement* m_owner; |
| 45 Vector<RefPtr<TrackBase> > m_tracks; |
| 46 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| 47 }; |
| 48 |
| 49 } |
| 50 |
| 51 #endif |
OLD | NEW |