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

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

Issue 86913002: Make base::Base64Encode() return void (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: One more chromeos-specific fix. Created 7 years 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 17 matching lines...) Expand all
28 namespace extensions { 28 namespace extensions {
29 29
30 namespace keys = proxy_api_constants; 30 namespace keys = proxy_api_constants;
31 31
32 namespace proxy_api_helpers { 32 namespace proxy_api_helpers {
33 33
34 bool CreateDataURLFromPACScript(const std::string& pac_script, 34 bool CreateDataURLFromPACScript(const std::string& pac_script,
35 std::string* pac_script_url_base64_encoded) { 35 std::string* pac_script_url_base64_encoded) {
36 // Encode pac_script in base64. 36 // Encode pac_script in base64.
37 std::string pac_script_base64_encoded; 37 std::string pac_script_base64_encoded;
38 if (!base::Base64Encode(pac_script, &pac_script_base64_encoded)) 38 base::Base64Encode(pac_script, &pac_script_base64_encoded);
39 return false;
40 39
41 // Make it a correct data url. 40 // Make it a correct data url.
42 *pac_script_url_base64_encoded = 41 *pac_script_url_base64_encoded =
43 std::string(keys::kPACDataUrlPrefix) + pac_script_base64_encoded; 42 std::string(keys::kPACDataUrlPrefix) + pac_script_base64_encoded;
44 return true; 43 return true;
45 } 44 }
46 45
47 bool CreatePACScriptFromDataURL( 46 bool CreatePACScriptFromDataURL(
48 const std::string& pac_script_url_base64_encoded, 47 const std::string& pac_script_url_base64_encoded,
49 std::string* pac_script) { 48 std::string* pac_script) {
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 const std::string& delims) { 488 const std::string& delims) {
490 base::ListValue* out = new base::ListValue; 489 base::ListValue* out = new base::ListValue;
491 base::StringTokenizer entries(in, delims); 490 base::StringTokenizer entries(in, delims);
492 while (entries.GetNext()) 491 while (entries.GetNext())
493 out->Append(new base::StringValue(entries.token())); 492 out->Append(new base::StringValue(entries.token()));
494 return out; 493 return out;
495 } 494 }
496 495
497 } // namespace proxy_api_helpers 496 } // namespace proxy_api_helpers
498 } // namespace extensions 497 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698