OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/dbus/power_manager_client.h" | 5 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 PowerSupplyStatus::PowerSupplyStatus() | 25 PowerSupplyStatus::PowerSupplyStatus() |
26 : line_power_on(false), | 26 : line_power_on(false), |
27 battery_is_present(false), | 27 battery_is_present(false), |
28 battery_is_full(false), | 28 battery_is_full(false), |
29 battery_seconds_to_empty(0), | 29 battery_seconds_to_empty(0), |
30 battery_seconds_to_full(0), | 30 battery_seconds_to_full(0), |
31 battery_percentage(0) { | 31 battery_percentage(0) { |
32 } | 32 } |
33 | 33 |
34 const std::string& PowerSupplyStatus::ToString() const { | 34 const std::string& PowerSupplyStatus::ToString() const { |
35 static std::string result = ""; | 35 // TODO(thakis): This looks weird. This should probably not be static, and |
| 36 // the function should just return a string by value. |
| 37 CR_DEFINE_STATIC_LOCAL(std::string, result, ()); |
36 base::StringAppendF(&result, | 38 base::StringAppendF(&result, |
37 "line_power_on = %s ", | 39 "line_power_on = %s ", |
38 line_power_on ? "true" : "false"); | 40 line_power_on ? "true" : "false"); |
39 base::StringAppendF(&result, | 41 base::StringAppendF(&result, |
40 "battery_is_present = %s ", | 42 "battery_is_present = %s ", |
41 battery_is_present ? "true" : "false"); | 43 battery_is_present ? "true" : "false"); |
42 base::StringAppendF(&result, | 44 base::StringAppendF(&result, |
43 "battery_is_full = %s ", | 45 "battery_is_full = %s ", |
44 battery_is_full ? "true" : "false"); | 46 battery_is_full ? "true" : "false"); |
45 base::StringAppendF(&result, | 47 base::StringAppendF(&result, |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 377 |
376 PowerManagerClient* PowerManagerClient::Create(dbus::Bus* bus) { | 378 PowerManagerClient* PowerManagerClient::Create(dbus::Bus* bus) { |
377 if (system::runtime_environment::IsRunningOnChromeOS()) { | 379 if (system::runtime_environment::IsRunningOnChromeOS()) { |
378 return new PowerManagerClientImpl(bus); | 380 return new PowerManagerClientImpl(bus); |
379 } else { | 381 } else { |
380 return new PowerManagerClientStubImpl(); | 382 return new PowerManagerClientStubImpl(); |
381 } | 383 } |
382 } | 384 } |
383 | 385 |
384 } // namespace chromeos | 386 } // namespace chromeos |
OLD | NEW |