Chromium Code Reviews| 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_device_client.h" | 5 #include "chromeos/dbus/shill_device_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 const base::Closure& callback, | 171 const base::Closure& callback, |
| 172 const ErrorCallback& error_callback) OVERRIDE { | 172 const ErrorCallback& error_callback) OVERRIDE { |
| 173 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, | 173 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, |
| 174 shill::kSetCarrierFunction); | 174 shill::kSetCarrierFunction); |
| 175 dbus::MessageWriter writer(&method_call); | 175 dbus::MessageWriter writer(&method_call); |
| 176 writer.AppendString(carrier); | 176 writer.AppendString(carrier); |
| 177 GetHelper(device_path)->CallVoidMethodWithErrorCallback( | 177 GetHelper(device_path)->CallVoidMethodWithErrorCallback( |
| 178 &method_call, callback, error_callback); | 178 &method_call, callback, error_callback); |
| 179 } | 179 } |
| 180 | 180 |
| 181 virtual void Reset(const dbus::ObjectPath& device_path, | |
| 182 const base::Closure& callback, | |
| 183 const ErrorCallback& error_callback) OVERRIDE { | |
| 184 dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface, | |
| 185 shill::kResetFunction); | |
|
Ben Chan
2013/01/23 19:57:20
shill::kResetFunction is not defined.
Ben Chan
2013/01/23 20:19:48
See https://gerrit.chromium.org/gerrit/#/c/41849
| |
| 186 GetHelper(device_path)->CallVoidMethodWithErrorCallback( | |
| 187 &method_call, callback, error_callback); | |
| 188 } | |
| 189 | |
| 181 virtual TestInterface* GetTestInterface() OVERRIDE { | 190 virtual TestInterface* GetTestInterface() OVERRIDE { |
| 182 return NULL; | 191 return NULL; |
| 183 } | 192 } |
| 184 | 193 |
| 185 private: | 194 private: |
| 186 typedef std::map<std::string, ShillClientHelper*> HelperMap; | 195 typedef std::map<std::string, ShillClientHelper*> HelperMap; |
| 187 | 196 |
| 188 // Returns the corresponding ShillClientHelper for the profile. | 197 // Returns the corresponding ShillClientHelper for the profile. |
| 189 ShillClientHelper* GetHelper(const dbus::ObjectPath& device_path) { | 198 ShillClientHelper* GetHelper(const dbus::ObjectPath& device_path) { |
| 190 HelperMap::iterator it = helpers_.find(device_path.value()); | 199 HelperMap::iterator it = helpers_.find(device_path.value()); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 | 369 |
| 361 virtual void SetCarrier(const dbus::ObjectPath& device_path, | 370 virtual void SetCarrier(const dbus::ObjectPath& device_path, |
| 362 const std::string& carrier, | 371 const std::string& carrier, |
| 363 const base::Closure& callback, | 372 const base::Closure& callback, |
| 364 const ErrorCallback& error_callback) OVERRIDE { | 373 const ErrorCallback& error_callback) OVERRIDE { |
| 365 if (callback.is_null()) | 374 if (callback.is_null()) |
| 366 return; | 375 return; |
| 367 MessageLoop::current()->PostTask(FROM_HERE, callback); | 376 MessageLoop::current()->PostTask(FROM_HERE, callback); |
| 368 } | 377 } |
| 369 | 378 |
| 379 virtual void Reset(const dbus::ObjectPath& device_path, | |
| 380 const base::Closure& callback, | |
| 381 const ErrorCallback& error_callback) OVERRIDE { | |
| 382 if (callback.is_null()) | |
| 383 return; | |
| 384 MessageLoop::current()->PostTask(FROM_HERE, callback); | |
| 385 } | |
| 386 | |
| 370 virtual ShillDeviceClient::TestInterface* GetTestInterface() OVERRIDE { | 387 virtual ShillDeviceClient::TestInterface* GetTestInterface() OVERRIDE { |
| 371 return this; | 388 return this; |
| 372 } | 389 } |
| 373 | 390 |
| 374 // ShillDeviceClient::TestInterface overrides. | 391 // ShillDeviceClient::TestInterface overrides. |
| 375 | 392 |
| 376 virtual void AddDevice(const std::string& device_path, | 393 virtual void AddDevice(const std::string& device_path, |
| 377 const std::string& type, | 394 const std::string& type, |
| 378 const std::string& object_path) OVERRIDE { | 395 const std::string& object_path) OVERRIDE { |
| 379 base::DictionaryValue* properties = GetDeviceProperties(device_path); | 396 base::DictionaryValue* properties = GetDeviceProperties(device_path); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 ShillDeviceClient* ShillDeviceClient::Create( | 521 ShillDeviceClient* ShillDeviceClient::Create( |
| 505 DBusClientImplementationType type, | 522 DBusClientImplementationType type, |
| 506 dbus::Bus* bus) { | 523 dbus::Bus* bus) { |
| 507 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 524 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
| 508 return new ShillDeviceClientImpl(bus); | 525 return new ShillDeviceClientImpl(bus); |
| 509 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 526 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
| 510 return new ShillDeviceClientStubImpl(); | 527 return new ShillDeviceClientStubImpl(); |
| 511 } | 528 } |
| 512 | 529 |
| 513 } // namespace chromeos | 530 } // namespace chromeos |
| OLD | NEW |