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

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

Issue 9378039: dbus: add ObjectPath type (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
Patch Set: add patch for cryptohome_client Created 8 years, 10 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
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_proxy.h" 22 #include "dbus/object_proxy.h"
22 #include "third_party/cros_system_api/dbus/service_constants.h" 23 #include "third_party/cros_system_api/dbus/service_constants.h"
23 24
24 namespace chromeos { 25 namespace chromeos {
25 26
26 PowerSupplyStatus::PowerSupplyStatus() 27 PowerSupplyStatus::PowerSupplyStatus()
27 : line_power_on(false), 28 : line_power_on(false),
28 battery_is_present(false), 29 battery_is_present(false),
29 battery_is_full(false), 30 battery_is_full(false),
30 battery_seconds_to_empty(0), 31 battery_seconds_to_empty(0),
(...skipping 25 matching lines...) Expand all
56 } 57 }
57 58
58 // The PowerManagerClient implementation used in production. 59 // The PowerManagerClient implementation used in production.
59 class PowerManagerClientImpl : public PowerManagerClient { 60 class PowerManagerClientImpl : public PowerManagerClient {
60 public: 61 public:
61 explicit PowerManagerClientImpl(dbus::Bus* bus) 62 explicit PowerManagerClientImpl(dbus::Bus* bus)
62 : power_manager_proxy_(NULL), 63 : power_manager_proxy_(NULL),
63 weak_ptr_factory_(this) { 64 weak_ptr_factory_(this) {
64 power_manager_proxy_ = bus->GetObjectProxy( 65 power_manager_proxy_ = bus->GetObjectProxy(
65 power_manager::kPowerManagerServiceName, 66 power_manager::kPowerManagerServiceName,
66 power_manager::kPowerManagerServicePath); 67 dbus::ObjectPath(power_manager::kPowerManagerServicePath));
67 68
68 // Monitor the D-Bus signal for brightness changes. Only the power 69 // Monitor the D-Bus signal for brightness changes. Only the power
69 // manager knows the actual brightness level. We don't cache the 70 // manager knows the actual brightness level. We don't cache the
70 // brightness level in Chrome as it'll make things less reliable. 71 // brightness level in Chrome as it'll make things less reliable.
71 power_manager_proxy_->ConnectToSignal( 72 power_manager_proxy_->ConnectToSignal(
72 power_manager::kPowerManagerInterface, 73 power_manager::kPowerManagerInterface,
73 power_manager::kBrightnessChangedSignal, 74 power_manager::kBrightnessChangedSignal,
74 base::Bind(&PowerManagerClientImpl::BrightnessChangedReceived, 75 base::Bind(&PowerManagerClientImpl::BrightnessChangedReceived,
75 weak_ptr_factory_.GetWeakPtr()), 76 weak_ptr_factory_.GetWeakPtr()),
76 base::Bind(&PowerManagerClientImpl::SignalConnected, 77 base::Bind(&PowerManagerClientImpl::SignalConnected,
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 567
567 PowerManagerClient* PowerManagerClient::Create(dbus::Bus* bus) { 568 PowerManagerClient* PowerManagerClient::Create(dbus::Bus* bus) {
568 if (system::runtime_environment::IsRunningOnChromeOS()) { 569 if (system::runtime_environment::IsRunningOnChromeOS()) {
569 return new PowerManagerClientImpl(bus); 570 return new PowerManagerClientImpl(bus);
570 } else { 571 } else {
571 return new PowerManagerClientStubImpl(); 572 return new PowerManagerClientStubImpl();
572 } 573 }
573 } 574 }
574 575
575 } // namespace chromeos 576 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698