michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 et tw=78: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_TextTrackList_h michael@0: #define mozilla_dom_TextTrackList_h michael@0: michael@0: #include "mozilla/DOMEventTargetHelper.h" michael@0: #include "mozilla/dom/TextTrack.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class HTMLMediaElement; michael@0: class TextTrackManager; michael@0: class CompareTextTracks; michael@0: class TrackEvent; michael@0: class TrackEventRunner; michael@0: michael@0: class TextTrackList MOZ_FINAL : public DOMEventTargetHelper michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TextTrackList, DOMEventTargetHelper) michael@0: michael@0: TextTrackList(nsPIDOMWindow* aOwnerWindow); michael@0: TextTrackList(nsPIDOMWindow* aOwnerWindow, TextTrackManager* aTextTrackManager); michael@0: michael@0: virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: uint32_t Length() const michael@0: { michael@0: return mTextTracks.Length(); michael@0: } michael@0: michael@0: // Get all the current active cues. michael@0: void UpdateAndGetShowingCues(nsTArray >& aCues); michael@0: michael@0: TextTrack* IndexedGetter(uint32_t aIndex, bool& aFound); michael@0: TextTrack* operator[](uint32_t aIndex); michael@0: michael@0: already_AddRefed AddTextTrack(TextTrackKind aKind, michael@0: const nsAString& aLabel, michael@0: const nsAString& aLanguage, michael@0: TextTrackMode aMode, michael@0: TextTrackReadyState aReadyState, michael@0: TextTrackSource aTextTrackSource, michael@0: const CompareTextTracks& aCompareTT); michael@0: TextTrack* GetTrackById(const nsAString& aId); michael@0: michael@0: void AddTextTrack(TextTrack* aTextTrack, const CompareTextTracks& aCompareTT); michael@0: michael@0: void RemoveTextTrack(TextTrack* aTrack); michael@0: void DidSeek(); michael@0: michael@0: HTMLMediaElement* GetMediaElement(); michael@0: void SetTextTrackManager(TextTrackManager* aTextTrackManager); michael@0: michael@0: nsresult DispatchTrackEvent(nsIDOMEvent* aEvent); michael@0: void CreateAndDispatchChangeEvent(); michael@0: michael@0: IMPL_EVENT_HANDLER(change) michael@0: IMPL_EVENT_HANDLER(addtrack) michael@0: IMPL_EVENT_HANDLER(removetrack) michael@0: michael@0: private: michael@0: nsTArray< nsRefPtr > mTextTracks; michael@0: nsRefPtr mTextTrackManager; michael@0: michael@0: void CreateAndDispatchTrackEventRunner(TextTrack* aTrack, michael@0: const nsAString& aEventName); michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_TextTrackList_h