OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_stub.h" | 5 #include "chromeos/dbus/shill_service_client_stub.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 DBusMethodCallStatus call_status; | 89 DBusMethodCallStatus call_status; |
90 stub_services_.GetDictionaryWithoutPathExpansion(service_path.value(), | 90 stub_services_.GetDictionaryWithoutPathExpansion(service_path.value(), |
91 &nested_dict); | 91 &nested_dict); |
92 if (nested_dict) { | 92 if (nested_dict) { |
93 result_properties.reset(nested_dict->DeepCopy()); | 93 result_properties.reset(nested_dict->DeepCopy()); |
94 // Remove credentials that Shill wouldn't send. | 94 // Remove credentials that Shill wouldn't send. |
95 result_properties->RemoveWithoutPathExpansion(flimflam::kPassphraseProperty, | 95 result_properties->RemoveWithoutPathExpansion(flimflam::kPassphraseProperty, |
96 NULL); | 96 NULL); |
97 call_status = DBUS_METHOD_CALL_SUCCESS; | 97 call_status = DBUS_METHOD_CALL_SUCCESS; |
98 } else { | 98 } else { |
| 99 LOG(ERROR) << "Properties not found for: " << service_path.value(); |
99 result_properties.reset(new base::DictionaryValue); | 100 result_properties.reset(new base::DictionaryValue); |
100 call_status = DBUS_METHOD_CALL_FAILURE; | 101 call_status = DBUS_METHOD_CALL_FAILURE; |
101 } | 102 } |
102 | 103 |
103 base::MessageLoop::current()->PostTask( | 104 base::MessageLoop::current()->PostTask( |
104 FROM_HERE, | 105 FROM_HERE, |
105 base::Bind(&PassStubServiceProperties, | 106 base::Bind(&PassStubServiceProperties, |
106 callback, | 107 callback, |
107 call_status, | 108 call_status, |
108 base::Owned(result_properties.release()))); | 109 base::Owned(result_properties.release()))); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 // When State changes the sort order of Services may change. | 444 // When State changes the sort order of Services may change. |
444 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 445 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
445 SortManagerServices(); | 446 SortManagerServices(); |
446 } | 447 } |
447 | 448 |
448 base::MessageLoop::current()->PostTask( | 449 base::MessageLoop::current()->PostTask( |
449 FROM_HERE, | 450 FROM_HERE, |
450 base::Bind(&ShillServiceClientStub::NotifyObserversPropertyChanged, | 451 base::Bind(&ShillServiceClientStub::NotifyObserversPropertyChanged, |
451 weak_ptr_factory_.GetWeakPtr(), | 452 weak_ptr_factory_.GetWeakPtr(), |
452 dbus::ObjectPath(service_path), changed_property)); | 453 dbus::ObjectPath(service_path), changed_property)); |
| 454 |
| 455 if (property == flimflam::kPassphraseProperty || |
| 456 property == flimflam::kEapPasswordProperty) { |
| 457 // Assume that when a passphrase gets set, 'Connectable' becomes true. |
| 458 // TODO(stevenjb): Add 'CheckConnectable' that checks all properties. |
| 459 SetServiceProperty(service_path, |
| 460 flimflam::kConnectableProperty, |
| 461 base::FundamentalValue(true)); |
| 462 } |
| 463 |
453 return true; | 464 return true; |
454 } | 465 } |
455 | 466 |
456 const base::DictionaryValue* ShillServiceClientStub::GetServiceProperties( | 467 const base::DictionaryValue* ShillServiceClientStub::GetServiceProperties( |
457 const std::string& service_path) const { | 468 const std::string& service_path) const { |
458 const base::DictionaryValue* properties = NULL; | 469 const base::DictionaryValue* properties = NULL; |
459 stub_services_.GetDictionaryWithoutPathExpansion(service_path, &properties); | 470 stub_services_.GetDictionaryWithoutPathExpansion(service_path, &properties); |
460 return properties; | 471 return properties; |
461 } | 472 } |
462 | 473 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 base::Bind(&base::DoNothing), | 665 base::Bind(&base::DoNothing), |
655 error_callback); | 666 error_callback); |
656 SetProperty(service_path, | 667 SetProperty(service_path, |
657 flimflam::kConnectableProperty, | 668 flimflam::kConnectableProperty, |
658 base::FundamentalValue(true), | 669 base::FundamentalValue(true), |
659 base::Bind(&base::DoNothing), | 670 base::Bind(&base::DoNothing), |
660 error_callback); | 671 error_callback); |
661 } | 672 } |
662 | 673 |
663 } // namespace chromeos | 674 } // namespace chromeos |
OLD | NEW |