1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/audiochannel/AudioChannelAgent.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ 1.5 +/* vim: set ts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_dom_audio_channel_agent_h__ 1.11 +#define mozilla_dom_audio_channel_agent_h__ 1.12 + 1.13 +#include "nsIAudioChannelAgent.h" 1.14 +#include "nsCycleCollectionParticipant.h" 1.15 +#include "nsCOMPtr.h" 1.16 +#include "nsWeakPtr.h" 1.17 + 1.18 +#define NS_AUDIOCHANNELAGENT_CONTRACTID "@mozilla.org/audiochannelagent;1" 1.19 +// f27688e2-3dd7-11e2-904e-10bf48d64bd4 1.20 +#define NS_AUDIOCHANNELAGENT_CID {0xf27688e2, 0x3dd7, 0x11e2, \ 1.21 + {0x90, 0x4e, 0x10, 0xbf, 0x48, 0xd6, 0x4b, 0xd4}} 1.22 + 1.23 +class nsIDOMWindow; 1.24 + 1.25 +namespace mozilla { 1.26 +namespace dom { 1.27 + 1.28 +/* Header file */ 1.29 +class AudioChannelAgent : public nsIAudioChannelAgent 1.30 +{ 1.31 +public: 1.32 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.33 + NS_DECL_NSIAUDIOCHANNELAGENT 1.34 + 1.35 + NS_DECL_CYCLE_COLLECTION_CLASS(AudioChannelAgent) 1.36 + 1.37 + AudioChannelAgent(); 1.38 + virtual void NotifyAudioChannelStateChanged(); 1.39 + 1.40 + void WindowVolumeChanged(); 1.41 + 1.42 + nsIDOMWindow* Window() const 1.43 + { 1.44 + return mWindow; 1.45 + } 1.46 + 1.47 +private: 1.48 + virtual ~AudioChannelAgent(); 1.49 + 1.50 + // Returns mCallback if that's non-null, or otherwise tries to get an 1.51 + // nsIAudioChannelAgentCallback out of mWeakCallback. 1.52 + already_AddRefed<nsIAudioChannelAgentCallback> GetCallback(); 1.53 + 1.54 + nsresult InitInternal(nsIDOMWindow* aWindow, int32_t aAudioAgentType, 1.55 + nsIAudioChannelAgentCallback* aCallback, 1.56 + bool aUseWeakRef, bool aWithVideo=false); 1.57 + 1.58 + nsCOMPtr<nsIDOMWindow> mWindow; 1.59 + nsCOMPtr<nsIAudioChannelAgentCallback> mCallback; 1.60 + nsWeakPtr mWeakCallback; 1.61 + int32_t mAudioChannelType; 1.62 + bool mIsRegToService; 1.63 + bool mVisible; 1.64 + bool mWithVideo; 1.65 +}; 1.66 + 1.67 +} // namespace dom 1.68 +} // namespace mozilla 1.69 +#endif 1.70 +