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, | |
176 base::TimeDelta::FromMilliseconds(100), | 175 base::TimeDelta::FromMilliseconds(100), |
177 this, | 176 this, |
178 &PowerLibraryStubImpl::Update); | 177 &PowerLibraryStubImpl::Update); |
179 } | 178 } |
180 | 179 |
181 virtual ~PowerLibraryStubImpl() {} | 180 virtual ~PowerLibraryStubImpl() {} |
182 | 181 |
183 // Begin PowerLibrary implementation. | 182 // Begin PowerLibrary implementation. |
184 virtual void Init() OVERRIDE {} | 183 virtual void Init() OVERRIDE {} |
185 virtual void AddObserver(Observer* observer) OVERRIDE { | 184 virtual void AddObserver(Observer* observer) OVERRIDE { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 impl = new PowerLibraryImpl(); | 261 impl = new PowerLibraryImpl(); |
263 impl->Init(); | 262 impl->Init(); |
264 return impl; | 263 return impl; |
265 } | 264 } |
266 | 265 |
267 } // namespace chromeos | 266 } // namespace chromeos |
268 | 267 |
269 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 268 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
270 // won't be deleted until it's last InvokeLater is run. | 269 // won't be deleted until it's last InvokeLater is run. |
271 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::PowerLibraryImpl); | 270 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::PowerLibraryImpl); |
OLD | NEW |