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