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

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

Issue 9265026: Implement restart on Idle for Kiosk Mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge. Created 8 years, 11 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 | Annotate | Revision Log
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 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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 21 matching lines...) Expand all
32 32
33 double battery_percentage; 33 double battery_percentage;
34 34
35 PowerSupplyStatus(); 35 PowerSupplyStatus();
36 std::string ToString() const; 36 std::string ToString() const;
37 }; 37 };
38 38
39 // Callback used for processing the idle time. The int64 param is the number of 39 // Callback used for processing the idle time. The int64 param is the number of
40 // seconds the user has been idle. 40 // seconds the user has been idle.
41 typedef base::Callback<void(int64)> CalculateIdleTimeCallback; 41 typedef base::Callback<void(int64)> CalculateIdleTimeCallback;
42 typedef base::Callback<void(void)> IdleNotificationCallback;
42 43
43 // PowerManagerClient is used to communicate with the power manager. 44 // PowerManagerClient is used to communicate with the power manager.
44 class PowerManagerClient { 45 class PowerManagerClient {
45 public: 46 public:
46 // Interface for observing changes from the power manager. 47 // Interface for observing changes from the power manager.
47 class Observer { 48 class Observer {
48 public: 49 public:
49 virtual ~Observer() {} 50 virtual ~Observer() {}
50 51
51 // Called when the brightness is changed. 52 // Called when the brightness is changed.
(...skipping 17 matching lines...) Expand all
69 const base::TimeTicks& timestamp) {} 70 const base::TimeTicks& timestamp) {}
70 71
71 // Called when the screen is locked. 72 // Called when the screen is locked.
72 virtual void LockScreen() {} 73 virtual void LockScreen() {}
73 74
74 // Called when the screen is unlocked. 75 // Called when the screen is unlocked.
75 virtual void UnlockScreen() {} 76 virtual void UnlockScreen() {}
76 77
77 // Called when the screen fails to unlock. 78 // Called when the screen fails to unlock.
78 virtual void UnlockScreenFailed() {} 79 virtual void UnlockScreenFailed() {}
80
81 // Called when we go idle for threshold time
satorux1 2012/01/26 23:55:44 a period is missing. please add it for consistency
rkc 2012/02/08 02:52:19 Done.
82 virtual void IdleNotify(int64 threshold) {}
satorux1 2012/01/26 23:55:44 what's the unit of |threshold|? if it's seconds, t
rkc 2012/02/08 02:52:19 Done.
83
84 // Called when we go from idle to active
satorux1 2012/01/26 23:55:44 ditto.
rkc 2012/02/08 02:52:19 Done.
85 virtual void ActiveNotify() {}
79 }; 86 };
80 87
81 // Adds and removes the observer. 88 // Adds and removes the observer.
82 virtual void AddObserver(Observer* observer) = 0; 89 virtual void AddObserver(Observer* observer) = 0;
83 virtual void RemoveObserver(Observer* observer) = 0; 90 virtual void RemoveObserver(Observer* observer) = 0;
84 virtual bool HasObserver(Observer* observer) = 0; 91 virtual bool HasObserver(Observer* observer) = 0;
85 92
86 // Decreases the screen brightness. |allow_off| controls whether or not 93 // Decreases the screen brightness. |allow_off| controls whether or not
87 // it's allowed to turn off the back light. 94 // it's allowed to turn off the back light.
88 virtual void DecreaseScreenBrightness(bool allow_off) = 0; 95 virtual void DecreaseScreenBrightness(bool allow_off) = 0;
89 96
90 // Increases the screen brightness. 97 // Increases the screen brightness.
91 virtual void IncreaseScreenBrightness() = 0; 98 virtual void IncreaseScreenBrightness() = 0;
92 99
93 // UI initiated request for power supply status update. 100 // UI initiated request for power supply status update.
94 virtual void RequestStatusUpdate() = 0; 101 virtual void RequestStatusUpdate() = 0;
95 102
96 // Requests restart of the system. 103 // Requests restart of the system.
97 virtual void RequestRestart() = 0; 104 virtual void RequestRestart() = 0;
98 105
99 // Requests shutdown of the system. 106 // Requests shutdown of the system.
100 virtual void RequestShutdown() = 0; 107 virtual void RequestShutdown() = 0;
101 108
102 // Calculates idle time asynchronously, after the idle time request has
103 // replied. It passes the idle time in seconds to |callback|. If it
104 // encounters some error, it passes -1 to |callback|.
105 virtual void CalculateIdleTime(const CalculateIdleTimeCallback& callback) = 0;
106
107 // Notifies PowerManager that a user requested to lock the screen. 109 // Notifies PowerManager that a user requested to lock the screen.
108 virtual void NotifyScreenLockRequested() = 0; 110 virtual void NotifyScreenLockRequested() = 0;
109 111
110 // Notifies PowerManager that screen lock has been completed. 112 // Notifies PowerManager that screen lock has been completed.
111 virtual void NotifyScreenLockCompleted() = 0; 113 virtual void NotifyScreenLockCompleted() = 0;
112 114
113 // Notifies PowerManager that a user unlocked the screen. 115 // Notifies PowerManager that a user unlocked the screen.
114 virtual void NotifyScreenUnlockRequested() = 0; 116 virtual void NotifyScreenUnlockRequested() = 0;
115 117
116 // Notifies PowerManager that screen is unlocked. 118 // Notifies PowerManager that screen is unlocked.
117 virtual void NotifyScreenUnlockCompleted() = 0; 119 virtual void NotifyScreenUnlockCompleted() = 0;
118 120
121 // Idle management function:
122
123 // Calculates idle time asynchronously, after the idle time request has
124 // replied. It passes the idle time in seconds to |callback|. If it
125 // encounters some error, it passes -1 to |callback|.
126 virtual void CalculateIdleTime(const CalculateIdleTimeCallback& callback) = 0;
127
128 // Request notification for Idle at a certain threshold
129 // NOTE: This notification is one shot, once the machine has been idle for
130 // threshold time, a notification will be sent and then that request will be
131 // removed from the notification queue. If you wish notifications the next
132 // time the machine goes idle for that much time, request again.
133 virtual void RequestIdleNotification(int64 threshold) = 0;
satorux1 2012/01/26 23:55:44 ditto. please clarify the unit of |threshold| and
rkc 2012/02/08 02:52:19 Done.
134
135 // Requests that the observers be notified in case of an Idle->Active event.
136 // NOTE: Like the previous request, this will also get triggered exactly once.
137 virtual void RequestActiveNotification() = 0;
138
119 // Creates the instance. 139 // Creates the instance.
120 static PowerManagerClient* Create(dbus::Bus* bus); 140 static PowerManagerClient* Create(dbus::Bus* bus);
121 141
122 virtual ~PowerManagerClient(); 142 virtual ~PowerManagerClient();
123 143
124 protected: 144 protected:
125 // Create() should be used instead. 145 // Create() should be used instead.
126 PowerManagerClient(); 146 PowerManagerClient();
127 147
128 private: 148 private:
129 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); 149 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient);
130 }; 150 };
131 151
132 } // namespace chromeos 152 } // namespace chromeos
133 153
134 #endif // CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ 154 #endif // CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698