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

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

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 months 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/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 const base::Value& value) { 400 const base::Value& value) {
401 base::DictionaryValue* dict = NULL; 401 base::DictionaryValue* dict = NULL;
402 if (!stub_services_.GetDictionaryWithoutPathExpansion(service_path, &dict)) 402 if (!stub_services_.GetDictionaryWithoutPathExpansion(service_path, &dict))
403 return false; 403 return false;
404 404
405 VLOG(1) << "Service.SetProperty: " << property << " = " << value 405 VLOG(1) << "Service.SetProperty: " << property << " = " << value
406 << " For: " << service_path; 406 << " For: " << service_path;
407 407
408 base::DictionaryValue new_properties; 408 base::DictionaryValue new_properties;
409 std::string changed_property; 409 std::string changed_property;
410 bool case_sensitive = true; 410 base::CompareCase case_sensitive = base::CompareCase::SENSITIVE;
411 if (base::StartsWithASCII(property, "Provider.", case_sensitive) || 411 if (base::StartsWith(property, "Provider.", case_sensitive) ||
412 base::StartsWithASCII(property, "OpenVPN.", case_sensitive) || 412 base::StartsWith(property, "OpenVPN.", case_sensitive) ||
413 base::StartsWithASCII(property, "L2TPIPsec.", case_sensitive)) { 413 base::StartsWith(property, "L2TPIPsec.", case_sensitive)) {
414 // These properties are only nested within the Provider dictionary if read 414 // These properties are only nested within the Provider dictionary if read
415 // from Shill. Properties that start with "Provider" need to have that 415 // from Shill. Properties that start with "Provider" need to have that
416 // stripped off, other properties are nested in the "Provider" dictionary 416 // stripped off, other properties are nested in the "Provider" dictionary
417 // as-is. 417 // as-is.
418 std::string key = property; 418 std::string key = property;
419 if (base::StartsWithASCII(property, "Provider.", case_sensitive)) 419 if (base::StartsWith(property, "Provider.", case_sensitive))
420 key = property.substr(strlen("Provider.")); 420 key = property.substr(strlen("Provider."));
421 base::DictionaryValue* provider = new base::DictionaryValue; 421 base::DictionaryValue* provider = new base::DictionaryValue;
422 provider->SetWithoutPathExpansion(key, value.DeepCopy()); 422 provider->SetWithoutPathExpansion(key, value.DeepCopy());
423 new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider); 423 new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider);
424 changed_property = shill::kProviderProperty; 424 changed_property = shill::kProviderProperty;
425 } else if (value.GetType() == base::Value::TYPE_DICTIONARY) { 425 } else if (value.GetType() == base::Value::TYPE_DICTIONARY) {
426 const base::DictionaryValue* new_dict = NULL; 426 const base::DictionaryValue* new_dict = NULL;
427 value.GetAsDictionary(&new_dict); 427 value.GetAsDictionary(&new_dict);
428 CHECK(new_dict); 428 CHECK(new_dict);
429 scoped_ptr<base::Value> cur_value; 429 scoped_ptr<base::Value> cur_value;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 base::StringValue(shill::kErrorBadPassphrase))); 630 base::StringValue(shill::kErrorBadPassphrase)));
631 } else { 631 } else {
632 // Set Online. 632 // Set Online.
633 VLOG(1) << "Setting state to Online " << service_path; 633 VLOG(1) << "Setting state to Online " << service_path;
634 SetServiceProperty(service_path, shill::kStateProperty, 634 SetServiceProperty(service_path, shill::kStateProperty,
635 base::StringValue(shill::kStateOnline)); 635 base::StringValue(shill::kStateOnline));
636 } 636 }
637 } 637 }
638 638
639 } // namespace chromeos 639 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc ('k') | chromeos/dbus/session_manager_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698