Bug 1852754: part 9) Add tests for dynamically loading <link rel="prefetch"> elements...
[gecko.git] / dom / media / VideoTrackList.h
blob370e281472fbf29e3d0fb353e71213a3d14197de
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_VideoTrackList_h
8 #define mozilla_dom_VideoTrackList_h
10 #include "MediaTrack.h"
11 #include "MediaTrackList.h"
13 namespace mozilla::dom {
15 class VideoTrack;
17 class VideoTrackList : public MediaTrackList {
18 public:
19 VideoTrackList(nsIGlobalObject* aOwnerObject, HTMLMediaElement* aMediaElement)
20 : MediaTrackList(aOwnerObject, aMediaElement), mSelectedIndex(-1) {}
22 JSObject* WrapObject(JSContext* aCx,
23 JS::Handle<JSObject*> aGivenProto) override;
25 VideoTrack* operator[](uint32_t aIndex);
27 void RemoveTrack(const RefPtr<MediaTrack>& aTrack) override;
29 void EmptyTracks() override;
31 VideoTrack* GetSelectedTrack();
33 // WebIDL
34 int32_t SelectedIndex() const { return mSelectedIndex; }
36 VideoTrack* IndexedGetter(uint32_t aIndex, bool& aFound);
38 VideoTrack* GetTrackById(const nsAString& aId);
40 friend class VideoTrack;
42 protected:
43 VideoTrackList* AsVideoTrackList() override { return this; }
45 private:
46 int32_t mSelectedIndex;
49 } // namespace mozilla::dom
51 #endif // mozilla_dom_VideoTrackList_h