OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/battery_status/battery_status_manager.h" | 5 #include "content/browser/battery_status/battery_status_manager.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 #include <IOKit/ps/IOPowerSources.h> | 8 #include <IOKit/ps/IOPowerSources.h> |
9 #include <IOKit/ps/IOPSKeys.h> | 9 #include <IOKit/ps/IOPSKeys.h> |
10 #include <vector> | 10 #include <vector> |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 class BatteryStatusManagerMac : public BatteryStatusManager { | 252 class BatteryStatusManagerMac : public BatteryStatusManager { |
253 public: | 253 public: |
254 explicit BatteryStatusManagerMac(const BatteryCallback& callback) | 254 explicit BatteryStatusManagerMac(const BatteryCallback& callback) |
255 : notifier_(new BatteryStatusObserver(callback)) {} | 255 : notifier_(new BatteryStatusObserver(callback)) {} |
256 | 256 |
257 virtual ~BatteryStatusManagerMac() { | 257 virtual ~BatteryStatusManagerMac() { |
258 notifier_->Stop(); | 258 notifier_->Stop(); |
259 } | 259 } |
260 | 260 |
261 // BatteryStatusManager: | 261 // BatteryStatusManager: |
262 virtual bool StartListeningBatteryChange() OVERRIDE { | 262 virtual bool StartListeningBatteryChange() override { |
263 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 263 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
264 notifier_->Start(); | 264 notifier_->Start(); |
265 return true; | 265 return true; |
266 } | 266 } |
267 | 267 |
268 virtual void StopListeningBatteryChange() OVERRIDE { | 268 virtual void StopListeningBatteryChange() override { |
269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
270 notifier_->Stop(); | 270 notifier_->Stop(); |
271 } | 271 } |
272 | 272 |
273 private: | 273 private: |
274 scoped_refptr<BatteryStatusObserver> notifier_; | 274 scoped_refptr<BatteryStatusObserver> notifier_; |
275 | 275 |
276 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerMac); | 276 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerMac); |
277 }; | 277 }; |
278 | 278 |
279 } // end namespace | 279 } // end namespace |
280 | 280 |
281 // static | 281 // static |
282 scoped_ptr<BatteryStatusManager> BatteryStatusManager::Create( | 282 scoped_ptr<BatteryStatusManager> BatteryStatusManager::Create( |
283 const BatteryStatusService::BatteryUpdateCallback& callback) { | 283 const BatteryStatusService::BatteryUpdateCallback& callback) { |
284 return scoped_ptr<BatteryStatusManager>( | 284 return scoped_ptr<BatteryStatusManager>( |
285 new BatteryStatusManagerMac(callback)); | 285 new BatteryStatusManagerMac(callback)); |
286 } | 286 } |
287 | 287 |
288 } // namespace content | 288 } // namespace content |
OLD | NEW |