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" | |
18 #include "third_party/cros_system_api/dbus/service_constants.h" | 17 #include "third_party/cros_system_api/dbus/service_constants.h" |
19 | 18 |
20 namespace chromeos { | 19 namespace chromeos { |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
24 // The ShillManagerClient implementation. | 23 // The ShillManagerClient implementation. |
25 class ShillManagerClientImpl : public ShillManagerClient { | 24 class ShillManagerClientImpl : public ShillManagerClient { |
26 public: | 25 public: |
27 ShillManagerClientImpl() : proxy_(NULL) {} | 26 ShillManagerClientImpl() : proxy_(NULL) {} |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 virtual void ConnectToBestServices( | 203 virtual void ConnectToBestServices( |
205 const base::Closure& callback, | 204 const base::Closure& callback, |
206 const ErrorCallback& error_callback) OVERRIDE { | 205 const ErrorCallback& error_callback) OVERRIDE { |
207 dbus::MethodCall method_call(shill::kFlimflamManagerInterface, | 206 dbus::MethodCall method_call(shill::kFlimflamManagerInterface, |
208 shill::kConnectToBestServicesFunction); | 207 shill::kConnectToBestServicesFunction); |
209 helper_->CallVoidMethodWithErrorCallback(&method_call, | 208 helper_->CallVoidMethodWithErrorCallback(&method_call, |
210 callback, | 209 callback, |
211 error_callback); | 210 error_callback); |
212 } | 211 } |
213 | 212 |
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(net::IPAddressToString(ip_endpoint.address())); | |
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(net::IPAddressToString(ip_endpoint.address())); | |
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 helper_->CallVoidMethodWithErrorCallback(&method_call, | |
247 callback, | |
248 error_callback); | |
249 } | |
250 | |
251 virtual TestInterface* GetTestInterface() OVERRIDE { | 213 virtual TestInterface* GetTestInterface() OVERRIDE { |
252 return NULL; | 214 return NULL; |
253 } | 215 } |
254 | 216 |
255 protected: | 217 protected: |
256 virtual void Init(dbus::Bus* bus) OVERRIDE { | 218 virtual void Init(dbus::Bus* bus) OVERRIDE { |
257 proxy_ = bus->GetObjectProxy(shill::kFlimflamServiceName, | 219 proxy_ = bus->GetObjectProxy(shill::kFlimflamServiceName, |
258 dbus::ObjectPath(shill::kFlimflamServicePath)); | 220 dbus::ObjectPath(shill::kFlimflamServicePath)); |
259 helper_.reset(new ShillClientHelper(proxy_)); | 221 helper_.reset(new ShillClientHelper(proxy_)); |
260 helper_->MonitorPropertyChanged(shill::kFlimflamManagerInterface); | 222 helper_->MonitorPropertyChanged(shill::kFlimflamManagerInterface); |
(...skipping 18 matching lines...) Expand all Loading... |
279 } | 241 } |
280 | 242 |
281 // ShillManagerClient::VerificationProperties implementation. | 243 // ShillManagerClient::VerificationProperties implementation. |
282 ShillManagerClient::VerificationProperties::VerificationProperties() { | 244 ShillManagerClient::VerificationProperties::VerificationProperties() { |
283 } | 245 } |
284 | 246 |
285 ShillManagerClient::VerificationProperties::~VerificationProperties() { | 247 ShillManagerClient::VerificationProperties::~VerificationProperties() { |
286 } | 248 } |
287 | 249 |
288 } // namespace chromeos | 250 } // namespace chromeos |
OLD | NEW |