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 #ifndef BASE_POWER_MONITOR_POWER_MONITOR_DEVICE_SOURCE_H_ | 5 #ifndef BASE_POWER_MONITOR_POWER_MONITOR_DEVICE_SOURCE_H_ |
6 #define BASE_POWER_MONITOR_POWER_MONITOR_DEVICE_SOURCE_H_ | 6 #define BASE_POWER_MONITOR_POWER_MONITOR_DEVICE_SOURCE_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // | 44 // |
45 // This function must be called before instantiating an instance of the class | 45 // This function must be called before instantiating an instance of the class |
46 // and before the Sandbox is initialized. | 46 // and before the Sandbox is initialized. |
47 #if !defined(OS_IOS) | 47 #if !defined(OS_IOS) |
48 static void AllocateSystemIOPorts(); | 48 static void AllocateSystemIOPorts(); |
49 #else | 49 #else |
50 static void AllocateSystemIOPorts() {} | 50 static void AllocateSystemIOPorts() {} |
51 #endif // OS_IOS | 51 #endif // OS_IOS |
52 #endif // OS_MACOSX | 52 #endif // OS_MACOSX |
53 | 53 |
| 54 #if defined(OS_CHROMEOS) |
| 55 // On Chrome OS, Chrome receives power-related events from powerd, the system |
| 56 // power daemon, via D-Bus signals received on the UI thread. base can't |
| 57 // directly depend on that code, so this class instead exposes static methods |
| 58 // so that events can be passed in. |
| 59 static void SetPowerSource(bool on_battery); |
| 60 static void HandleSystemSuspending(); |
| 61 static void HandleSystemResumed(); |
| 62 #endif |
| 63 |
54 private: | 64 private: |
55 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
56 // Represents a message-only window for power message handling on Windows. | 66 // Represents a message-only window for power message handling on Windows. |
57 // Only allow PowerMonitor to create it. | 67 // Only allow PowerMonitor to create it. |
58 class PowerMessageWindow { | 68 class PowerMessageWindow { |
59 public: | 69 public: |
60 PowerMessageWindow(); | 70 PowerMessageWindow(); |
61 ~PowerMessageWindow(); | 71 ~PowerMessageWindow(); |
62 | 72 |
63 private: | 73 private: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 #if defined(OS_WIN) | 108 #if defined(OS_WIN) |
99 PowerMessageWindow power_message_window_; | 109 PowerMessageWindow power_message_window_; |
100 #endif | 110 #endif |
101 | 111 |
102 DISALLOW_COPY_AND_ASSIGN(PowerMonitorDeviceSource); | 112 DISALLOW_COPY_AND_ASSIGN(PowerMonitorDeviceSource); |
103 }; | 113 }; |
104 | 114 |
105 } // namespace base | 115 } // namespace base |
106 | 116 |
107 #endif // BASE_POWER_MONITOR_POWER_MONITOR_DEVICE_SOURCE_H_ | 117 #endif // BASE_POWER_MONITOR_POWER_MONITOR_DEVICE_SOURCE_H_ |
OLD | NEW |