dom/system/gonk/nsVolumeMountLock.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:79ad634e1e78
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/. */
4
5 #ifndef mozilla_system_nsvolumemountlock_h__
6 #define mozilla_system_nsvolumemountlock_h__
7
8 #include "nsIVolumeMountLock.h"
9
10 #include "mozilla/dom/WakeLock.h"
11 #include "nsIObserver.h"
12 #include "nsString.h"
13 #include "nsTArray.h"
14 #include "nsAutoPtr.h"
15 #include "nsWeakReference.h"
16
17 namespace mozilla {
18 namespace system {
19
20 /* The VolumeMountLock is designed so that it can be used in the Child or
21 * Parent process. While the VolumeMountLock object exists, then the
22 * VolumeManager/AutoMounter will prevent a mounted volume from being
23 * shared with the PC.
24 */
25
26 class nsVolumeMountLock MOZ_FINAL : public nsIVolumeMountLock,
27 public nsIObserver,
28 public nsSupportsWeakReference
29 {
30 public:
31 NS_DECL_ISUPPORTS
32 NS_DECL_NSIOBSERVER
33 NS_DECL_NSIVOLUMEMOUNTLOCK
34
35 static already_AddRefed<nsVolumeMountLock> Create(const nsAString& volumeName);
36
37 const nsString& VolumeName() const { return mVolumeName; }
38
39 private:
40 nsVolumeMountLock(const nsAString& aVolumeName);
41 ~nsVolumeMountLock();
42
43 nsresult Init();
44
45 nsRefPtr<dom::WakeLock> mWakeLock;
46 nsString mVolumeName;
47 int32_t mVolumeGeneration;
48 bool mUnlocked;
49 };
50
51 } // namespace system
52 } // namespace mozilla
53
54 #endif // mozilla_system_nsvolumemountlock_h__

mercurial