OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/dbus/peer_daemon_manager_client.h" | 5 #include "chromeos/dbus/peer_daemon_manager_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 "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "dbus/bus.h" | 11 #include "dbus/bus.h" |
12 #include "dbus/message.h" | 12 #include "dbus/message.h" |
13 #include "dbus/object_proxy.h" | 13 #include "dbus/object_proxy.h" |
14 #include "dbus/values_util.h" | 14 #include "dbus/values_util.h" |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 namespace { | 17 namespace { |
18 | 18 |
19 // TODO(benchan): Move these constants to system_api. | 19 // TODO(benchan): Move these constants to system_api. |
20 namespace peerd { | 20 namespace peerd { |
21 const char kPeerdServiceName[] = "org.chromium.peerd"; | 21 const char kPeerdServiceName[] = "org.chromium.peerd"; |
22 const char kPeerdServicePath[] = "/org/chromium/peerd"; | 22 const char kPeerdManagerPath[] = "/org/chromium/peerd/Manager"; |
23 const char kManagerInterface[] = "org.chromium.peerd.Manager"; | 23 const char kManagerInterface[] = "org.chromium.peerd.Manager"; |
24 const char kStartMonitoringMethod[] = "StartMonitoring"; | 24 const char kStartMonitoringMethod[] = "StartMonitoring"; |
25 const char kStopMonitoringMethod[] = "StopMonitoring"; | 25 const char kStopMonitoringMethod[] = "StopMonitoring"; |
26 const char kExposeServiceMethod[] = "ExposeService"; | 26 const char kExposeServiceMethod[] = "ExposeService"; |
27 const char kRemoveExposedServiceMethod[] = "RemoveExposedService"; | 27 const char kRemoveExposedServiceMethod[] = "RemoveExposedService"; |
28 const char kPingMethod[] = "Ping"; | 28 const char kPingMethod[] = "Ping"; |
29 } // namespace peerd | 29 } // namespace peerd |
30 | 30 |
31 // The PeerDaemonManagerClient implementation used in production. | 31 // The PeerDaemonManagerClient implementation used in production. |
32 class PeerDaemonManagerClientImpl : public PeerDaemonManagerClient { | 32 class PeerDaemonManagerClientImpl : public PeerDaemonManagerClient { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 void PeerDaemonManagerClientImpl::OnVoidDBusMethod( | 183 void PeerDaemonManagerClientImpl::OnVoidDBusMethod( |
184 const VoidDBusMethodCallback& callback, | 184 const VoidDBusMethodCallback& callback, |
185 dbus::Response* response) { | 185 dbus::Response* response) { |
186 callback.Run(response ? DBUS_METHOD_CALL_SUCCESS : DBUS_METHOD_CALL_FAILURE); | 186 callback.Run(response ? DBUS_METHOD_CALL_SUCCESS : DBUS_METHOD_CALL_FAILURE); |
187 } | 187 } |
188 | 188 |
189 void PeerDaemonManagerClientImpl::Init(dbus::Bus* bus) { | 189 void PeerDaemonManagerClientImpl::Init(dbus::Bus* bus) { |
190 peer_daemon_proxy_ = | 190 peer_daemon_proxy_ = |
191 bus->GetObjectProxy(peerd::kPeerdServiceName, | 191 bus->GetObjectProxy(peerd::kPeerdServiceName, |
192 dbus::ObjectPath(peerd::kPeerdServicePath)); | 192 dbus::ObjectPath(peerd::kPeerdManagerPath)); |
193 } | 193 } |
194 | 194 |
195 } // namespace | 195 } // namespace |
196 | 196 |
197 | 197 |
198 PeerDaemonManagerClient::PeerDaemonManagerClient() { | 198 PeerDaemonManagerClient::PeerDaemonManagerClient() { |
199 } | 199 } |
200 | 200 |
201 PeerDaemonManagerClient::~PeerDaemonManagerClient() { | 201 PeerDaemonManagerClient::~PeerDaemonManagerClient() { |
202 } | 202 } |
203 | 203 |
204 // static | 204 // static |
205 PeerDaemonManagerClient* PeerDaemonManagerClient::Create() { | 205 PeerDaemonManagerClient* PeerDaemonManagerClient::Create() { |
206 return new PeerDaemonManagerClientImpl(); | 206 return new PeerDaemonManagerClientImpl(); |
207 } | 207 } |
208 | 208 |
209 } // namespace chromeos | 209 } // namespace chromeos |
OLD | NEW |