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.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef mozilla_system_nsvolumemountlock_h__ |
michael@0 | 6 | #define mozilla_system_nsvolumemountlock_h__ |
michael@0 | 7 | |
michael@0 | 8 | #include "nsIVolumeMountLock.h" |
michael@0 | 9 | |
michael@0 | 10 | #include "mozilla/dom/WakeLock.h" |
michael@0 | 11 | #include "nsIObserver.h" |
michael@0 | 12 | #include "nsString.h" |
michael@0 | 13 | #include "nsTArray.h" |
michael@0 | 14 | #include "nsAutoPtr.h" |
michael@0 | 15 | #include "nsWeakReference.h" |
michael@0 | 16 | |
michael@0 | 17 | namespace mozilla { |
michael@0 | 18 | namespace system { |
michael@0 | 19 | |
michael@0 | 20 | /* The VolumeMountLock is designed so that it can be used in the Child or |
michael@0 | 21 | * Parent process. While the VolumeMountLock object exists, then the |
michael@0 | 22 | * VolumeManager/AutoMounter will prevent a mounted volume from being |
michael@0 | 23 | * shared with the PC. |
michael@0 | 24 | */ |
michael@0 | 25 | |
michael@0 | 26 | class nsVolumeMountLock MOZ_FINAL : public nsIVolumeMountLock, |
michael@0 | 27 | public nsIObserver, |
michael@0 | 28 | public nsSupportsWeakReference |
michael@0 | 29 | { |
michael@0 | 30 | public: |
michael@0 | 31 | NS_DECL_ISUPPORTS |
michael@0 | 32 | NS_DECL_NSIOBSERVER |
michael@0 | 33 | NS_DECL_NSIVOLUMEMOUNTLOCK |
michael@0 | 34 | |
michael@0 | 35 | static already_AddRefed<nsVolumeMountLock> Create(const nsAString& volumeName); |
michael@0 | 36 | |
michael@0 | 37 | const nsString& VolumeName() const { return mVolumeName; } |
michael@0 | 38 | |
michael@0 | 39 | private: |
michael@0 | 40 | nsVolumeMountLock(const nsAString& aVolumeName); |
michael@0 | 41 | ~nsVolumeMountLock(); |
michael@0 | 42 | |
michael@0 | 43 | nsresult Init(); |
michael@0 | 44 | |
michael@0 | 45 | nsRefPtr<dom::WakeLock> mWakeLock; |
michael@0 | 46 | nsString mVolumeName; |
michael@0 | 47 | int32_t mVolumeGeneration; |
michael@0 | 48 | bool mUnlocked; |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | } // namespace system |
michael@0 | 52 | } // namespace mozilla |
michael@0 | 53 | |
michael@0 | 54 | #endif // mozilla_system_nsvolumemountlock_h__ |