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 // Implementation based on sample code from | 5 // Implementation based on sample code from |
6 // http://developer.apple.com/library/mac/#qa/qa1340/_index.html. | 6 // http://developer.apple.com/library/mac/#qa/qa1340/_index.html. |
7 | 7 |
8 #include "base/power_monitor/power_monitor_device_source.h" | 8 #include "base/power_monitor/power_monitor_device_source.h" |
9 | 9 |
10 #include "base/power_monitor/power_monitor.h" | 10 #include "base/power_monitor/power_monitor.h" |
11 #include "base/power_monitor/power_monitor_source.h" | 11 #include "base/power_monitor/power_monitor_source.h" |
12 | 12 |
| 13 #include <IOKit/IOMessage.h> |
13 #include <IOKit/pwr_mgt/IOPMLib.h> | 14 #include <IOKit/pwr_mgt/IOPMLib.h> |
14 #include <IOKit/IOMessage.h> | |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 | 17 |
18 void ProcessPowerEventHelper(PowerMonitorSource::PowerEvent event) { | 18 void ProcessPowerEventHelper(PowerMonitorSource::PowerEvent event) { |
19 PowerMonitorSource::ProcessPowerEvent(event); | 19 PowerMonitorSource::ProcessPowerEvent(event); |
20 } | 20 } |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 io_connect_t g_system_power_io_port = 0; | 24 io_connect_t g_system_power_io_port = 0; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // so we close it here. | 98 // so we close it here. |
99 IOServiceClose(g_system_power_io_port); | 99 IOServiceClose(g_system_power_io_port); |
100 | 100 |
101 g_system_power_io_port = 0; | 101 g_system_power_io_port = 0; |
102 | 102 |
103 // Destroy the notification port allocated by IORegisterForSystemPower. | 103 // Destroy the notification port allocated by IORegisterForSystemPower. |
104 IONotificationPortDestroy(g_notification_port_ref); | 104 IONotificationPortDestroy(g_notification_port_ref); |
105 } | 105 } |
106 | 106 |
107 } // namespace base | 107 } // namespace base |
OLD | NEW |