OLD | NEW |
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 // The stub implementation runs the battery up and down, pausing at the | 166 // The stub implementation runs the battery up and down, pausing at the |
167 // fully charged and fully depleted states. | 167 // fully charged and fully depleted states. |
168 class PowerLibraryStubImpl : public PowerLibrary { | 168 class PowerLibraryStubImpl : public PowerLibrary { |
169 public: | 169 public: |
170 PowerLibraryStubImpl() | 170 PowerLibraryStubImpl() |
171 : discharging_(true), | 171 : discharging_(true), |
172 battery_percentage_(20), | 172 battery_percentage_(20), |
173 pause_count_(0) { | 173 pause_count_(0) { |
174 timer_.Start( | 174 timer_.Start( |
| 175 FROM_HERE, |
175 base::TimeDelta::FromMilliseconds(100), | 176 base::TimeDelta::FromMilliseconds(100), |
176 this, | 177 this, |
177 &PowerLibraryStubImpl::Update); | 178 &PowerLibraryStubImpl::Update); |
178 } | 179 } |
179 | 180 |
180 virtual ~PowerLibraryStubImpl() {} | 181 virtual ~PowerLibraryStubImpl() {} |
181 | 182 |
182 // Begin PowerLibrary implementation. | 183 // Begin PowerLibrary implementation. |
183 virtual void Init() OVERRIDE {} | 184 virtual void Init() OVERRIDE {} |
184 virtual void AddObserver(Observer* observer) OVERRIDE { | 185 virtual void AddObserver(Observer* observer) OVERRIDE { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 impl = new PowerLibraryImpl(); | 262 impl = new PowerLibraryImpl(); |
262 impl->Init(); | 263 impl->Init(); |
263 return impl; | 264 return impl; |
264 } | 265 } |
265 | 266 |
266 } // namespace chromeos | 267 } // namespace chromeos |
267 | 268 |
268 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 269 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
269 // won't be deleted until it's last InvokeLater is run. | 270 // won't be deleted until it's last InvokeLater is run. |
270 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::PowerLibraryImpl); | 271 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::PowerLibraryImpl); |
OLD | NEW |