1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
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_audio_channel_agent_h__
8 #define mozilla_dom_audio_channel_agent_h__
10 #include "nsIAudioChannelAgent.h"
11 #include "nsCycleCollectionParticipant.h"
13 #include "nsWeakPtr.h"
15 #define NS_AUDIOCHANNELAGENT_CONTRACTID "@mozilla.org/audiochannelagent;1"
16 // f27688e2-3dd7-11e2-904e-10bf48d64bd4
17 #define NS_AUDIOCHANNELAGENT_CID {0xf27688e2, 0x3dd7, 0x11e2, \
18 {0x90, 0x4e, 0x10, 0xbf, 0x48, 0xd6, 0x4b, 0xd4}}
26 class AudioChannelAgent
: public nsIAudioChannelAgent
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 NS_DECL_NSIAUDIOCHANNELAGENT
32 NS_DECL_CYCLE_COLLECTION_CLASS(AudioChannelAgent
)
35 virtual void NotifyAudioChannelStateChanged();
37 void WindowVolumeChanged();
39 nsIDOMWindow
* Window() const
45 virtual ~AudioChannelAgent();
47 // Returns mCallback if that's non-null, or otherwise tries to get an
48 // nsIAudioChannelAgentCallback out of mWeakCallback.
49 already_AddRefed
<nsIAudioChannelAgentCallback
> GetCallback();
51 nsresult
InitInternal(nsIDOMWindow
* aWindow
, int32_t aAudioAgentType
,
52 nsIAudioChannelAgentCallback
* aCallback
,
53 bool aUseWeakRef
, bool aWithVideo
=false);
55 nsCOMPtr
<nsIDOMWindow
> mWindow
;
56 nsCOMPtr
<nsIAudioChannelAgentCallback
> mCallback
;
57 nsWeakPtr mWeakCallback
;
58 int32_t mAudioChannelType
;
65 } // namespace mozilla