electron/atom/browser/api/atom_api_power_monitor.h

40 lines
972 B
C
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
2013-08-03 07:58:59 +00:00
// found in the LICENSE file.
#ifndef ATOM_BROWSER_API_ATOM_API_POWER_MONITOR_H_
#define ATOM_BROWSER_API_ATOM_API_POWER_MONITOR_H_
2014-04-17 09:13:17 +00:00
#include "atom/browser/api/event_emitter.h"
2013-08-03 07:58:59 +00:00
#include "base/compiler_specific.h"
#include "base/power_monitor/power_observer.h"
2014-04-17 09:13:17 +00:00
#include "native_mate/handle.h"
2013-08-03 07:58:59 +00:00
namespace atom {
namespace api {
2014-04-17 09:13:17 +00:00
class PowerMonitor : public mate::EventEmitter,
2013-08-03 07:58:59 +00:00
public base::PowerObserver {
public:
2015-05-22 11:11:22 +00:00
static v8::Local<v8::Value> Create(v8::Isolate* isolate);
2013-08-03 07:58:59 +00:00
protected:
2014-04-18 09:25:22 +00:00
PowerMonitor();
2014-04-17 09:13:17 +00:00
virtual ~PowerMonitor();
2013-08-03 07:58:59 +00:00
2014-04-17 09:13:17 +00:00
// base::PowerObserver implementations:
2015-01-10 01:24:36 +00:00
void OnPowerStateChange(bool on_battery_power) override;
void OnSuspend() override;
void OnResume() override;
2013-08-03 07:58:59 +00:00
2014-04-18 09:28:05 +00:00
private:
2013-08-03 07:58:59 +00:00
DISALLOW_COPY_AND_ASSIGN(PowerMonitor);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_POWER_MONITOR_H_