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" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 namespace power_manager { | 22 namespace power_manager { |
23 class PowerManagementPolicy; | 23 class PowerManagementPolicy; |
24 } | 24 } |
25 | 25 |
26 namespace chromeos { | 26 namespace chromeos { |
27 | 27 |
28 // Callback used for processing the idle time. The int64 param is the number of | 28 // Callback used for processing the idle time. The int64 param is the number of |
29 // seconds the user has been idle. | 29 // seconds the user has been idle. |
30 typedef base::Callback<void(int64)> CalculateIdleTimeCallback; | 30 typedef base::Callback<void(int64)> CalculateIdleTimeCallback; |
31 typedef base::Callback<void(void)> IdleNotificationCallback; | 31 typedef base::Callback<void(void)> IdleNotificationCallback; |
32 typedef base::Callback<void(uint32)> PowerStateRequestIdCallback; | 32 typedef base::Callback<void(uint32)> PowerStateRequestIdCallback; |
bartfab (slow)
2013/03/21 14:22:26
No longer used.
Daniel Erat
2013/03/21 14:48:46
Thanks, done.
| |
33 | 33 |
34 // Callback used for getting the current screen brightness. The param is in the | 34 // Callback used for getting the current screen brightness. The param is in the |
35 // range [0.0, 100.0]. | 35 // range [0.0, 100.0]. |
36 typedef base::Callback<void(double)> GetScreenBrightnessPercentCallback; | 36 typedef base::Callback<void(double)> GetScreenBrightnessPercentCallback; |
37 | 37 |
38 // PowerManagerClient is used to communicate with the power manager. | 38 // PowerManagerClient is used to communicate with the power manager. |
39 class CHROMEOS_EXPORT PowerManagerClient { | 39 class CHROMEOS_EXPORT PowerManagerClient { |
40 public: | 40 public: |
41 // Interface for observing changes from the power manager. | 41 // Interface for observing changes from the power manager. |
42 class Observer { | 42 class Observer { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 // before the idle action has been performed. | 102 // before the idle action has been performed. |
103 virtual void IdleActionDeferred() {} | 103 virtual void IdleActionDeferred() {} |
104 }; | 104 }; |
105 | 105 |
106 enum UpdateRequestType { | 106 enum UpdateRequestType { |
107 UPDATE_INITIAL, // Initial update request. | 107 UPDATE_INITIAL, // Initial update request. |
108 UPDATE_USER, // User initialted update request. | 108 UPDATE_USER, // User initialted update request. |
109 UPDATE_POLL // Update requested by poll signal. | 109 UPDATE_POLL // Update requested by poll signal. |
110 }; | 110 }; |
111 | 111 |
112 enum PowerStateOverrideType { | |
113 DISABLE_IDLE_DIM = 1 << 0, // Disable screen dimming on idle. | |
114 DISABLE_IDLE_BLANK = 1 << 1, // Disable screen blanking on idle. | |
115 DISABLE_IDLE_SUSPEND = 1 << 2, // Disable suspend on idle. | |
116 DISABLE_LID_SUSPEND = 1 << 3, // Disable suspend on lid closed. | |
117 }; | |
118 | |
119 // Adds and removes the observer. | 112 // Adds and removes the observer. |
120 virtual void AddObserver(Observer* observer) = 0; | 113 virtual void AddObserver(Observer* observer) = 0; |
121 virtual void RemoveObserver(Observer* observer) = 0; | 114 virtual void RemoveObserver(Observer* observer) = 0; |
122 virtual bool HasObserver(Observer* observer) = 0; | 115 virtual bool HasObserver(Observer* observer) = 0; |
123 | 116 |
124 // Decreases the screen brightness. |allow_off| controls whether or not | 117 // Decreases the screen brightness. |allow_off| controls whether or not |
125 // it's allowed to turn off the back light. | 118 // it's allowed to turn off the back light. |
126 virtual void DecreaseScreenBrightness(bool allow_off) = 0; | 119 virtual void DecreaseScreenBrightness(bool allow_off) = 0; |
127 | 120 |
128 // Increases the screen brightness. | 121 // Increases the screen brightness. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 // Notifies the power manager that a video is currently playing. It also | 167 // Notifies the power manager that a video is currently playing. It also |
175 // includes whether or not the containing window for the video is fullscreen. | 168 // includes whether or not the containing window for the video is fullscreen. |
176 virtual void NotifyVideoActivity( | 169 virtual void NotifyVideoActivity( |
177 const base::TimeTicks& last_activity_time, | 170 const base::TimeTicks& last_activity_time, |
178 bool is_fullscreen) = 0; | 171 bool is_fullscreen) = 0; |
179 | 172 |
180 // Tells the power manager to begin using |policy|. | 173 // Tells the power manager to begin using |policy|. |
181 virtual void SetPolicy( | 174 virtual void SetPolicy( |
182 const power_manager::PowerManagementPolicy& policy) = 0; | 175 const power_manager::PowerManagementPolicy& policy) = 0; |
183 | 176 |
184 // Override the current power state on the machine. The overrides will be | |
185 // applied to the request ID specified. To specify a new request; use 0 as the | |
186 // request id and the method will call the provided callback with the new | |
187 // request ID for use with further calls. |duration| will be rounded down to | |
188 // the nearest second. The overrides parameter will & out the | |
189 // PowerStateOverrideType types to allow specific selection of overrides. For | |
190 // example, to override just dim and suspending but leaving blanking in, set | |
191 // overrides to, DISABLE_IDLE_DIM | DISABLE_IDLE_SUSPEND. | |
192 virtual void RequestPowerStateOverrides( | |
193 uint32 request_id, | |
194 base::TimeDelta duration, | |
195 int overrides, | |
196 const PowerStateRequestIdCallback& callback) = 0; | |
197 | |
198 // Cancels the power state override request specified by request_id. | |
199 virtual void CancelPowerStateOverrides(uint32 request_id) = 0; | |
200 | |
201 // Tells powerd whether or not we are in a projecting mode. This is used to | 177 // Tells powerd whether or not we are in a projecting mode. This is used to |
202 // adjust idleness thresholds and derived, on this side, from the number of | 178 // adjust idleness thresholds and derived, on this side, from the number of |
203 // video outputs attached. | 179 // video outputs attached. |
204 virtual void SetIsProjecting(bool is_projecting) = 0; | 180 virtual void SetIsProjecting(bool is_projecting) = 0; |
205 | 181 |
206 // Returns a callback that can be called by an observer to report | 182 // Returns a callback that can be called by an observer to report |
207 // readiness for suspend. See Observer::SuspendImminent(). | 183 // readiness for suspend. See Observer::SuspendImminent(). |
208 virtual base::Closure GetSuspendReadinessCallback() = 0; | 184 virtual base::Closure GetSuspendReadinessCallback() = 0; |
209 | 185 |
210 // Creates the instance. | 186 // Creates the instance. |
211 static PowerManagerClient* Create(DBusClientImplementationType type, | 187 static PowerManagerClient* Create(DBusClientImplementationType type, |
212 dbus::Bus* bus); | 188 dbus::Bus* bus); |
213 | 189 |
214 virtual ~PowerManagerClient(); | 190 virtual ~PowerManagerClient(); |
215 | 191 |
216 protected: | 192 protected: |
217 // Create() should be used instead. | 193 // Create() should be used instead. |
218 PowerManagerClient(); | 194 PowerManagerClient(); |
219 | 195 |
220 private: | 196 private: |
221 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); | 197 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); |
222 }; | 198 }; |
223 | 199 |
224 } // namespace chromeos | 200 } // namespace chromeos |
225 | 201 |
226 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 202 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
OLD | NEW |