Bug 1572460 - Refactor `selection` out of the `InspectorFront`. r=yulia
[gecko.git] / dom / media / AudioTrack.h
blob5f414206a6344b6c3623245aeb6bc5f481d01091
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_AudioTrack_h
8 #define mozilla_dom_AudioTrack_h
10 #include "MediaTrack.h"
12 namespace mozilla {
13 namespace dom {
15 class AudioStreamTrack;
17 class AudioTrack : public MediaTrack {
18 public:
19 AudioTrack(nsIGlobalObject* aOwnerGlobal, const nsAString& aId,
20 const nsAString& aKind, const nsAString& aLabel,
21 const nsAString& aLanguage, bool aEnabled,
22 AudioStreamTrack* aStreamTrack = nullptr);
24 NS_DECL_ISUPPORTS_INHERITED
25 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioTrack, MediaTrack)
27 JSObject* WrapObject(JSContext* aCx,
28 JS::Handle<JSObject*> aGivenProto) override;
30 AudioTrack* AsAudioTrack() override { return this; }
32 void SetEnabledInternal(bool aEnabled, int aFlags) override;
34 // Get associated audio stream track when the audio track comes from
35 // MediaStream. This might be nullptr when the src of owning HTMLMediaElement
36 // is not MediaStream.
37 AudioStreamTrack* GetAudioStreamTrack() { return mAudioStreamTrack; }
39 // WebIDL
40 bool Enabled() const { return mEnabled; }
42 void SetEnabled(bool aEnabled);
44 private:
45 virtual ~AudioTrack();
47 bool mEnabled;
48 RefPtr<AudioStreamTrack> mAudioStreamTrack;
51 } // namespace dom
52 } // namespace mozilla
54 #endif // mozilla_dom_AudioTrack_h