dom/system/gonk/nsVolumeMountLock.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/system/gonk/nsVolumeMountLock.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef mozilla_system_nsvolumemountlock_h__
     1.9 +#define mozilla_system_nsvolumemountlock_h__
    1.10 +
    1.11 +#include "nsIVolumeMountLock.h"
    1.12 +
    1.13 +#include "mozilla/dom/WakeLock.h"
    1.14 +#include "nsIObserver.h"
    1.15 +#include "nsString.h"
    1.16 +#include "nsTArray.h"
    1.17 +#include "nsAutoPtr.h"
    1.18 +#include "nsWeakReference.h"
    1.19 +
    1.20 +namespace mozilla {
    1.21 +namespace system {
    1.22 +
    1.23 +/* The VolumeMountLock is designed so that it can be used in the Child or
    1.24 + * Parent process. While the VolumeMountLock object exists, then the
    1.25 + * VolumeManager/AutoMounter will prevent a mounted volume from being
    1.26 + * shared with the PC.
    1.27 + */
    1.28 +
    1.29 +class nsVolumeMountLock MOZ_FINAL : public nsIVolumeMountLock,
    1.30 +                                    public nsIObserver,
    1.31 +                                    public nsSupportsWeakReference
    1.32 +{
    1.33 +public:
    1.34 +  NS_DECL_ISUPPORTS
    1.35 +  NS_DECL_NSIOBSERVER
    1.36 +  NS_DECL_NSIVOLUMEMOUNTLOCK
    1.37 +
    1.38 +  static already_AddRefed<nsVolumeMountLock> Create(const nsAString& volumeName);
    1.39 +
    1.40 +  const nsString& VolumeName() const  { return mVolumeName; }
    1.41 +
    1.42 +private:
    1.43 +  nsVolumeMountLock(const nsAString& aVolumeName);
    1.44 +  ~nsVolumeMountLock();
    1.45 +
    1.46 +  nsresult Init();
    1.47 +
    1.48 +  nsRefPtr<dom::WakeLock>  mWakeLock;
    1.49 +  nsString                 mVolumeName;
    1.50 +  int32_t                  mVolumeGeneration;
    1.51 +  bool                     mUnlocked;
    1.52 +};
    1.53 +
    1.54 +} // namespace system
    1.55 +} // namespace mozilla
    1.56 +
    1.57 +#endif  // mozilla_system_nsvolumemountlock_h__

mercurial