Index: base/power_state_manager_win.cc |
diff --git a/base/power_state_manager_win.cc b/base/power_state_manager_win.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..882d45aa543f70c7479274915a7e87d73f24ddc0 |
--- /dev/null |
+++ b/base/power_state_manager_win.cc |
@@ -0,0 +1,20 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/power_state_manager.h" |
+ |
+namespace base { |
+ |
+// Function to query the system to see if it is currently running on |
+// battery power. Returns true if running on battery. |
+bool PowerStateManager::IsBatteryPower() { |
+ SYSTEM_POWER_STATUS status; |
+ if (!GetSystemPowerStatus(&status)) { |
+ DLOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError(); |
+ return false; |
+ } |
+ return (status.ACLineStatus == 0); |
+} |
+ |
+} // namespace base |