Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: chrome/browser/chromeos/dbus/power_manager_client.cc

Issue 9562008: ash uber tray: Add entry for power and date. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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"
11 #include "base/format_macros.h" 11 #include "base/format_macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "base/timer.h" 16 #include "base/timer.h"
17 #include "chrome/browser/chromeos/login/screen_locker.h" 17 #include "chrome/browser/chromeos/login/screen_locker.h"
18 #include "chrome/browser/chromeos/system/runtime_environment.h" 18 #include "chrome/browser/chromeos/system/runtime_environment.h"
19 #include "dbus/bus.h" 19 #include "dbus/bus.h"
20 #include "dbus/message.h" 20 #include "dbus/message.h"
21 #include "dbus/object_path.h" 21 #include "dbus/object_path.h"
22 #include "dbus/object_proxy.h" 22 #include "dbus/object_proxy.h"
23 #include "third_party/cros_system_api/dbus/service_constants.h" 23 #include "third_party/cros_system_api/dbus/service_constants.h"
24 24
25 namespace chromeos { 25 namespace chromeos {
26 26
27 #if !defined(USE_ASH)
27 PowerSupplyStatus::PowerSupplyStatus() 28 PowerSupplyStatus::PowerSupplyStatus()
28 : line_power_on(false), 29 : line_power_on(false),
29 battery_is_present(false), 30 battery_is_present(false),
30 battery_is_full(false), 31 battery_is_full(false),
31 battery_seconds_to_empty(0), 32 battery_seconds_to_empty(0),
32 battery_seconds_to_full(0), 33 battery_seconds_to_full(0),
33 battery_percentage(0) { 34 battery_percentage(0) {
34 } 35 }
35 36
36 std::string PowerSupplyStatus::ToString() const { 37 std::string PowerSupplyStatus::ToString() const {
(...skipping 11 matching lines...) Expand all
48 "battery_percentage = %f ", 49 "battery_percentage = %f ",
49 battery_percentage); 50 battery_percentage);
50 base::StringAppendF(&result, 51 base::StringAppendF(&result,
51 "battery_seconds_to_empty = %"PRId64" ", 52 "battery_seconds_to_empty = %"PRId64" ",
52 battery_seconds_to_empty); 53 battery_seconds_to_empty);
53 base::StringAppendF(&result, 54 base::StringAppendF(&result,
54 "battery_seconds_to_full = %"PRId64" ", 55 "battery_seconds_to_full = %"PRId64" ",
55 battery_seconds_to_full); 56 battery_seconds_to_full);
56 return result; 57 return result;
57 } 58 }
59 #endif // !defined(USE_ASH)
58 60
59 // The PowerManagerClient implementation used in production. 61 // The PowerManagerClient implementation used in production.
60 class PowerManagerClientImpl : public PowerManagerClient { 62 class PowerManagerClientImpl : public PowerManagerClient {
61 public: 63 public:
62 explicit PowerManagerClientImpl(dbus::Bus* bus) 64 explicit PowerManagerClientImpl(dbus::Bus* bus)
63 : power_manager_proxy_(NULL), 65 : power_manager_proxy_(NULL),
64 weak_ptr_factory_(this) { 66 weak_ptr_factory_(this) {
65 power_manager_proxy_ = bus->GetObjectProxy( 67 power_manager_proxy_ = bus->GetObjectProxy(
66 power_manager::kPowerManagerServiceName, 68 power_manager::kPowerManagerServiceName,
67 dbus::ObjectPath(power_manager::kPowerManagerServicePath)); 69 dbus::ObjectPath(power_manager::kPowerManagerServicePath));
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 536
535 PowerManagerClient* PowerManagerClient::Create(dbus::Bus* bus) { 537 PowerManagerClient* PowerManagerClient::Create(dbus::Bus* bus) {
536 if (system::runtime_environment::IsRunningOnChromeOS()) { 538 if (system::runtime_environment::IsRunningOnChromeOS()) {
537 return new PowerManagerClientImpl(bus); 539 return new PowerManagerClientImpl(bus);
538 } else { 540 } else {
539 return new PowerManagerClientStubImpl(); 541 return new PowerManagerClientStubImpl();
540 } 542 }
541 } 543 }
542 544
543 } // namespace chromeos 545 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698