| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_SYSTEM_CHROMEOS_POWER_SUSPEND_OBSERVER_H_ | |
| 6 #define ASH_SYSTEM_CHROMEOS_POWER_SUSPEND_OBSERVER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/callback.h" | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "chromeos/dbus/power_manager_client.h" | |
| 12 #include "chromeos/dbus/session_manager_client.h" | |
| 13 | |
| 14 namespace ash { | |
| 15 namespace internal { | |
| 16 | |
| 17 // A class to observe suspend events. | |
| 18 class SuspendObserver : public chromeos::PowerManagerClient::Observer, | |
| 19 public chromeos::SessionManagerClient::Observer { | |
| 20 public: | |
| 21 // This class registers/unregisters itself as an observer in ctor/dtor. | |
| 22 SuspendObserver(); | |
| 23 virtual ~SuspendObserver(); | |
| 24 | |
| 25 // chromeos::PowerManagerClient::Observer override. | |
| 26 virtual void SuspendImminent() OVERRIDE; | |
| 27 | |
| 28 // chromeos::SessionManagerClient::Observer overrides. | |
| 29 virtual void ScreenIsLocked() OVERRIDE; | |
| 30 virtual void ScreenIsUnlocked() OVERRIDE; | |
| 31 | |
| 32 private: | |
| 33 chromeos::PowerManagerClient* power_client_; // not owned | |
| 34 chromeos::SessionManagerClient* session_client_; // not owned | |
| 35 | |
| 36 // Is the screen currently locked? | |
| 37 bool screen_locked_; | |
| 38 | |
| 39 // If set, called when the lock screen has been shown to confirm that the | |
| 40 // system is ready to be suspended. | |
| 41 base::Closure screen_lock_callback_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(SuspendObserver); | |
| 44 }; | |
| 45 | |
| 46 } // namespace internal | |
| 47 } // namespace ash | |
| 48 | |
| 49 #endif // ASH_SYSTEM_CHROMEOS_POWER_SUSPEND_OBSERVER_H_ | |
| OLD | NEW |