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_nsvolumemountlock_h__ michael@0: #define mozilla_system_nsvolumemountlock_h__ michael@0: michael@0: #include "nsIVolumeMountLock.h" michael@0: michael@0: #include "mozilla/dom/WakeLock.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsString.h" michael@0: #include "nsTArray.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsWeakReference.h" michael@0: michael@0: namespace mozilla { michael@0: namespace system { michael@0: michael@0: /* The VolumeMountLock is designed so that it can be used in the Child or michael@0: * Parent process. While the VolumeMountLock object exists, then the michael@0: * VolumeManager/AutoMounter will prevent a mounted volume from being michael@0: * shared with the PC. michael@0: */ michael@0: michael@0: class nsVolumeMountLock MOZ_FINAL : public nsIVolumeMountLock, michael@0: public nsIObserver, michael@0: public nsSupportsWeakReference michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIOBSERVER michael@0: NS_DECL_NSIVOLUMEMOUNTLOCK michael@0: michael@0: static already_AddRefed Create(const nsAString& volumeName); michael@0: michael@0: const nsString& VolumeName() const { return mVolumeName; } michael@0: michael@0: private: michael@0: nsVolumeMountLock(const nsAString& aVolumeName); michael@0: ~nsVolumeMountLock(); michael@0: michael@0: nsresult Init(); michael@0: michael@0: nsRefPtr mWakeLock; michael@0: nsString mVolumeName; michael@0: int32_t mVolumeGeneration; michael@0: bool mUnlocked; michael@0: }; michael@0: michael@0: } // namespace system michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_system_nsvolumemountlock_h__