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

Side by Side Diff: chrome/browser/chromeos/proxy_cros_settings_parser.cc

Issue 1220963005: Update base::StartsWith calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: 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 (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 "chrome/browser/chromeos/proxy_cros_settings_parser.h" 5 #include "chrome/browser/chromeos/proxy_cros_settings_parser.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/chromeos/ui_proxy_config.h" 9 #include "chrome/browser/chromeos/ui_proxy_config.h"
10 #include "chrome/browser/chromeos/ui_proxy_config_service.h" 10 #include "chrome/browser/chromeos/ui_proxy_config_service.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (proxy.server.is_valid()) 105 if (proxy.server.is_valid())
106 host = proxy.server.host_port_pair().host(); 106 host = proxy.server.host_port_pair().host();
107 return CreateProxyServer(host, port, scheme); 107 return CreateProxyServer(host, port, scheme);
108 } 108 }
109 109
110 } // namespace 110 } // namespace
111 111
112 namespace proxy_cros_settings_parser { 112 namespace proxy_cros_settings_parser {
113 113
114 bool IsProxyPref(const std::string& path) { 114 bool IsProxyPref(const std::string& path) {
115 return base::StartsWithASCII(path, kProxyPrefsPrefix, true); 115 return base::StartsWith(path, kProxyPrefsPrefix,
116 base::CompareCase::SENSITIVE);
116 } 117 }
117 118
118 void SetProxyPrefValue(const std::string& path, 119 void SetProxyPrefValue(const std::string& path,
119 const base::Value* in_value, 120 const base::Value* in_value,
120 UIProxyConfigService* config_service) { 121 UIProxyConfigService* config_service) {
121 if (!in_value) { 122 if (!in_value) {
122 NOTREACHED(); 123 NOTREACHED();
123 return; 124 return;
124 } 125 }
125 126
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 config.SetProxyForScheme( 242 config.SetProxyForScheme(
242 "ftp", CreateProxyServerFromPort( 243 "ftp", CreateProxyServerFromPort(
243 val, config.ftp_proxy, net::ProxyServer::SCHEME_HTTP)); 244 val, config.ftp_proxy, net::ProxyServer::SCHEME_HTTP));
244 } 245 }
245 } else if (path == kProxySocks) { 246 } else if (path == kProxySocks) {
246 std::string val; 247 std::string val;
247 if (in_value->GetAsString(&val)) { 248 if (in_value->GetAsString(&val)) {
248 config.SetProxyForScheme( 249 config.SetProxyForScheme(
249 "socks", CreateProxyServerFromHost( 250 "socks", CreateProxyServerFromHost(
250 val, config.socks_proxy, 251 val, config.socks_proxy,
251 base::StartsWithASCII(val, "socks5://", false) 252 base::StartsWith(val, "socks5://",
253 base::CompareCase::INSENSITIVE_ASCII)
252 ? net::ProxyServer::SCHEME_SOCKS5 254 ? net::ProxyServer::SCHEME_SOCKS5
253 : net::ProxyServer::SCHEME_SOCKS4)); 255 : net::ProxyServer::SCHEME_SOCKS4));
254 } 256 }
255 } else if (path == kProxySocksPort) { 257 } else if (path == kProxySocksPort) {
256 int val; 258 int val;
257 if (in_value->GetAsInteger(&val)) { 259 if (in_value->GetAsInteger(&val)) {
258 std::string host = config.socks_proxy.server.host_port_pair().host(); 260 std::string host = config.socks_proxy.server.host_port_pair().host();
259 config.SetProxyForScheme( 261 config.SetProxyForScheme(
260 "socks", CreateProxyServerFromPort( 262 "socks", CreateProxyServerFromPort(
261 val, config.socks_proxy, 263 val, config.socks_proxy,
262 base::StartsWithASCII(host, "socks5://", false) 264 base::StartsWith(host, "socks5://",
265 base::CompareCase::INSENSITIVE_ASCII)
263 ? net::ProxyServer::SCHEME_SOCKS5 266 ? net::ProxyServer::SCHEME_SOCKS5
264 : net::ProxyServer::SCHEME_SOCKS4)); 267 : net::ProxyServer::SCHEME_SOCKS4));
265 } 268 }
266 } else if (path == kProxyIgnoreList) { 269 } else if (path == kProxyIgnoreList) {
267 net::ProxyBypassRules bypass_rules; 270 net::ProxyBypassRules bypass_rules;
268 if (in_value->GetType() == base::Value::TYPE_LIST) { 271 if (in_value->GetType() == base::Value::TYPE_LIST) {
269 const base::ListValue* list_value = 272 const base::ListValue* list_value =
270 static_cast<const base::ListValue*>(in_value); 273 static_cast<const base::ListValue*>(in_value);
271 for (size_t x = 0; x < list_value->GetSize(); x++) { 274 for (size_t x = 0; x < list_value->GetSize(); x++) {
272 std::string val; 275 std::string val;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } else { 374 } else {
372 dict->SetBoolean("disabled", false); 375 dict->SetBoolean("disabled", false);
373 } 376 }
374 *out_value = dict; 377 *out_value = dict;
375 return true; 378 return true;
376 } 379 }
377 380
378 } // namespace proxy_cros_settings_parser 381 } // namespace proxy_cros_settings_parser
379 382
380 } // namespace chromeos 383 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698