Simplify the public PowerObserver interface
This commit is contained in:
parent
e0e7dd2a8f
commit
8ae3d9dd0b
5 changed files with 23 additions and 34 deletions
|
@ -18,19 +18,7 @@ namespace atom {
|
|||
#if defined(OS_LINUX)
|
||||
typedef PowerObserverLinux PowerObserver;
|
||||
#else
|
||||
class PowerObserver : public base::PowerObserver {
|
||||
public:
|
||||
PowerObserver() {}
|
||||
void BlockShutdown() {}
|
||||
void UnblockShutdown() {}
|
||||
// Notification that the system is rebooting or shutting down. If the
|
||||
// implementation returns true, the PowerObserver instance should try to delay
|
||||
// OS shutdown so the application can perform cleanup before exiting.
|
||||
virtual bool OnShutdown() { return false; }
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(PowerObserver);
|
||||
};
|
||||
typedef base::PowerObserver PowerObserver;
|
||||
#endif // defined(OS_LINUX)
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -20,10 +20,12 @@ class PowerObserverLinux : public base::PowerObserver {
|
|||
public:
|
||||
PowerObserverLinux();
|
||||
|
||||
protected:
|
||||
void BlockSleep();
|
||||
void UnblockSleep();
|
||||
void BlockShutdown();
|
||||
void UnblockShutdown();
|
||||
|
||||
virtual bool OnShutdown() { return false; }
|
||||
|
||||
private:
|
||||
|
@ -41,6 +43,7 @@ class PowerObserverLinux : public base::PowerObserver {
|
|||
base::ScopedFD sleep_lock_;
|
||||
base::ScopedFD shutdown_lock_;
|
||||
base::WeakPtrFactory<PowerObserverLinux> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PowerObserverLinux);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue