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

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

Issue 101113004: Revert 239759 "The comment in base64.h implies that base::Base64..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | Annotate | Revision Log
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 base::Base64Encode(pac_script, &pac_script_base64_encoded); 38 if (!base::Base64Encode(pac_script, &pac_script_base64_encoded))
39 return false;
39 40
40 // Make it a correct data url. 41 // Make it a correct data url.
41 *pac_script_url_base64_encoded = 42 *pac_script_url_base64_encoded =
42 std::string(keys::kPACDataUrlPrefix) + pac_script_base64_encoded; 43 std::string(keys::kPACDataUrlPrefix) + pac_script_base64_encoded;
43 return true; 44 return true;
44 } 45 }
45 46
46 bool CreatePACScriptFromDataURL( 47 bool CreatePACScriptFromDataURL(
47 const std::string& pac_script_url_base64_encoded, 48 const std::string& pac_script_url_base64_encoded,
48 std::string* pac_script) { 49 std::string* pac_script) {
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 const std::string& delims) { 489 const std::string& delims) {
489 base::ListValue* out = new base::ListValue; 490 base::ListValue* out = new base::ListValue;
490 base::StringTokenizer entries(in, delims); 491 base::StringTokenizer entries(in, delims);
491 while (entries.GetNext()) 492 while (entries.GetNext())
492 out->Append(new base::StringValue(entries.token())); 493 out->Append(new base::StringValue(entries.token()));
493 return out; 494 return out;
494 } 495 }
495 496
496 } // namespace proxy_api_helpers 497 } // namespace proxy_api_helpers
497 } // namespace extensions 498 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698