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

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

Issue 9363045: Revert 121920 - dbus: add ObjectPath type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | 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/sensors_client.h" 5 #include "chrome/browser/chromeos/dbus/sensors_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "chrome/browser/chromeos/system/runtime_environment.h" 9 #include "chrome/browser/chromeos/system/runtime_environment.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/sensors_provider.h" 11 #include "content/public/browser/sensors_provider.h"
12 #include "dbus/bus.h" 12 #include "dbus/bus.h"
13 #include "dbus/message.h" 13 #include "dbus/message.h"
14 #include "dbus/object_path.h"
15 #include "dbus/object_proxy.h" 14 #include "dbus/object_proxy.h"
16 15
17 using content::BrowserThread; 16 using content::BrowserThread;
18 17
19 // TODO(cwolfe): Fix the DEPs so that these can be pulled in from 18 // TODO(cwolfe): Fix the DEPs so that these can be pulled in from
20 // "chromeos/dbus/service_constants.h". 19 // "chromeos/dbus/service_constants.h".
21 namespace chromeos { 20 namespace chromeos {
22 // Sensors service identifiers. 21 // Sensors service identifiers.
23 const char kSensorsServiceName[] = "org.chromium.Sensors"; 22 const char kSensorsServiceName[] = "org.chromium.Sensors";
24 const char kSensorsServicePath[] = "/org/chromium/Sensors"; 23 const char kSensorsServicePath[] = "/org/chromium/Sensors";
25 const char kSensorsServiceInterface[] = "org.chromium.Sensors"; 24 const char kSensorsServiceInterface[] = "org.chromium.Sensors";
26 // Sensors signal names. 25 // Sensors signal names.
27 const char kScreenOrientationChanged[] = "ScreenOrientationChanged"; 26 const char kScreenOrientationChanged[] = "ScreenOrientationChanged";
28 27
29 // The SensorsClient implementation used in production. 28 // The SensorsClient implementation used in production.
30 class SensorsClientImpl : public SensorsClient { 29 class SensorsClientImpl : public SensorsClient {
31 public: 30 public:
32 explicit SensorsClientImpl(dbus::Bus* bus) 31 explicit SensorsClientImpl(dbus::Bus* bus)
33 : sensors_proxy_(NULL), 32 : sensors_proxy_(NULL),
34 weak_ptr_factory_(this) { 33 weak_ptr_factory_(this) {
35 sensors_proxy_ = bus->GetObjectProxy( 34 sensors_proxy_ = bus->GetObjectProxy(chromeos::kSensorsServiceName,
36 chromeos::kSensorsServiceName, 35 chromeos::kSensorsServicePath);
37 dbus::ObjectPath(chromeos::kSensorsServicePath));
38 sensors_proxy_->ConnectToSignal( 36 sensors_proxy_->ConnectToSignal(
39 chromeos::kSensorsServiceInterface, 37 chromeos::kSensorsServiceInterface,
40 chromeos::kScreenOrientationChanged, 38 chromeos::kScreenOrientationChanged,
41 base::Bind(&SensorsClientImpl::OrientationChangedReceived, 39 base::Bind(&SensorsClientImpl::OrientationChangedReceived,
42 weak_ptr_factory_.GetWeakPtr()), 40 weak_ptr_factory_.GetWeakPtr()),
43 base::Bind(&SensorsClientImpl::OrientationChangedConnected, 41 base::Bind(&SensorsClientImpl::OrientationChangedConnected,
44 weak_ptr_factory_.GetWeakPtr())); 42 weak_ptr_factory_.GetWeakPtr()));
45 } 43 }
46 44
47 virtual ~SensorsClientImpl() { 45 virtual ~SensorsClientImpl() {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 93
96 SensorsClient* SensorsClient::Create(dbus::Bus* bus) { 94 SensorsClient* SensorsClient::Create(dbus::Bus* bus) {
97 if (system::runtime_environment::IsRunningOnChromeOS()) { 95 if (system::runtime_environment::IsRunningOnChromeOS()) {
98 return new SensorsClientImpl(bus); 96 return new SensorsClientImpl(bus);
99 } else { 97 } else {
100 return new SensorsClientStubImpl(); 98 return new SensorsClientStubImpl();
101 } 99 }
102 } 100 }
103 101
104 } // namespace chromeos 102 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698