Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: chromeos/dbus/power_manager_client.h

Issue 2409983006: Make [S,G]getBacklightsForcedOff dbus API integrated to power_manager_client (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chromeos/chromeos_export.h" 14 #include "chromeos/chromeos_export.h"
15 #include "chromeos/dbus/dbus_client.h" 15 #include "chromeos/dbus/dbus_client.h"
16 #include "chromeos/dbus/dbus_client_implementation_type.h" 16 #include "chromeos/dbus/dbus_client_implementation_type.h"
17 #include "third_party/cros_system_api/dbus/service_constants.h" 17 #include "third_party/cros_system_api/dbus/service_constants.h"
18 18
19 namespace power_manager { 19 namespace power_manager {
20 class PowerManagementPolicy; 20 class PowerManagementPolicy;
21 class PowerSupplyProperties; 21 class PowerSupplyProperties;
22 } 22 }
23 23
24 namespace chromeos { 24 namespace chromeos {
25 25
26 // Callback used for getting the current screen brightness. The param is in the 26 // Callback used for getting the current screen brightness. The param is in the
27 // range [0.0, 100.0]. 27 // range [0.0, 100.0].
28 typedef base::Callback<void(double)> GetScreenBrightnessPercentCallback; 28 typedef base::Callback<void(double)> GetScreenBrightnessPercentCallback;
29 29
30 // Callback used for getting the current backlights forced off state.
31 typedef base::Callback<void(bool)> GetBacklightsForcedOffStateCallback;
32
30 // PowerManagerClient is used to communicate with the power manager. 33 // PowerManagerClient is used to communicate with the power manager.
31 class CHROMEOS_EXPORT PowerManagerClient : public DBusClient { 34 class CHROMEOS_EXPORT PowerManagerClient : public DBusClient {
32 public: 35 public:
33 // Interface for observing changes from the power manager. 36 // Interface for observing changes from the power manager.
34 class Observer { 37 class Observer {
35 public: 38 public:
36 virtual ~Observer() {} 39 virtual ~Observer() {}
37 40
38 // Called if the power manager process restarts. 41 // Called if the power manager process restarts.
39 virtual void PowerManagerRestarted() {} 42 virtual void PowerManagerRestarted() {}
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 180
178 // Tells powerd whether or not we are in a projecting mode. This is used to 181 // Tells powerd whether or not we are in a projecting mode. This is used to
179 // adjust idleness thresholds and derived, on this side, from the number of 182 // adjust idleness thresholds and derived, on this side, from the number of
180 // video outputs attached. 183 // video outputs attached.
181 virtual void SetIsProjecting(bool is_projecting) = 0; 184 virtual void SetIsProjecting(bool is_projecting) = 0;
182 185
183 // Tells powerd to change the power source to the given ID. An empty string 186 // Tells powerd to change the power source to the given ID. An empty string
184 // causes powerd to switch to using the battery on devices with type-C ports. 187 // causes powerd to switch to using the battery on devices with type-C ports.
185 virtual void SetPowerSource(const std::string& id) = 0; 188 virtual void SetPowerSource(const std::string& id) = 0;
186 189
190 // Forces the display and keyboard backlights (if present) to |is_off|.
191 virtual void SetBacklightsForcedOff(bool is_off) = 0;
Daniel Erat 2016/10/13 17:25:19 nit: "forced_off" might be a tiny bit clearer than
Qiang(Joe) Xu 2016/10/13 21:19:41 Done.
192
193 // Gets the display and keyboard backlights (if present) forced off state.
194 virtual void GetBacklightsForcedOffState(
Daniel Erat 2016/10/13 17:25:19 any reason not to call this (and its callback) jus
Qiang(Joe) Xu 2016/10/13 21:19:41 Changed to match dbus method.
195 const GetBacklightsForcedOffStateCallback& callback) = 0;
196
187 // Returns a callback that can be called by an observer to report 197 // Returns a callback that can be called by an observer to report
188 // readiness for suspend. See Observer::SuspendImminent(). 198 // readiness for suspend. See Observer::SuspendImminent().
189 virtual base::Closure GetSuspendReadinessCallback() = 0; 199 virtual base::Closure GetSuspendReadinessCallback() = 0;
190 200
191 // Returns the number of callbacks returned by GetSuspendReadinessCallback() 201 // Returns the number of callbacks returned by GetSuspendReadinessCallback()
192 // for the current suspend attempt but not yet called. Used by tests. 202 // for the current suspend attempt but not yet called. Used by tests.
193 virtual int GetNumPendingSuspendReadinessCallbacks() = 0; 203 virtual int GetNumPendingSuspendReadinessCallbacks() = 0;
194 204
195 // Creates the instance. 205 // Creates the instance.
196 static PowerManagerClient* Create(DBusClientImplementationType type); 206 static PowerManagerClient* Create(DBusClientImplementationType type);
197 207
198 ~PowerManagerClient() override; 208 ~PowerManagerClient() override;
199 209
200 protected: 210 protected:
201 // Needs to call DBusClient::Init(). 211 // Needs to call DBusClient::Init().
202 friend class PowerManagerClientTest; 212 friend class PowerManagerClientTest;
203 213
204 // Create() should be used instead. 214 // Create() should be used instead.
205 PowerManagerClient(); 215 PowerManagerClient();
206 216
207 private: 217 private:
208 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); 218 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient);
209 }; 219 };
210 220
211 } // namespace chromeos 221 } // namespace chromeos
212 222
213 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ 223 #endif // CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698