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

Side by Side Diff: chrome/browser/chromeos/cros/power_library.cc

Issue 8263003: cros: PowerLibrary virtual functions should be named using CamelCase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser_tests Created 9 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 | Annotate | Revision Log
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 #include "chrome/browser/chromeos/cros/power_library.h" 5 #include "chrome/browser/chromeos/cros/power_library.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 virtual void AddObserver(Observer* observer) OVERRIDE { 48 virtual void AddObserver(Observer* observer) OVERRIDE {
49 observers_.AddObserver(observer); 49 observers_.AddObserver(observer);
50 } 50 }
51 51
52 virtual void RemoveObserver(Observer* observer) OVERRIDE { 52 virtual void RemoveObserver(Observer* observer) OVERRIDE {
53 observers_.RemoveObserver(observer); 53 observers_.RemoveObserver(observer);
54 } 54 }
55 55
56 virtual bool line_power_on() const OVERRIDE { 56 virtual bool IsLinePowerOn() const OVERRIDE {
57 return status_.line_power_on; 57 return status_.line_power_on;
58 } 58 }
59 59
60 virtual bool battery_fully_charged() const OVERRIDE { 60 virtual bool IsBatteryFullyCharged() const OVERRIDE {
61 return status_.battery_state == chromeos::BATTERY_STATE_FULLY_CHARGED; 61 return status_.battery_state == chromeos::BATTERY_STATE_FULLY_CHARGED;
62 } 62 }
63 63
64 virtual double battery_percentage() const OVERRIDE { 64 virtual double GetBatteryPercentage() const OVERRIDE {
65 return status_.battery_percentage; 65 return status_.battery_percentage;
66 } 66 }
67 67
68 virtual bool battery_is_present() const OVERRIDE { 68 virtual bool IsBatteryPresent() const OVERRIDE {
69 return status_.battery_is_present; 69 return status_.battery_is_present;
70 } 70 }
71 71
72 virtual base::TimeDelta battery_time_to_empty() const OVERRIDE { 72 virtual base::TimeDelta GetBatteryTimeToEmpty() const OVERRIDE {
73 return base::TimeDelta::FromSeconds(status_.battery_time_to_empty); 73 return base::TimeDelta::FromSeconds(status_.battery_time_to_empty);
74 } 74 }
75 75
76 virtual base::TimeDelta battery_time_to_full() const OVERRIDE { 76 virtual base::TimeDelta GetBatteryTimeToFull() const OVERRIDE {
77 return base::TimeDelta::FromSeconds(status_.battery_time_to_full); 77 return base::TimeDelta::FromSeconds(status_.battery_time_to_full);
78 } 78 }
79 79
80 virtual void CalculateIdleTime(CalculateIdleTimeCallback* callback) OVERRIDE { 80 virtual void CalculateIdleTime(CalculateIdleTimeCallback* callback) OVERRIDE {
81 // TODO(sidor): Examine if it's really a good idea to use void* as a second 81 // TODO(sidor): Examine if it's really a good idea to use void* as a second
82 // argument. 82 // argument.
83 chromeos::GetIdleTime(&GetIdleTimeCallback, callback); 83 chromeos::GetIdleTime(&GetIdleTimeCallback, callback);
84 } 84 }
85 85
86 virtual void EnableScreenLock(bool enable) OVERRIDE { 86 virtual void EnableScreenLock(bool enable) OVERRIDE {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Begin PowerLibrary implementation. 200 // Begin PowerLibrary implementation.
201 virtual void Init() OVERRIDE {} 201 virtual void Init() OVERRIDE {}
202 virtual void AddObserver(Observer* observer) OVERRIDE { 202 virtual void AddObserver(Observer* observer) OVERRIDE {
203 observers_.AddObserver(observer); 203 observers_.AddObserver(observer);
204 } 204 }
205 205
206 virtual void RemoveObserver(Observer* observer) OVERRIDE { 206 virtual void RemoveObserver(Observer* observer) OVERRIDE {
207 observers_.RemoveObserver(observer); 207 observers_.RemoveObserver(observer);
208 } 208 }
209 209
210 virtual bool line_power_on() const OVERRIDE { 210 virtual bool IsLinePowerOn() const OVERRIDE {
211 return !discharging_; 211 return !discharging_;
212 } 212 }
213 213
214 virtual bool battery_fully_charged() const OVERRIDE { 214 virtual bool IsBatteryFullyCharged() const OVERRIDE {
215 return battery_percentage_ == 100; 215 return battery_percentage_ == 100;
216 } 216 }
217 217
218 virtual double battery_percentage() const OVERRIDE { 218 virtual double GetBatteryPercentage() const OVERRIDE {
219 return battery_percentage_; 219 return battery_percentage_;
220 } 220 }
221 221
222 virtual bool battery_is_present() const OVERRIDE { 222 virtual bool IsBatteryPresent() const OVERRIDE {
223 return true; 223 return true;
224 } 224 }
225 225
226 virtual base::TimeDelta battery_time_to_empty() const OVERRIDE { 226 virtual base::TimeDelta GetBatteryTimeToEmpty() const OVERRIDE {
227 if (battery_percentage_ == 0) 227 if (battery_percentage_ == 0)
228 return base::TimeDelta::FromSeconds(1); 228 return base::TimeDelta::FromSeconds(1);
229 else 229 else
230 return (base::TimeDelta::FromHours(3) * battery_percentage_) / 100; 230 return (base::TimeDelta::FromHours(3) * battery_percentage_) / 100;
231 } 231 }
232 232
233 virtual base::TimeDelta battery_time_to_full() const OVERRIDE { 233 virtual base::TimeDelta GetBatteryTimeToFull() const OVERRIDE {
234 if (battery_percentage_ == 100) 234 if (battery_percentage_ == 100)
235 return base::TimeDelta::FromSeconds(1); 235 return base::TimeDelta::FromSeconds(1);
236 else 236 else
237 return base::TimeDelta::FromHours(3) - battery_time_to_empty(); 237 return base::TimeDelta::FromHours(3) - GetBatteryTimeToEmpty();
238 } 238 }
239 239
240 virtual void CalculateIdleTime(CalculateIdleTimeCallback* callback) OVERRIDE { 240 virtual void CalculateIdleTime(CalculateIdleTimeCallback* callback) OVERRIDE {
241 callback->Run(0); 241 callback->Run(0);
242 delete callback; 242 delete callback;
243 } 243 }
244 244
245 virtual void EnableScreenLock(bool enable) OVERRIDE {} 245 virtual void EnableScreenLock(bool enable) OVERRIDE {}
246 246
247 virtual void RequestRestart() OVERRIDE {} 247 virtual void RequestRestart() OVERRIDE {}
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 impl = new PowerLibraryImpl(); 299 impl = new PowerLibraryImpl();
300 impl->Init(); 300 impl->Init();
301 return impl; 301 return impl;
302 } 302 }
303 303
304 } // namespace chromeos 304 } // namespace chromeos
305 305
306 // Allows InvokeLater without adding refcounting. This class is a Singleton and 306 // Allows InvokeLater without adding refcounting. This class is a Singleton and
307 // won't be deleted until it's last InvokeLater is run. 307 // won't be deleted until it's last InvokeLater is run.
308 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::PowerLibraryImpl); 308 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::PowerLibraryImpl);
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/power_library.h ('k') | chrome/browser/chromeos/low_battery_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698