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

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

Issue 8566024: chromeos: call GetIdleTime from power manager client (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_
6 #define CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ 6 #define CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_
7 7
8 #include "base/callback.h"
8 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
9 #include "base/observer_list.h" 10 #include "base/observer_list.h"
10 11
11 #include <string> 12 #include <string>
12 13
13 namespace dbus { 14 namespace dbus {
14 class Bus; 15 class Bus;
15 class ObjectProxy; 16 class ObjectProxy;
16 class Response; 17 class Response;
17 class Signal; 18 class Signal;
(...skipping 11 matching lines...) Expand all
29 // Time in seconds until the battery is empty or full, 0 for unknown. 30 // Time in seconds until the battery is empty or full, 0 for unknown.
30 int64 battery_seconds_to_empty; 31 int64 battery_seconds_to_empty;
31 int64 battery_seconds_to_full; 32 int64 battery_seconds_to_full;
32 33
33 double battery_percentage; 34 double battery_percentage;
34 35
35 PowerSupplyStatus(); 36 PowerSupplyStatus();
36 const std::string& ToString() const; 37 const std::string& ToString() const;
37 }; 38 };
38 39
40 typedef base::Callback<void(int64_t)> CalculateIdleTimeCallback;
satorux1 2011/11/15 00:57:42 Please add some comment about the parameter: int64
Simon Que 2011/11/15 01:29:38 Done.
41
39 // PowerManagerClient is used to communicate with the power manager. 42 // PowerManagerClient is used to communicate with the power manager.
40 class PowerManagerClient { 43 class PowerManagerClient {
41 public: 44 public:
42 // Interface for observing changes from the power manager. 45 // Interface for observing changes from the power manager.
43 class Observer { 46 class Observer {
44 public: 47 public:
45 // Called when the brightness is changed. 48 // Called when the brightness is changed.
46 // |level| is of the range [0, 100]. 49 // |level| is of the range [0, 100].
47 // |user_initiated| is true if the action is initiated by the user. 50 // |user_initiated| is true if the action is initiated by the user.
48 virtual void BrightnessChanged(int level, bool user_initiated) {} 51 virtual void BrightnessChanged(int level, bool user_initiated) {}
(...skipping 16 matching lines...) Expand all
65 68
66 // UI initiated request for power supply status update. 69 // UI initiated request for power supply status update.
67 virtual void RequestStatusUpdate() = 0; 70 virtual void RequestStatusUpdate() = 0;
68 71
69 // Requests restart of the system. 72 // Requests restart of the system.
70 virtual void RequestRestart() = 0; 73 virtual void RequestRestart() = 0;
71 74
72 // Requests shutdown of the system. 75 // Requests shutdown of the system.
73 virtual void RequestShutdown() = 0; 76 virtual void RequestShutdown() = 0;
74 77
78 // Calculates idle time asynchronously. If it encounters some error,
79 // it returns -1.
satorux1 2011/11/15 00:57:42 The comment is misleading. It's a void function. Y
Simon Que 2011/11/15 01:29:38 Done.
80 virtual void CalculateIdleTime(CalculateIdleTimeCallback* callback) = 0;
satorux1 2011/11/15 00:57:42 This shouldn't have to be a pointer. Please remove
Simon Que 2011/11/15 01:29:38 Done.
81
75 // Creates the instance. 82 // Creates the instance.
76 static PowerManagerClient* Create(dbus::Bus* bus); 83 static PowerManagerClient* Create(dbus::Bus* bus);
77 84
78 virtual ~PowerManagerClient(); 85 virtual ~PowerManagerClient();
79 86
80 protected: 87 protected:
81 // Create() should be used instead. 88 // Create() should be used instead.
82 PowerManagerClient(); 89 PowerManagerClient();
83 90
84 private: 91 private:
85 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); 92 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient);
86 }; 93 };
87 94
88 } // namespace chromeos 95 } // namespace chromeos
89 96
90 #endif // CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ 97 #endif // CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698