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:
parent
28d96e2d29
commit
56b53e71aa
6 changed files with 104 additions and 2 deletions
|
@ -20,11 +20,16 @@ class PowerObserverLinux : public base::PowerObserver {
|
|||
public:
|
||||
PowerObserverLinux();
|
||||
|
||||
void BlockShutdown();
|
||||
void UnblockShutdown();
|
||||
virtual bool OnShutdown() { return false; }
|
||||
|
||||
private:
|
||||
void TakeSleepLock();
|
||||
void OnLoginServiceAvailable(bool available);
|
||||
void OnInhibitResponse(base::ScopedFD* scoped_fd, dbus::Response* response);
|
||||
void OnPrepareForSleep(dbus::Signal* signal);
|
||||
void OnPrepareForShutdown(dbus::Signal* signal);
|
||||
void OnSignalConnected(const std::string& interface,
|
||||
const std::string& signal,
|
||||
bool success);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue