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/memory/weak_ptr.h" | |
13 #include "base/time/time.h" | 12 #include "base/time/time.h" |
14 #include "chromeos/chromeos_export.h" | 13 #include "chromeos/chromeos_export.h" |
15 #include "chromeos/dbus/dbus_client.h" | 14 #include "chromeos/dbus/dbus_client.h" |
16 #include "chromeos/dbus/dbus_client_implementation_type.h" | 15 #include "chromeos/dbus/dbus_client_implementation_type.h" |
17 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
18 | 17 |
19 namespace power_manager { | 18 namespace power_manager { |
20 class PowerManagementPolicy; | 19 class PowerManagementPolicy; |
21 class PowerSupplyProperties; | 20 class PowerSupplyProperties; |
22 } | 21 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Called after IdleActionImminent() when the inactivity timer is reset | 95 // Called after IdleActionImminent() when the inactivity timer is reset |
97 // before the idle action has been performed. | 96 // before the idle action has been performed. |
98 virtual void IdleActionDeferred() {} | 97 virtual void IdleActionDeferred() {} |
99 }; | 98 }; |
100 | 99 |
101 // Adds and removes the observer. | 100 // Adds and removes the observer. |
102 virtual void AddObserver(Observer* observer) = 0; | 101 virtual void AddObserver(Observer* observer) = 0; |
103 virtual void RemoveObserver(Observer* observer) = 0; | 102 virtual void RemoveObserver(Observer* observer) = 0; |
104 virtual bool HasObserver(const Observer* observer) const = 0; | 103 virtual bool HasObserver(const Observer* observer) const = 0; |
105 | 104 |
106 // Interface for managing the power consumption of renderer processes. | |
107 class RenderProcessManagerDelegate { | |
108 public: | |
109 virtual ~RenderProcessManagerDelegate() {} | |
110 | |
111 // Called when a suspend attempt is imminent but after all registered | |
112 // observers have reported readiness to suspend. This is only called for | |
113 // suspends from the fully powered on state and not for suspends from dark | |
114 // resume. | |
115 virtual void SuspendImminent() = 0; | |
116 | |
117 // Called when a previously announced suspend attempt has completed but | |
118 // before observers are notified about it. | |
119 virtual void SuspendDone() = 0; | |
120 }; | |
121 | |
122 // Sets the PowerManagerClient's RenderProcessManagerDelegate. There can only | |
123 // be one delegate. | |
124 virtual void SetRenderProcessManagerDelegate( | |
125 base::WeakPtr<RenderProcessManagerDelegate> delegate) = 0; | |
126 | |
127 // Decreases the screen brightness. |allow_off| controls whether or not | 105 // Decreases the screen brightness. |allow_off| controls whether or not |
128 // it's allowed to turn off the back light. | 106 // it's allowed to turn off the back light. |
129 virtual void DecreaseScreenBrightness(bool allow_off) = 0; | 107 virtual void DecreaseScreenBrightness(bool allow_off) = 0; |
130 | 108 |
131 // Increases the screen brightness. | 109 // Increases the screen brightness. |
132 virtual void IncreaseScreenBrightness() = 0; | 110 virtual void IncreaseScreenBrightness() = 0; |
133 | 111 |
134 // Set the screen brightness to |percent|, in the range [0.0, 100.0]. | 112 // Set the screen brightness to |percent|, in the range [0.0, 100.0]. |
135 // If |gradual| is true, the transition will be animated. | 113 // If |gradual| is true, the transition will be animated. |
136 virtual void SetScreenBrightnessPercent(double percent, bool gradual) = 0; | 114 virtual void SetScreenBrightnessPercent(double percent, bool gradual) = 0; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // Create() should be used instead. | 171 // Create() should be used instead. |
194 PowerManagerClient(); | 172 PowerManagerClient(); |
195 | 173 |
196 private: | 174 private: |
197 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); | 175 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); |
198 }; | 176 }; |
199 | 177 |
200 } // namespace chromeos | 178 } // namespace chromeos |
201 | 179 |
202 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 180 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
OLD | NEW |