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 13 matching lines...) Expand all Loading... |
24 | 24 |
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 std::string PowerSupplyStatus::ToString() const { |
35 // TODO(thakis): This looks weird. This should probably not be static, and | 35 std::string result; |
36 // the function should just return a string by value. | |
37 CR_DEFINE_STATIC_LOCAL(std::string, result, ()); | |
38 base::StringAppendF(&result, | 36 base::StringAppendF(&result, |
39 "line_power_on = %s ", | 37 "line_power_on = %s ", |
40 line_power_on ? "true" : "false"); | 38 line_power_on ? "true" : "false"); |
41 base::StringAppendF(&result, | 39 base::StringAppendF(&result, |
42 "battery_is_present = %s ", | 40 "battery_is_present = %s ", |
43 battery_is_present ? "true" : "false"); | 41 battery_is_present ? "true" : "false"); |
44 base::StringAppendF(&result, | 42 base::StringAppendF(&result, |
45 "battery_is_full = %s ", | 43 "battery_is_full = %s ", |
46 battery_is_full ? "true" : "false"); | 44 battery_is_full ? "true" : "false"); |
47 base::StringAppendF(&result, | 45 base::StringAppendF(&result, |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 375 |
378 PowerManagerClient* PowerManagerClient::Create(dbus::Bus* bus) { | 376 PowerManagerClient* PowerManagerClient::Create(dbus::Bus* bus) { |
379 if (system::runtime_environment::IsRunningOnChromeOS()) { | 377 if (system::runtime_environment::IsRunningOnChromeOS()) { |
380 return new PowerManagerClientImpl(bus); | 378 return new PowerManagerClientImpl(bus); |
381 } else { | 379 } else { |
382 return new PowerManagerClientStubImpl(); | 380 return new PowerManagerClientStubImpl(); |
383 } | 381 } |
384 } | 382 } |
385 | 383 |
386 } // namespace chromeos | 384 } // namespace chromeos |
OLD | NEW |