Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 6 #define CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "chromeos/chromeos_export.h" | 13 #include "chromeos/chromeos_export.h" |
| 14 #include "chromeos/dbus/dbus_client_implementation_type.h" | 14 #include "chromeos/dbus/dbus_client_implementation_type.h" |
| 15 | 15 |
| 16 #include "chromeos/dbus/power_supply_status.h" | 16 #include "chromeos/dbus/power_supply_status.h" |
| 17 | 17 |
| 18 namespace dbus { | 18 namespace dbus { |
| 19 class Bus; | 19 class Bus; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace chromeos { | 22 namespace chromeos { |
| 23 | 23 |
| 24 // Callback used for processing the idle time. The int64 param is the number of | 24 // Callback used for processing the idle time. The int64 param is the number of |
| 25 // seconds the user has been idle. | 25 // seconds the user has been idle. |
| 26 typedef base::Callback<void(int64)> CalculateIdleTimeCallback; | 26 typedef base::Callback<void(int64)> CalculateIdleTimeCallback; |
| 27 typedef base::Callback<void(void)> IdleNotificationCallback; | 27 typedef base::Callback<void(void)> IdleNotificationCallback; |
| 28 typedef base::Callback<void(uint32)> PowerStateRequestIdCallback; | 28 typedef base::Callback<void(uint32)> PowerStateRequestIdCallback; |
| 29 typedef base::Callback<void(void)> SuspendImminentCallback; | |
|
Daniel Erat
2013/01/08 00:51:35
nit: you don't need this, do you?
marcheu
2013/01/10 01:03:49
Removed.
| |
| 29 | 30 |
| 30 // Callback used for getting the current screen brightness. The param is in the | 31 // Callback used for getting the current screen brightness. The param is in the |
| 31 // range [0.0, 100.0]. | 32 // range [0.0, 100.0]. |
| 32 typedef base::Callback<void(double)> GetScreenBrightnessPercentCallback; | 33 typedef base::Callback<void(double)> GetScreenBrightnessPercentCallback; |
| 33 | 34 |
| 34 // PowerManagerClient is used to communicate with the power manager. | 35 // PowerManagerClient is used to communicate with the power manager. |
| 35 class CHROMEOS_EXPORT PowerManagerClient { | 36 class CHROMEOS_EXPORT PowerManagerClient { |
| 36 public: | 37 public: |
| 37 // Interface for observing changes from the power manager. | 38 // Interface for observing changes from the power manager. |
| 38 class Observer { | 39 class Observer { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 60 // structure that contains the current state of the power supply. | 61 // structure that contains the current state of the power supply. |
| 61 virtual void PowerChanged(const PowerSupplyStatus& status) {} | 62 virtual void PowerChanged(const PowerSupplyStatus& status) {} |
| 62 | 63 |
| 63 // Called when we go idle for threshold time. | 64 // Called when we go idle for threshold time. |
| 64 virtual void IdleNotify(int64 threshold_secs) {} | 65 virtual void IdleNotify(int64 threshold_secs) {} |
| 65 | 66 |
| 66 // Called when a request is received to dim or undim the screen in software | 67 // Called when a request is received to dim or undim the screen in software |
| 67 // (as opposed to the more-common method of adjusting the backlight). | 68 // (as opposed to the more-common method of adjusting the backlight). |
| 68 virtual void ScreenDimmingRequested(ScreenDimmingState state) {} | 69 virtual void ScreenDimmingRequested(ScreenDimmingState state) {} |
| 69 | 70 |
| 71 // Called when the system suspends. | |
|
Daniel Erat
2013/01/08 00:51:35
nit: i'd add a bit more details about this:
// Ca
marcheu
2013/01/10 01:03:49
Done.
| |
| 72 virtual void SuspendImminent() {} | |
| 73 | |
| 70 // Called when the power button is pressed or released. | 74 // Called when the power button is pressed or released. |
| 71 // Note: Implement both this method and | 75 // Note: Implement both this method and |
| 72 // RootPowerManagerObserver::OnPowerButtonEvent() until this has been moved | 76 // RootPowerManagerObserver::OnPowerButtonEvent() until this has been moved |
| 73 // to powerd: http://crosbug.com/36804 | 77 // to powerd: http://crosbug.com/36804 |
| 74 virtual void PowerButtonEventReceived(bool down, | 78 virtual void PowerButtonEventReceived(bool down, |
| 75 const base::TimeTicks& timestamp) {} | 79 const base::TimeTicks& timestamp) {} |
| 76 | 80 |
| 77 // Called when the device's lid is opened or closed. | 81 // Called when the device's lid is opened or closed. |
| 78 // Note: Implement both this method and | 82 // Note: Implement both this method and |
| 79 // RootPowerManagerObserver::OnLidEvent() until this has been moved | 83 // RootPowerManagerObserver::OnLidEvent() until this has been moved |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 // Create() should be used instead. | 198 // Create() should be used instead. |
| 195 PowerManagerClient(); | 199 PowerManagerClient(); |
| 196 | 200 |
| 197 private: | 201 private: |
| 198 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); | 202 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); |
| 199 }; | 203 }; |
| 200 | 204 |
| 201 } // namespace chromeos | 205 } // namespace chromeos |
| 202 | 206 |
| 203 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 207 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
| OLD | NEW |