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" |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
14 #include "chromeos/dbus/dbus_client.h" | 15 #include "chromeos/dbus/dbus_client.h" |
15 #include "chromeos/dbus/dbus_client_implementation_type.h" | 16 #include "chromeos/dbus/dbus_client_implementation_type.h" |
16 #include "third_party/cros_system_api/dbus/service_constants.h" | 17 #include "third_party/cros_system_api/dbus/service_constants.h" |
17 | 18 |
18 namespace power_manager { | 19 namespace power_manager { |
19 class PowerManagementPolicy; | 20 class PowerManagementPolicy; |
20 class PowerSupplyProperties; | 21 class PowerSupplyProperties; |
21 } | 22 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Called after IdleActionImminent() when the inactivity timer is reset | 96 // Called after IdleActionImminent() when the inactivity timer is reset |
96 // before the idle action has been performed. | 97 // before the idle action has been performed. |
97 virtual void IdleActionDeferred() {} | 98 virtual void IdleActionDeferred() {} |
98 }; | 99 }; |
99 | 100 |
100 // Adds and removes the observer. | 101 // Adds and removes the observer. |
101 virtual void AddObserver(Observer* observer) = 0; | 102 virtual void AddObserver(Observer* observer) = 0; |
102 virtual void RemoveObserver(Observer* observer) = 0; | 103 virtual void RemoveObserver(Observer* observer) = 0; |
103 virtual bool HasObserver(const Observer* observer) const = 0; | 104 virtual bool HasObserver(const Observer* observer) const = 0; |
104 | 105 |
| 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 |
105 // Decreases the screen brightness. |allow_off| controls whether or not | 127 // Decreases the screen brightness. |allow_off| controls whether or not |
106 // it's allowed to turn off the back light. | 128 // it's allowed to turn off the back light. |
107 virtual void DecreaseScreenBrightness(bool allow_off) = 0; | 129 virtual void DecreaseScreenBrightness(bool allow_off) = 0; |
108 | 130 |
109 // Increases the screen brightness. | 131 // Increases the screen brightness. |
110 virtual void IncreaseScreenBrightness() = 0; | 132 virtual void IncreaseScreenBrightness() = 0; |
111 | 133 |
112 // Set the screen brightness to |percent|, in the range [0.0, 100.0]. | 134 // Set the screen brightness to |percent|, in the range [0.0, 100.0]. |
113 // If |gradual| is true, the transition will be animated. | 135 // If |gradual| is true, the transition will be animated. |
114 virtual void SetScreenBrightnessPercent(double percent, bool gradual) = 0; | 136 virtual void SetScreenBrightnessPercent(double percent, bool gradual) = 0; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // Create() should be used instead. | 193 // Create() should be used instead. |
172 PowerManagerClient(); | 194 PowerManagerClient(); |
173 | 195 |
174 private: | 196 private: |
175 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); | 197 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); |
176 }; | 198 }; |
177 | 199 |
178 } // namespace chromeos | 200 } // namespace chromeos |
179 | 201 |
180 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 202 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
OLD | NEW |