| 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 helper_->CallVoidMethodWithErrorCallback(&method_call, |
| 247 callback, |
| 248 error_callback); |
| 249 } |
| 250 |
| 213 virtual TestInterface* GetTestInterface() OVERRIDE { | 251 virtual TestInterface* GetTestInterface() OVERRIDE { |
| 214 return NULL; | 252 return NULL; |
| 215 } | 253 } |
| 216 | 254 |
| 217 protected: | 255 protected: |
| 218 virtual void Init(dbus::Bus* bus) OVERRIDE { | 256 virtual void Init(dbus::Bus* bus) OVERRIDE { |
| 219 proxy_ = bus->GetObjectProxy(shill::kFlimflamServiceName, | 257 proxy_ = bus->GetObjectProxy(shill::kFlimflamServiceName, |
| 220 dbus::ObjectPath(shill::kFlimflamServicePath)); | 258 dbus::ObjectPath(shill::kFlimflamServicePath)); |
| 221 helper_.reset(new ShillClientHelper(proxy_)); | 259 helper_.reset(new ShillClientHelper(proxy_)); |
| 222 helper_->MonitorPropertyChanged(shill::kFlimflamManagerInterface); | 260 helper_->MonitorPropertyChanged(shill::kFlimflamManagerInterface); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 241 } | 279 } |
| 242 | 280 |
| 243 // ShillManagerClient::VerificationProperties implementation. | 281 // ShillManagerClient::VerificationProperties implementation. |
| 244 ShillManagerClient::VerificationProperties::VerificationProperties() { | 282 ShillManagerClient::VerificationProperties::VerificationProperties() { |
| 245 } | 283 } |
| 246 | 284 |
| 247 ShillManagerClient::VerificationProperties::~VerificationProperties() { | 285 ShillManagerClient::VerificationProperties::~VerificationProperties() { |
| 248 } | 286 } |
| 249 | 287 |
| 250 } // namespace chromeos | 288 } // namespace chromeos |
| OLD | NEW |