Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_system_nsvolumeservice_h__
6 #define mozilla_system_nsvolumeservice_h__
8 #include "mozilla/Monitor.h"
9 #include "mozilla/RefPtr.h"
10 #include "mozilla/StaticPtr.h"
11 #include "nsCOMPtr.h"
12 #include "nsIDOMWakeLockListener.h"
13 #include "nsIVolume.h"
14 #include "nsIVolumeService.h"
15 #include "nsVolume.h"
17 namespace mozilla {
18 namespace system {
20 class WakeLockCallback;
21 class Volume;
23 /***************************************************************************
24 * The nsVolumeData class encapsulates the data that is updated/maintained
25 * on the main thread in order to support the nsIVolume and nsIVolumeService
26 * classes.
27 */
29 class nsVolumeService MOZ_FINAL : public nsIVolumeService,
30 public nsIDOMMozWakeLockListener
31 {
32 public:
33 NS_DECL_THREADSAFE_ISUPPORTS
34 NS_DECL_NSIVOLUMESERVICE
35 NS_DECL_NSIDOMMOZWAKELOCKLISTENER
37 nsVolumeService();
39 static already_AddRefed<nsVolumeService> GetSingleton();
40 //static nsVolumeService* GetSingleton();
41 static void Shutdown();
43 void UpdateVolume(nsIVolume* aVolume);
44 void UpdateVolumeIOThread(const Volume* aVolume);
46 private:
47 ~nsVolumeService();
49 void CheckMountLock(const nsAString& aMountLockName,
50 const nsAString& aMountLockState);
51 already_AddRefed<nsVolume> FindVolumeByMountLockName(const nsAString& aMountLockName);
52 already_AddRefed<nsVolume> FindVolumeByName(const nsAString& aName);
53 already_AddRefed<nsVolume> CreateOrFindVolumeByName(const nsAString& aName, bool aIsFake = false);
55 Monitor mArrayMonitor;
56 nsVolume::Array mVolumeArray;
58 static StaticRefPtr<nsVolumeService> sSingleton;
59 };
61 } // system
62 } // mozilla
64 #endif // mozilla_system_nsvolumeservice_h__