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

Side by Side Diff: chrome/browser/extensions/api/proxy/proxy_api_helpers.cc

Issue 2811673002: Reland: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Workaround with std::move Created 3 years, 8 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 // Implementation of helper functions for the Chrome Extensions Proxy Settings 5 // Implementation of helper functions for the Chrome Extensions Proxy Settings
6 // API. 6 // API.
7 // 7 //
8 // Throughout this code, we report errors to the user by setting an |error| 8 // Throughout this code, we report errors to the user by setting an |error|
9 // parameter, if and only if these errors can be cause by invalid input 9 // parameter, if and only if these errors can be cause by invalid input
10 // from the extension and we cannot expect that the extensions API has 10 // from the extension and we cannot expect that the extensions API has
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 case ProxyPrefs::MODE_AUTO_DETECT: 323 case ProxyPrefs::MODE_AUTO_DETECT:
324 result_proxy_config = ProxyConfigDictionary::CreateAutoDetect(); 324 result_proxy_config = ProxyConfigDictionary::CreateAutoDetect();
325 break; 325 break;
326 case ProxyPrefs::MODE_PAC_SCRIPT: { 326 case ProxyPrefs::MODE_PAC_SCRIPT: {
327 std::string url; 327 std::string url;
328 if (!pac_url.empty()) { 328 if (!pac_url.empty()) {
329 url = pac_url; 329 url = pac_url;
330 } else if (!pac_data.empty()) { 330 } else if (!pac_data.empty()) {
331 if (!CreateDataURLFromPACScript(pac_data, &url)) { 331 if (!CreateDataURLFromPACScript(pac_data, &url)) {
332 *error = "Internal error, at base64 encoding of 'pacScript.data'."; 332 *error = "Internal error, at base64 encoding of 'pacScript.data'.";
333 return NULL; 333 return nullptr;
334 } 334 }
335 } else { 335 } else {
336 *error = "Proxy mode 'pac_script' requires a 'pacScript' field with " 336 *error = "Proxy mode 'pac_script' requires a 'pacScript' field with "
337 "either a 'url' field or a 'data' field."; 337 "either a 'url' field or a 'data' field.";
338 return NULL; 338 return nullptr;
339 } 339 }
340 result_proxy_config = 340 result_proxy_config =
341 ProxyConfigDictionary::CreatePacScript(url, pac_mandatory); 341 ProxyConfigDictionary::CreatePacScript(url, pac_mandatory);
342 break; 342 break;
343 } 343 }
344 case ProxyPrefs::MODE_FIXED_SERVERS: { 344 case ProxyPrefs::MODE_FIXED_SERVERS: {
345 if (proxy_rules_string.empty()) { 345 if (proxy_rules_string.empty()) {
346 *error = "Proxy mode 'fixed_servers' requires a 'rules' field."; 346 *error = "Proxy mode 'fixed_servers' requires a 'rules' field.";
347 return NULL; 347 return nullptr;
348 } 348 }
349 result_proxy_config = ProxyConfigDictionary::CreateFixedServers( 349 result_proxy_config = ProxyConfigDictionary::CreateFixedServers(
350 proxy_rules_string, bypass_list); 350 proxy_rules_string, bypass_list);
351 break; 351 break;
352 } 352 }
353 case ProxyPrefs::MODE_SYSTEM: 353 case ProxyPrefs::MODE_SYSTEM:
354 result_proxy_config = ProxyConfigDictionary::CreateSystem(); 354 result_proxy_config = ProxyConfigDictionary::CreateSystem();
355 break; 355 break;
356 case ProxyPrefs::kModeCount: 356 case ProxyPrefs::kModeCount:
357 NOTREACHED(); 357 NOTREACHED();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 const std::string& delims) { 494 const std::string& delims) {
495 base::ListValue* out = new base::ListValue; 495 base::ListValue* out = new base::ListValue;
496 base::StringTokenizer entries(in, delims); 496 base::StringTokenizer entries(in, delims);
497 while (entries.GetNext()) 497 while (entries.GetNext())
498 out->AppendString(entries.token()); 498 out->AppendString(entries.token());
499 return out; 499 return out;
500 } 500 }
501 501
502 } // namespace proxy_api_helpers 502 } // namespace proxy_api_helpers
503 } // namespace extensions 503 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/proxy/proxy_api.cc ('k') | chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698