2012-01-19 19:24:00 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -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/. */
|
2012-01-19 19:24:00 -08:00
|
|
|
#ifndef mozilla_dom_power_PowerManager_h
|
|
|
|
#define mozilla_dom_power_PowerManager_h
|
|
|
|
|
2012-03-07 03:03:25 -08:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsTArray.h"
|
2012-01-19 19:24:00 -08:00
|
|
|
#include "nsIDOMPowerManager.h"
|
2012-03-07 03:03:25 -08:00
|
|
|
#include "nsIDOMWakeLockListener.h"
|
|
|
|
#include "nsIDOMWindow.h"
|
|
|
|
#include "nsWeakReference.h"
|
2012-01-19 19:24:00 -08:00
|
|
|
|
2012-08-11 04:40:43 -07:00
|
|
|
class nsPIDOMWindow;
|
|
|
|
|
2012-01-19 19:24:00 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
namespace power {
|
|
|
|
|
|
|
|
class PowerManager
|
|
|
|
: public nsIDOMMozPowerManager
|
2012-03-07 03:03:25 -08:00
|
|
|
, public nsIDOMMozWakeLockListener
|
2012-01-19 19:24:00 -08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMMOZPOWERMANAGER
|
2012-03-07 03:03:25 -08:00
|
|
|
NS_DECL_NSIDOMMOZWAKELOCKLISTENER
|
2012-01-19 19:24:00 -08:00
|
|
|
|
|
|
|
PowerManager() {};
|
|
|
|
virtual ~PowerManager() {};
|
2012-03-07 03:03:25 -08:00
|
|
|
|
|
|
|
nsresult Init(nsIDOMWindow *aWindow);
|
|
|
|
nsresult Shutdown();
|
|
|
|
|
2012-08-11 04:40:43 -07:00
|
|
|
static already_AddRefed<PowerManager>
|
|
|
|
CheckPermissionAndCreateInstance(nsPIDOMWindow*);
|
|
|
|
|
2012-03-07 03:03:25 -08:00
|
|
|
private:
|
|
|
|
|
|
|
|
nsWeakPtr mWindow;
|
|
|
|
nsTArray<nsCOMPtr<nsIDOMMozWakeLockListener> > mListeners;
|
2012-01-19 19:24:00 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace power
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_power_PowerManager_h
|