OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/fake_shill_service_client.h" | 5 #include "chromeos/dbus/fake_shill_service_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // from Shill. Properties that start with "Provider" need to have that | 425 // from Shill. Properties that start with "Provider" need to have that |
426 // stripped off, other properties are nested in the "Provider" dictionary | 426 // stripped off, other properties are nested in the "Provider" dictionary |
427 // as-is. | 427 // as-is. |
428 std::string key = property; | 428 std::string key = property; |
429 if (StartsWithASCII(property, "Provider.", case_sensitive)) | 429 if (StartsWithASCII(property, "Provider.", case_sensitive)) |
430 key = property.substr(strlen("Provider.")); | 430 key = property.substr(strlen("Provider.")); |
431 base::DictionaryValue* provider = new base::DictionaryValue; | 431 base::DictionaryValue* provider = new base::DictionaryValue; |
432 provider->SetWithoutPathExpansion(key, value.DeepCopy()); | 432 provider->SetWithoutPathExpansion(key, value.DeepCopy()); |
433 new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider); | 433 new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider); |
434 changed_property = shill::kProviderProperty; | 434 changed_property = shill::kProviderProperty; |
| 435 } else if (value.GetType() == base::Value::TYPE_DICTIONARY) { |
| 436 const base::DictionaryValue* new_dict = NULL; |
| 437 value.GetAsDictionary(&new_dict); |
| 438 CHECK(new_dict); |
| 439 scoped_ptr<base::Value> cur_value; |
| 440 base::DictionaryValue* cur_dict; |
| 441 if (dict->RemoveWithoutPathExpansion(property, &cur_value) && |
| 442 cur_value->GetAsDictionary(&cur_dict)) { |
| 443 cur_dict->Clear(); |
| 444 cur_dict->MergeDictionary(new_dict); |
| 445 new_properties.SetWithoutPathExpansion(property, cur_value.release()); |
| 446 } else { |
| 447 new_properties.SetWithoutPathExpansion(property, value.DeepCopy()); |
| 448 } |
| 449 changed_property = property; |
435 } else { | 450 } else { |
436 new_properties.SetWithoutPathExpansion(property, value.DeepCopy()); | 451 new_properties.SetWithoutPathExpansion(property, value.DeepCopy()); |
437 changed_property = property; | 452 changed_property = property; |
438 } | 453 } |
439 | 454 |
440 dict->MergeDictionary(&new_properties); | 455 dict->MergeDictionary(&new_properties); |
441 | 456 |
442 // Add or update the profile entry. | 457 // Add or update the profile entry. |
443 ShillProfileClient::TestInterface* profile_test = | 458 ShillProfileClient::TestInterface* profile_test = |
444 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface(); | 459 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface(); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 } else { | 643 } else { |
629 // Set Online. | 644 // Set Online. |
630 VLOG(1) << "Setting state to Online " << service_path; | 645 VLOG(1) << "Setting state to Online " << service_path; |
631 SetServiceProperty(service_path, | 646 SetServiceProperty(service_path, |
632 shill::kStateProperty, | 647 shill::kStateProperty, |
633 base::StringValue(shill::kStateOnline)); | 648 base::StringValue(shill::kStateOnline)); |
634 } | 649 } |
635 } | 650 } |
636 | 651 |
637 } // namespace chromeos | 652 } // namespace chromeos |
OLD | NEW |