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_service_client.h" | 5 #include "chromeos/dbus/shill_service_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 return; | 305 return; |
306 MessageLoop::current()->PostTask( | 306 MessageLoop::current()->PostTask( |
307 FROM_HERE, | 307 FROM_HERE, |
308 base::Bind(&ShillServiceClientStubImpl::PassStubListValue, | 308 base::Bind(&ShillServiceClientStubImpl::PassStubListValue, |
309 callback, base::Owned(results.release()))); | 309 callback, base::Owned(results.release()))); |
310 } | 310 } |
311 | 311 |
312 virtual void Connect(const dbus::ObjectPath& service_path, | 312 virtual void Connect(const dbus::ObjectPath& service_path, |
313 const base::Closure& callback, | 313 const base::Closure& callback, |
314 const ErrorCallback& error_callback) OVERRIDE { | 314 const ErrorCallback& error_callback) OVERRIDE { |
| 315 base::Value* service; |
| 316 if (!stub_services_.Get(service_path.value(), &service)) { |
| 317 error_callback.Run("Error.InvalidService", "Invalid Service"); |
| 318 return; |
| 319 } |
315 // Set Associating | 320 // Set Associating |
316 base::StringValue associating_value(flimflam::kStateAssociation); | 321 base::StringValue associating_value(flimflam::kStateAssociation); |
317 SetServiceProperty(service_path.value(), | 322 SetServiceProperty(service_path.value(), |
318 flimflam::kStateProperty, | 323 flimflam::kStateProperty, |
319 associating_value); | 324 associating_value); |
320 // Set Online after a delay | 325 // Set Online after a delay |
321 const int kConnectDelaySeconds = 5; | 326 const int kConnectDelaySeconds = 5; |
322 base::StringValue online_value(flimflam::kStateOnline); | 327 base::StringValue online_value(flimflam::kStateOnline); |
323 MessageLoop::current()->PostDelayedTask( | 328 MessageLoop::current()->PostDelayedTask( |
324 FROM_HERE, | 329 FROM_HERE, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 ShillServiceClient* ShillServiceClient::Create( | 530 ShillServiceClient* ShillServiceClient::Create( |
526 DBusClientImplementationType type, | 531 DBusClientImplementationType type, |
527 dbus::Bus* bus) { | 532 dbus::Bus* bus) { |
528 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 533 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
529 return new ShillServiceClientImpl(bus); | 534 return new ShillServiceClientImpl(bus); |
530 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 535 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
531 return new ShillServiceClientStubImpl(); | 536 return new ShillServiceClientStubImpl(); |
532 } | 537 } |
533 | 538 |
534 } // namespace chromeos | 539 } // namespace chromeos |
OLD | NEW |