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,7 +26,7 @@ class PowerObserverLinux : public base::PowerObserver {
void BlockShutdown();
void UnblockShutdown();
virtual bool OnShutdown() { return false; }
void SetShutdownHandler(base::Callback<bool()> should_shutdown);
private:
void OnLoginServiceAvailable(bool available);
@ -37,6 +37,8 @@ class PowerObserverLinux : public base::PowerObserver {
const std::string& signal,
bool success);
base::Callback<bool()> should_shutdown_;
scoped_refptr<dbus::Bus> bus_;
scoped_refptr<dbus::ObjectProxy> logind_;
std::string lock_owner_name_;