OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/power_monitor/power_monitor_device_source.h" | 5 #include "base/power_monitor/power_monitor_device_source.h" |
6 | 6 |
7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
8 | 8 |
9 namespace base { | 9 namespace base { |
10 | 10 |
11 bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() { | |
Nico
2016/09/27 20:19:27
Is this used by anything on iOS? If not, maybe we
DaleCurtis
2016/09/27 20:53:42
ios_chrome_unittests fails to link without this, b
| |
12 NOTIMPLEMENTED(); | |
13 return false; | |
14 } | |
15 | |
11 void PowerMonitorDeviceSource::PlatformInit() { | 16 void PowerMonitorDeviceSource::PlatformInit() { |
12 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; | 17 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; |
13 id foreground = | 18 id foreground = |
14 [nc addObserverForName:UIApplicationWillEnterForegroundNotification | 19 [nc addObserverForName:UIApplicationWillEnterForegroundNotification |
15 object:nil | 20 object:nil |
16 queue:nil | 21 queue:nil |
17 usingBlock:^(NSNotification* notification) { | 22 usingBlock:^(NSNotification* notification) { |
18 ProcessPowerEvent(RESUME_EVENT); | 23 ProcessPowerEvent(RESUME_EVENT); |
19 }]; | 24 }]; |
20 id background = | 25 id background = |
(...skipping 10 matching lines...) Expand all Loading... | |
31 void PowerMonitorDeviceSource::PlatformDestroy() { | 36 void PowerMonitorDeviceSource::PlatformDestroy() { |
32 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; | 37 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; |
33 for (std::vector<id>::iterator it = notification_observers_.begin(); | 38 for (std::vector<id>::iterator it = notification_observers_.begin(); |
34 it != notification_observers_.end(); ++it) { | 39 it != notification_observers_.end(); ++it) { |
35 [nc removeObserver:*it]; | 40 [nc removeObserver:*it]; |
36 } | 41 } |
37 notification_observers_.clear(); | 42 notification_observers_.clear(); |
38 } | 43 } |
39 | 44 |
40 } // namespace base | 45 } // namespace base |
OLD | NEW |