dom/system/gonk/nsVolumeService.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/system/gonk/nsVolumeService.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     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_nsvolumeservice_h__
     1.9 +#define mozilla_system_nsvolumeservice_h__
    1.10 +
    1.11 +#include "mozilla/Monitor.h"
    1.12 +#include "mozilla/RefPtr.h"
    1.13 +#include "mozilla/StaticPtr.h"
    1.14 +#include "nsCOMPtr.h"
    1.15 +#include "nsIDOMWakeLockListener.h"
    1.16 +#include "nsIVolume.h"
    1.17 +#include "nsIVolumeService.h"
    1.18 +#include "nsVolume.h"
    1.19 +
    1.20 +namespace mozilla {
    1.21 +namespace system {
    1.22 +
    1.23 +class WakeLockCallback;
    1.24 +class Volume;
    1.25 +
    1.26 +/***************************************************************************
    1.27 +* The nsVolumeData class encapsulates the data that is updated/maintained
    1.28 +* on the main thread in order to support the nsIVolume and nsIVolumeService
    1.29 +* classes.
    1.30 +*/
    1.31 +
    1.32 +class nsVolumeService MOZ_FINAL : public nsIVolumeService,
    1.33 +                                  public nsIDOMMozWakeLockListener
    1.34 +{
    1.35 +public:
    1.36 +  NS_DECL_THREADSAFE_ISUPPORTS
    1.37 +  NS_DECL_NSIVOLUMESERVICE
    1.38 +  NS_DECL_NSIDOMMOZWAKELOCKLISTENER
    1.39 +
    1.40 +  nsVolumeService();
    1.41 +
    1.42 +  static already_AddRefed<nsVolumeService> GetSingleton();
    1.43 +  //static nsVolumeService* GetSingleton();
    1.44 +  static void Shutdown();
    1.45 +
    1.46 +  void UpdateVolume(nsIVolume* aVolume);
    1.47 +  void UpdateVolumeIOThread(const Volume* aVolume);
    1.48 +
    1.49 +private:
    1.50 +  ~nsVolumeService();
    1.51 +
    1.52 +  void CheckMountLock(const nsAString& aMountLockName,
    1.53 +                      const nsAString& aMountLockState);
    1.54 +  already_AddRefed<nsVolume> FindVolumeByMountLockName(const nsAString& aMountLockName);
    1.55 +  already_AddRefed<nsVolume> FindVolumeByName(const nsAString& aName);
    1.56 +  already_AddRefed<nsVolume> CreateOrFindVolumeByName(const nsAString& aName, bool aIsFake = false);
    1.57 +
    1.58 +  Monitor mArrayMonitor;
    1.59 +  nsVolume::Array mVolumeArray;
    1.60 +
    1.61 +  static StaticRefPtr<nsVolumeService> sSingleton;
    1.62 +};
    1.63 +
    1.64 +} // system
    1.65 +} // mozilla
    1.66 +
    1.67 +#endif  // mozilla_system_nsvolumeservice_h__

mercurial