Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1550)

Side by Side Diff: chromeos/dbus/fake_shill_service_client.cc

Issue 694533007: Add 'setProperties' to InternetOptionsHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 // not enforce a valid guid, we do that at the NetworkStateHandler layer. 370 // not enforce a valid guid, we do that at the NetworkStateHandler layer.
371 std::string guid_to_set = guid; 371 std::string guid_to_set = guid;
372 if (guid_to_set.empty()) { 372 if (guid_to_set.empty()) {
373 profile_properties.GetStringWithoutPathExpansion( 373 profile_properties.GetStringWithoutPathExpansion(
374 shill::kGuidProperty, &guid_to_set); 374 shill::kGuidProperty, &guid_to_set);
375 } 375 }
376 if (!guid_to_set.empty()) { 376 if (!guid_to_set.empty()) {
377 properties->SetWithoutPathExpansion(shill::kGuidProperty, 377 properties->SetWithoutPathExpansion(shill::kGuidProperty,
378 new base::StringValue(guid_to_set)); 378 new base::StringValue(guid_to_set));
379 } 379 }
380 shill_property_util::SetSSID(name, properties); 380 properties->SetWithoutPathExpansion(
pneubeck (no reviews) 2014/11/11 16:09:31 SetStringWithoutPathExpansion would be more compac
stevenjb 2014/11/12 01:23:29 This function predates those. Replaced them all.
381 shill::kSSIDProperty,
382 new base::StringValue(name));
383 shill_property_util::SetSSID(name, properties); // Sets kWifiHexSsid
381 properties->SetWithoutPathExpansion( 384 properties->SetWithoutPathExpansion(
382 shill::kNameProperty, 385 shill::kNameProperty,
383 new base::StringValue(name)); 386 new base::StringValue(name));
384 std::string device_path = 387 std::string device_path =
385 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> 388 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()->
386 GetDevicePathForType(type); 389 GetDevicePathForType(type);
387 properties->SetWithoutPathExpansion( 390 properties->SetWithoutPathExpansion(
388 shill::kDeviceProperty, 391 shill::kDeviceProperty,
389 new base::StringValue(device_path)); 392 new base::StringValue(device_path));
390 properties->SetWithoutPathExpansion( 393 properties->SetWithoutPathExpansion(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 VLOG(1) << "Service.SetProperty: " << property << " = " << value 427 VLOG(1) << "Service.SetProperty: " << property << " = " << value
425 << " For: " << service_path; 428 << " For: " << service_path;
426 429
427 base::DictionaryValue new_properties; 430 base::DictionaryValue new_properties;
428 std::string changed_property; 431 std::string changed_property;
429 bool case_sensitive = true; 432 bool case_sensitive = true;
430 if (StartsWithASCII(property, "Provider.", case_sensitive) || 433 if (StartsWithASCII(property, "Provider.", case_sensitive) ||
431 StartsWithASCII(property, "OpenVPN.", case_sensitive) || 434 StartsWithASCII(property, "OpenVPN.", case_sensitive) ||
432 StartsWithASCII(property, "L2TPIPsec.", case_sensitive)) { 435 StartsWithASCII(property, "L2TPIPsec.", case_sensitive)) {
433 // These properties are only nested within the Provider dictionary if read 436 // These properties are only nested within the Provider dictionary if read
434 // from Shill. 437 // from Shill. Properties that start with "Provider" need to have that
438 // stripped off, other properties are nested in the "Provider" dictionary
439 // as-is.
440 std::string key = property;
441 if (StartsWithASCII(property, "Provider.", case_sensitive))
442 key = property.substr(strlen("Provider."));
435 base::DictionaryValue* provider = new base::DictionaryValue; 443 base::DictionaryValue* provider = new base::DictionaryValue;
436 provider->SetWithoutPathExpansion(property, value.DeepCopy()); 444 provider->SetWithoutPathExpansion(key, value.DeepCopy());
437 new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider); 445 new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider);
438 changed_property = shill::kProviderProperty; 446 changed_property = shill::kProviderProperty;
439 } else { 447 } else {
440 new_properties.SetWithoutPathExpansion(property, value.DeepCopy()); 448 new_properties.SetWithoutPathExpansion(property, value.DeepCopy());
441 changed_property = property; 449 changed_property = property;
442 } 450 }
443 451
444 dict->MergeDictionary(&new_properties); 452 dict->MergeDictionary(&new_properties);
445 453
446 // Add or update the profile entry. 454 // Add or update the profile entry.
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 } else { 640 } else {
633 // Set Online. 641 // Set Online.
634 VLOG(1) << "Setting state to Online " << service_path; 642 VLOG(1) << "Setting state to Online " << service_path;
635 SetServiceProperty(service_path, 643 SetServiceProperty(service_path,
636 shill::kStateProperty, 644 shill::kStateProperty,
637 base::StringValue(shill::kStateOnline)); 645 base::StringValue(shill::kStateOnline));
638 } 646 }
639 } 647 }
640 648
641 } // namespace chromeos 649 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698