michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_system_nsvolumeservice_h__ michael@0: #define mozilla_system_nsvolumeservice_h__ michael@0: michael@0: #include "mozilla/Monitor.h" michael@0: #include "mozilla/RefPtr.h" michael@0: #include "mozilla/StaticPtr.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIDOMWakeLockListener.h" michael@0: #include "nsIVolume.h" michael@0: #include "nsIVolumeService.h" michael@0: #include "nsVolume.h" michael@0: michael@0: namespace mozilla { michael@0: namespace system { michael@0: michael@0: class WakeLockCallback; michael@0: class Volume; michael@0: michael@0: /*************************************************************************** michael@0: * The nsVolumeData class encapsulates the data that is updated/maintained michael@0: * on the main thread in order to support the nsIVolume and nsIVolumeService michael@0: * classes. michael@0: */ michael@0: michael@0: class nsVolumeService MOZ_FINAL : public nsIVolumeService, michael@0: public nsIDOMMozWakeLockListener michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIVOLUMESERVICE michael@0: NS_DECL_NSIDOMMOZWAKELOCKLISTENER michael@0: michael@0: nsVolumeService(); michael@0: michael@0: static already_AddRefed GetSingleton(); michael@0: //static nsVolumeService* GetSingleton(); michael@0: static void Shutdown(); michael@0: michael@0: void UpdateVolume(nsIVolume* aVolume); michael@0: void UpdateVolumeIOThread(const Volume* aVolume); michael@0: michael@0: private: michael@0: ~nsVolumeService(); michael@0: michael@0: void CheckMountLock(const nsAString& aMountLockName, michael@0: const nsAString& aMountLockState); michael@0: already_AddRefed FindVolumeByMountLockName(const nsAString& aMountLockName); michael@0: already_AddRefed FindVolumeByName(const nsAString& aName); michael@0: already_AddRefed CreateOrFindVolumeByName(const nsAString& aName, bool aIsFake = false); michael@0: michael@0: Monitor mArrayMonitor; michael@0: nsVolume::Array mVolumeArray; michael@0: michael@0: static StaticRefPtr sSingleton; michael@0: }; michael@0: michael@0: } // system michael@0: } // mozilla michael@0: michael@0: #endif // mozilla_system_nsvolumeservice_h__