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. | |
Daniel Erat
2014/11/19 23:41:26
mind also documenting how this interacts with dark
Chirantan Ekbote
2014/11/20 00:59:37
Done.
| |
113 virtual void SuspendImminent() = 0; | |
114 | |
115 // Called when a previously announced suspend attempt has completed. This | |
116 // method is called before observers are notified that the suspend has | |
117 // completed. | |
118 virtual void SuspendDone() = 0; | |
119 }; | |
120 | |
121 // Sets the PowerManagerClient's RenderProcessManagerDelegate. There can only | |
122 // be one delegate. | |
123 virtual void SetRenderProcessManagerDelegate( | |
124 base::WeakPtr<RenderProcessManagerDelegate> delegate) = 0; | |
125 | |
105 // Decreases the screen brightness. |allow_off| controls whether or not | 126 // Decreases the screen brightness. |allow_off| controls whether or not |
106 // it's allowed to turn off the back light. | 127 // it's allowed to turn off the back light. |
107 virtual void DecreaseScreenBrightness(bool allow_off) = 0; | 128 virtual void DecreaseScreenBrightness(bool allow_off) = 0; |
108 | 129 |
109 // Increases the screen brightness. | 130 // Increases the screen brightness. |
110 virtual void IncreaseScreenBrightness() = 0; | 131 virtual void IncreaseScreenBrightness() = 0; |
111 | 132 |
112 // Set the screen brightness to |percent|, in the range [0.0, 100.0]. | 133 // Set the screen brightness to |percent|, in the range [0.0, 100.0]. |
113 // If |gradual| is true, the transition will be animated. | 134 // If |gradual| is true, the transition will be animated. |
114 virtual void SetScreenBrightnessPercent(double percent, bool gradual) = 0; | 135 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. | 192 // Create() should be used instead. |
172 PowerManagerClient(); | 193 PowerManagerClient(); |
173 | 194 |
174 private: | 195 private: |
175 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); | 196 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); |
176 }; | 197 }; |
177 | 198 |
178 } // namespace chromeos | 199 } // namespace chromeos |
179 | 200 |
180 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 201 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
OLD | NEW |