Implement powerMonitor 'shutdown' event for Linux.

The event is emitted when the OS is rebooting/shutting down, and allows
an electron app to call `e.preventDefault()` in order to delay shutdown
and exit cleanly.
This commit is contained in:
Thiago de Arruda 2017-12-07 10:10:40 -03:00 committed by Cheng Zhao
parent 28d96e2d29
commit 56b53e71aa
6 changed files with 104 additions and 2 deletions

View file

@ -26,11 +26,17 @@ class PowerMonitor : public mate::TrackableObject<PowerMonitor>,
explicit PowerMonitor(v8::Isolate* isolate);
~PowerMonitor() override;
void BlockShutdown(mate::Arguments* args);
void UnblockShutdown(mate::Arguments* args);
// base::PowerObserver implementations:
void OnPowerStateChange(bool on_battery_power) override;
void OnSuspend() override;
void OnResume() override;
// atom::PowerObserver
bool OnShutdown() override;
private:
DISALLOW_COPY_AND_ASSIGN(PowerMonitor);
};