Backed out 35 changesets (bug 941158, bug 972518, bug 959520, bug 986063, bug 948895...
[gecko.git] / content / media / TextTrackList.h
blob78a376abaf133b02d603a877940dd2c444f03869
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 et tw=78: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_TextTrackList_h
8 #define mozilla_dom_TextTrackList_h
10 #include "mozilla/dom/TextTrack.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsDOMEventTargetHelper.h"
14 namespace mozilla {
15 namespace dom {
17 class TrackEvent;
18 class TrackEventRunner;
20 class TextTrackList MOZ_FINAL : public nsDOMEventTargetHelper
22 public:
23 NS_DECL_ISUPPORTS_INHERITED
24 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TextTrackList, nsDOMEventTargetHelper)
26 TextTrackList(nsISupports* aGlobal);
28 virtual JSObject* WrapObject(JSContext* aCx,
29 JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
31 nsISupports* GetParentObject() const
33 return mGlobal;
36 uint32_t Length() const
38 return mTextTracks.Length();
41 // Time is in seconds.
42 void Update(double aTime);
44 TextTrack* IndexedGetter(uint32_t aIndex, bool& aFound);
46 already_AddRefed<TextTrack> AddTextTrack(HTMLMediaElement* aMediaElement,
47 TextTrackKind aKind,
48 const nsAString& aLabel,
49 const nsAString& aLanguage);
50 TextTrack* GetTrackById(const nsAString& aId);
52 void AddTextTrack(TextTrack* aTextTrack) {
53 mTextTracks.AppendElement(aTextTrack);
56 void RemoveTextTrack(TextTrack* aTrack);
57 void DidSeek();
59 nsresult DispatchTrackEvent(TrackEvent* aEvent);
61 IMPL_EVENT_HANDLER(addtrack)
62 IMPL_EVENT_HANDLER(removetrack)
64 private:
65 nsCOMPtr<nsISupports> mGlobal;
66 nsTArray< nsRefPtr<TextTrack> > mTextTracks;
68 void CreateAndDispatchTrackEventRunner(TextTrack* aTrack,
69 const nsAString& aEventName);
72 } // namespace dom
73 } // namespace mozilla
75 #endif // mozilla_dom_TextTrackList_h