|
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/. */ |
|
6 |
|
7 #ifndef mozilla_dom_audio_channel_agent_h__ |
|
8 #define mozilla_dom_audio_channel_agent_h__ |
|
9 |
|
10 #include "nsIAudioChannelAgent.h" |
|
11 #include "nsCycleCollectionParticipant.h" |
|
12 #include "nsCOMPtr.h" |
|
13 #include "nsWeakPtr.h" |
|
14 |
|
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}} |
|
19 |
|
20 class nsIDOMWindow; |
|
21 |
|
22 namespace mozilla { |
|
23 namespace dom { |
|
24 |
|
25 /* Header file */ |
|
26 class AudioChannelAgent : public nsIAudioChannelAgent |
|
27 { |
|
28 public: |
|
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
30 NS_DECL_NSIAUDIOCHANNELAGENT |
|
31 |
|
32 NS_DECL_CYCLE_COLLECTION_CLASS(AudioChannelAgent) |
|
33 |
|
34 AudioChannelAgent(); |
|
35 virtual void NotifyAudioChannelStateChanged(); |
|
36 |
|
37 void WindowVolumeChanged(); |
|
38 |
|
39 nsIDOMWindow* Window() const |
|
40 { |
|
41 return mWindow; |
|
42 } |
|
43 |
|
44 private: |
|
45 virtual ~AudioChannelAgent(); |
|
46 |
|
47 // Returns mCallback if that's non-null, or otherwise tries to get an |
|
48 // nsIAudioChannelAgentCallback out of mWeakCallback. |
|
49 already_AddRefed<nsIAudioChannelAgentCallback> GetCallback(); |
|
50 |
|
51 nsresult InitInternal(nsIDOMWindow* aWindow, int32_t aAudioAgentType, |
|
52 nsIAudioChannelAgentCallback* aCallback, |
|
53 bool aUseWeakRef, bool aWithVideo=false); |
|
54 |
|
55 nsCOMPtr<nsIDOMWindow> mWindow; |
|
56 nsCOMPtr<nsIAudioChannelAgentCallback> mCallback; |
|
57 nsWeakPtr mWeakCallback; |
|
58 int32_t mAudioChannelType; |
|
59 bool mIsRegToService; |
|
60 bool mVisible; |
|
61 bool mWithVideo; |
|
62 }; |
|
63 |
|
64 } // namespace dom |
|
65 } // namespace mozilla |
|
66 #endif |
|
67 |