| 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; |
| 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 20 matching lines...) Expand all Loading... |
| 59 // Called when power supply polling takes place. |status| is a data | 60 // Called when power supply polling takes place. |status| is a data |
| 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) {} |
| 70 |
| 71 // Called when the system suspends. |
| 72 virtual void DelaySuspend() {} |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 enum UpdateRequestType { | 75 enum UpdateRequestType { |
| 72 UPDATE_INITIAL, // Initial update request. | 76 UPDATE_INITIAL, // Initial update request. |
| 73 UPDATE_USER, // User initialted update request. | 77 UPDATE_USER, // User initialted update request. |
| 74 UPDATE_POLL // Update requested by poll signal. | 78 UPDATE_POLL // Update requested by poll signal. |
| 75 }; | 79 }; |
| 76 | 80 |
| 77 enum PowerStateOverrideType { | 81 enum PowerStateOverrideType { |
| 78 DISABLE_IDLE_DIM = 1 << 0, // Disable screen dimming on idle. | 82 DISABLE_IDLE_DIM = 1 << 0, // Disable screen dimming on idle. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // Create() should be used instead. | 178 // Create() should be used instead. |
| 175 PowerManagerClient(); | 179 PowerManagerClient(); |
| 176 | 180 |
| 177 private: | 181 private: |
| 178 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); | 182 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); |
| 179 }; | 183 }; |
| 180 | 184 |
| 181 } // namespace chromeos | 185 } // namespace chromeos |
| 182 | 186 |
| 183 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 187 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
| OLD | NEW |