Do not use virtual function to request shutdown

Would make it easier to port to other platforms.
This commit is contained in:
Cheng Zhao 2018-02-05 15:49:43 +09:00
parent 8ae3d9dd0b
commit 109e2c760f
4 changed files with 36 additions and 13 deletions

View file

@ -26,16 +26,20 @@ class PowerMonitor : public mate::TrackableObject<PowerMonitor>,
explicit PowerMonitor(v8::Isolate* isolate);
~PowerMonitor() override;
// Called by native calles.
bool ShouldShutdown();
#if defined(OS_LINUX)
// Private JS APIs.
void BlockShutdown();
void UnblockShutdown();
#endif
// base::PowerObserver implementations:
void OnPowerStateChange(bool on_battery_power) override;
void OnSuspend() override;
void OnResume() override;
#if defined(OS_LINUX)
// atom::PowerObserver
bool OnShutdown() override;
#endif
private:
DISALLOW_COPY_AND_ASSIGN(PowerMonitor);
};