2012-07-16 09:38:18 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_system_nsvolumeservice_h__
|
|
|
|
#define mozilla_system_nsvolumeservice_h__
|
|
|
|
|
2013-04-18 07:13:23 -07:00
|
|
|
#include "mozilla/Monitor.h"
|
2012-12-14 16:01:34 -08:00
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "mozilla/StaticPtr.h"
|
2012-07-16 09:38:18 -07:00
|
|
|
#include "nsCOMPtr.h"
|
2012-12-14 16:01:34 -08:00
|
|
|
#include "nsIDOMWakeLockListener.h"
|
2012-07-16 09:38:18 -07:00
|
|
|
#include "nsIVolume.h"
|
|
|
|
#include "nsIVolumeService.h"
|
|
|
|
#include "nsVolume.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace system {
|
|
|
|
|
2012-12-14 16:01:34 -08:00
|
|
|
class WakeLockCallback;
|
2013-05-17 12:55:14 -07:00
|
|
|
class Volume;
|
2012-12-14 16:01:34 -08:00
|
|
|
|
2012-07-16 09:38:18 -07:00
|
|
|
/***************************************************************************
|
|
|
|
* The nsVolumeData class encapsulates the data that is updated/maintained
|
|
|
|
* on the main thread in order to support the nsIVolume and nsIVolumeService
|
|
|
|
* classes.
|
|
|
|
*/
|
|
|
|
|
2012-12-14 16:01:34 -08:00
|
|
|
class nsVolumeService MOZ_FINAL : public nsIVolumeService,
|
|
|
|
public nsIDOMMozWakeLockListener
|
2012-07-16 09:38:18 -07:00
|
|
|
{
|
|
|
|
public:
|
2013-07-18 19:21:20 -07:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2012-07-16 09:38:18 -07:00
|
|
|
NS_DECL_NSIVOLUMESERVICE
|
2012-12-14 16:01:34 -08:00
|
|
|
NS_DECL_NSIDOMMOZWAKELOCKLISTENER
|
2012-07-16 09:38:18 -07:00
|
|
|
|
|
|
|
nsVolumeService();
|
|
|
|
|
2012-12-14 16:01:34 -08:00
|
|
|
static already_AddRefed<nsVolumeService> GetSingleton();
|
2013-01-07 08:43:02 -08:00
|
|
|
//static nsVolumeService* GetSingleton();
|
2012-12-14 16:01:34 -08:00
|
|
|
static void Shutdown();
|
|
|
|
|
2013-04-02 12:52:17 -07:00
|
|
|
void UpdateVolume(nsIVolume* aVolume);
|
2013-01-07 08:43:02 -08:00
|
|
|
void UpdateVolumeIOThread(const Volume* aVolume);
|
2012-07-16 09:38:18 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
~nsVolumeService();
|
|
|
|
|
2013-04-18 07:13:23 -07:00
|
|
|
void CheckMountLock(const nsAString& aMountLockName,
|
|
|
|
const nsAString& aMountLockState);
|
|
|
|
already_AddRefed<nsVolume> FindVolumeByMountLockName(const nsAString& aMountLockName);
|
|
|
|
already_AddRefed<nsVolume> FindVolumeByName(const nsAString& aName);
|
2013-07-08 23:37:47 -07:00
|
|
|
already_AddRefed<nsVolume> CreateOrFindVolumeByName(const nsAString& aName, bool aIsFake = false);
|
2013-04-18 07:13:23 -07:00
|
|
|
|
|
|
|
Monitor mArrayMonitor;
|
2012-12-14 16:01:34 -08:00
|
|
|
nsVolume::Array mVolumeArray;
|
|
|
|
|
|
|
|
static StaticRefPtr<nsVolumeService> sSingleton;
|
2012-07-16 09:38:18 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // system
|
|
|
|
} // mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_system_nsvolumeservice_h__
|