| 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 if (ip_endpoint.address().empty()) { |
| 219 LOG(ERROR) << "AddWakeOnPacketConnection: null address"; |
| 220 return; |
| 221 } |
| 222 dbus::MethodCall method_call(shill::kFlimflamManagerInterface, |
| 223 shill::kAddWakeOnPacketConnectionFunction); |
| 224 dbus::MessageWriter writer(&method_call); |
| 225 writer.AppendString(net::IPAddressToString(ip_endpoint.address())); |
| 226 helper_->CallVoidMethodWithErrorCallback(&method_call, |
| 227 callback, |
| 228 error_callback); |
| 229 } |
| 230 |
| 231 virtual void RemoveWakeOnPacketConnection( |
| 232 const net::IPEndPoint& ip_endpoint, |
| 233 const base::Closure& callback, |
| 234 const ErrorCallback& error_callback) OVERRIDE { |
| 235 if (ip_endpoint.address().empty()) { |
| 236 LOG(ERROR) << "RemoveWakeOnPacketConnection: null address"; |
| 237 return; |
| 238 } |
| 239 dbus::MethodCall method_call(shill::kFlimflamManagerInterface, |
| 240 shill::kRemoveWakeOnPacketConnectionFunction); |
| 241 dbus::MessageWriter writer(&method_call); |
| 242 writer.AppendString(net::IPAddressToString(ip_endpoint.address())); |
| 243 helper_->CallVoidMethodWithErrorCallback(&method_call, |
| 244 callback, |
| 245 error_callback); |
| 246 } |
| 247 |
| 248 virtual void RemoveAllWakeOnPacketConnections( |
| 249 const base::Closure& callback, |
| 250 const ErrorCallback& error_callback) OVERRIDE { |
| 251 dbus::MethodCall method_call( |
| 252 shill::kFlimflamManagerInterface, |
| 253 shill::kRemoveAllWakeOnPacketConnectionsFunction); |
| 254 helper_->CallVoidMethodWithErrorCallback(&method_call, |
| 255 callback, |
| 256 error_callback); |
| 257 } |
| 258 |
| 213 virtual TestInterface* GetTestInterface() OVERRIDE { | 259 virtual TestInterface* GetTestInterface() OVERRIDE { |
| 214 return NULL; | 260 return NULL; |
| 215 } | 261 } |
| 216 | 262 |
| 217 protected: | 263 protected: |
| 218 virtual void Init(dbus::Bus* bus) OVERRIDE { | 264 virtual void Init(dbus::Bus* bus) OVERRIDE { |
| 219 proxy_ = bus->GetObjectProxy(shill::kFlimflamServiceName, | 265 proxy_ = bus->GetObjectProxy(shill::kFlimflamServiceName, |
| 220 dbus::ObjectPath(shill::kFlimflamServicePath)); | 266 dbus::ObjectPath(shill::kFlimflamServicePath)); |
| 221 helper_.reset(new ShillClientHelper(proxy_)); | 267 helper_.reset(new ShillClientHelper(proxy_)); |
| 222 helper_->MonitorPropertyChanged(shill::kFlimflamManagerInterface); | 268 helper_->MonitorPropertyChanged(shill::kFlimflamManagerInterface); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 241 } | 287 } |
| 242 | 288 |
| 243 // ShillManagerClient::VerificationProperties implementation. | 289 // ShillManagerClient::VerificationProperties implementation. |
| 244 ShillManagerClient::VerificationProperties::VerificationProperties() { | 290 ShillManagerClient::VerificationProperties::VerificationProperties() { |
| 245 } | 291 } |
| 246 | 292 |
| 247 ShillManagerClient::VerificationProperties::~VerificationProperties() { | 293 ShillManagerClient::VerificationProperties::~VerificationProperties() { |
| 248 } | 294 } |
| 249 | 295 |
| 250 } // namespace chromeos | 296 } // namespace chromeos |
| OLD | NEW |