#ifndef BASE_POWER_MONITOR_POWER_MONITOR_H_
#define BASE_POWER_MONITOR_POWER_MONITOR_H_
#include "base/base_export.h"
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list_threadsafe.h"
#include "base/power_monitor/power_observer.h"
namespace base {
class PowerMonitorSource;
class BASE_EXPORT PowerMonitor {
public:
explicit PowerMonitor(scoped_ptr<PowerMonitorSource> source);
~PowerMonitor();
static PowerMonitor* Get();
void AddObserver(PowerObserver* observer);
void RemoveObserver(PowerObserver* observer);
bool IsOnBatteryPower();
private:
friend class PowerMonitorSource;
PowerMonitorSource* Source();
void NotifyPowerStateChange(bool battery_in_use);
void NotifySuspend();
void NotifyResume();
scoped_refptr<ObserverListThreadSafe<PowerObserver> > observers_;
scoped_ptr<PowerMonitorSource> source_;
DISALLOW_COPY_AND_ASSIGN(PowerMonitor);
};
}
#endif