OLD | NEW |
---|---|
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 "chromeos/dbus/shill_manager_client.h" | 5 #include "chromeos/dbus/shill_manager_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chromeos/dbus/shill_property_changed_observer.h" | 11 #include "chromeos/dbus/shill_property_changed_observer.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" | 14 #include "dbus/object_path.h" |
15 #include "dbus/object_proxy.h" | 15 #include "dbus/object_proxy.h" |
16 #include "dbus/values_util.h" | 16 #include "dbus/values_util.h" |
17 #include "net/base/ip_endpoint.h" | |
17 #include "third_party/cros_system_api/dbus/service_constants.h" | 18 #include "third_party/cros_system_api/dbus/service_constants.h" |
18 | 19 |
19 namespace chromeos { | 20 namespace chromeos { |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 // The ShillManagerClient implementation. | 24 // The ShillManagerClient implementation. |
24 class ShillManagerClientImpl : public ShillManagerClient { | 25 class ShillManagerClientImpl : public ShillManagerClient { |
25 public: | 26 public: |
26 ShillManagerClientImpl() : proxy_(NULL) {} | 27 ShillManagerClientImpl() : proxy_(NULL) {} |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 virtual void ConnectToBestServices( | 204 virtual void ConnectToBestServices( |
204 const base::Closure& callback, | 205 const base::Closure& callback, |
205 const ErrorCallback& error_callback) OVERRIDE { | 206 const ErrorCallback& error_callback) OVERRIDE { |
206 dbus::MethodCall method_call(shill::kFlimflamManagerInterface, | 207 dbus::MethodCall method_call(shill::kFlimflamManagerInterface, |
207 shill::kConnectToBestServicesFunction); | 208 shill::kConnectToBestServicesFunction); |
208 helper_->CallVoidMethodWithErrorCallback(&method_call, | 209 helper_->CallVoidMethodWithErrorCallback(&method_call, |
209 callback, | 210 callback, |
210 error_callback); | 211 error_callback); |
211 } | 212 } |
212 | 213 |
214 virtual void AddWakeOnPacketConnection( | |
215 const net::IPEndPoint& ip_endpoint, | |
216 const base::Closure& callback, | |
217 const ErrorCallback& error_callback) OVERRIDE { | |
218 dbus::MethodCall method_call(shill::kFlimflamManagerInterface, | |
219 shill::kAddWakeOnPacketConnectionFunction); | |
220 dbus::MessageWriter writer(&method_call); | |
221 writer.AppendString(ip_endpoint.ToString()); | |
222 helper_->CallVoidMethodWithErrorCallback(&method_call, | |
223 callback, | |
224 error_callback); | |
225 } | |
226 | |
227 virtual void RemoveWakeOnPacketConnection( | |
228 const net::IPEndPoint& ip_endpoint, | |
229 const base::Closure& callback, | |
230 const ErrorCallback& error_callback) OVERRIDE { | |
231 dbus::MethodCall method_call(shill::kFlimflamManagerInterface, | |
232 shill::kRemoveWakeOnPacketConnectionFunction); | |
233 dbus::MessageWriter writer(&method_call); | |
234 writer.AppendString(ip_endpoint.ToString()); | |
235 helper_->CallVoidMethodWithErrorCallback(&method_call, | |
236 callback, | |
237 error_callback); | |
238 } | |
239 | |
240 virtual void RemoveAllWakeOnPacketConnections( | |
241 const base::Closure& callback, | |
242 const ErrorCallback& error_callback) OVERRIDE { | |
243 dbus::MethodCall method_call( | |
244 shill::kFlimflamManagerInterface, | |
245 shill::kRemoveAllWakeOnPacketConnectionsFunction); | |
246 dbus::MessageWriter writer(&method_call); | |
Daniel Erat
2014/08/23 14:44:52
you don't need this MessageWriter
Luigi Semenzato
2014/08/25 19:59:34
Thanks. (Why no compiler warning? Possible side
| |
247 helper_->CallVoidMethodWithErrorCallback(&method_call, | |
248 callback, | |
249 error_callback); | |
250 } | |
251 | |
213 virtual TestInterface* GetTestInterface() OVERRIDE { | 252 virtual TestInterface* GetTestInterface() OVERRIDE { |
214 return NULL; | 253 return NULL; |
215 } | 254 } |
216 | 255 |
217 protected: | 256 protected: |
218 virtual void Init(dbus::Bus* bus) OVERRIDE { | 257 virtual void Init(dbus::Bus* bus) OVERRIDE { |
219 proxy_ = bus->GetObjectProxy(shill::kFlimflamServiceName, | 258 proxy_ = bus->GetObjectProxy(shill::kFlimflamServiceName, |
220 dbus::ObjectPath(shill::kFlimflamServicePath)); | 259 dbus::ObjectPath(shill::kFlimflamServicePath)); |
221 helper_.reset(new ShillClientHelper(proxy_)); | 260 helper_.reset(new ShillClientHelper(proxy_)); |
222 helper_->MonitorPropertyChanged(shill::kFlimflamManagerInterface); | 261 helper_->MonitorPropertyChanged(shill::kFlimflamManagerInterface); |
(...skipping 18 matching lines...) Expand all Loading... | |
241 } | 280 } |
242 | 281 |
243 // ShillManagerClient::VerificationProperties implementation. | 282 // ShillManagerClient::VerificationProperties implementation. |
244 ShillManagerClient::VerificationProperties::VerificationProperties() { | 283 ShillManagerClient::VerificationProperties::VerificationProperties() { |
245 } | 284 } |
246 | 285 |
247 ShillManagerClient::VerificationProperties::~VerificationProperties() { | 286 ShillManagerClient::VerificationProperties::~VerificationProperties() { |
248 } | 287 } |
249 | 288 |
250 } // namespace chromeos | 289 } // namespace chromeos |
OLD | NEW |