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

Side by Side Diff: trunk/src/chrome/browser/ui/certificate_dialogs.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 #include "chrome/browser/ui/certificate_dialogs.h" 5 #include "chrome/browser/ui/certificate_dialogs.h"
6 6
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 std::string result; 42 std::string result;
43 for (size_t i = 0; i < str.size(); i += 64) { 43 for (size_t i = 0; i < str.size(); i += 64) {
44 result.append(str, i, 64); // Append clamps the len arg internally. 44 result.append(str, i, 64); // Append clamps the len arg internally.
45 result.append("\r\n"); 45 result.append("\r\n");
46 } 46 }
47 return result; 47 return result;
48 } 48 }
49 49
50 std::string GetBase64String(net::X509Certificate::OSCertHandle cert) { 50 std::string GetBase64String(net::X509Certificate::OSCertHandle cert) {
51 std::string base64; 51 std::string base64;
52 base::Base64Encode(x509_certificate_model::GetDerString(cert), &base64); 52 if (!base::Base64Encode(
53 x509_certificate_model::GetDerString(cert), &base64)) {
54 LOG(ERROR) << "base64 encoding error";
55 return std::string();
56 }
53 return "-----BEGIN CERTIFICATE-----\r\n" + 57 return "-----BEGIN CERTIFICATE-----\r\n" +
54 WrapAt64(base64) + 58 WrapAt64(base64) +
55 "-----END CERTIFICATE-----\r\n"; 59 "-----END CERTIFICATE-----\r\n";
56 } 60 }
57 61
58 //////////////////////////////////////////////////////////////////////////////// 62 ////////////////////////////////////////////////////////////////////////////////
59 // General utility functions. 63 // General utility functions.
60 64
61 class Exporter : public ui::SelectFileDialog::Listener { 65 class Exporter : public ui::SelectFileDialog::Listener {
62 public: 66 public:
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 1, // 1-based index for |file_type_info.extensions| to specify default. 176 1, // 1-based index for |file_type_info.extensions| to specify default.
173 FILE_PATH_LITERAL("crt"), 177 FILE_PATH_LITERAL("crt"),
174 parent, params); 178 parent, params);
175 } 179 }
176 180
177 void ShowCertExportDialog(WebContents* web_contents, 181 void ShowCertExportDialog(WebContents* web_contents,
178 gfx::NativeWindow parent, 182 gfx::NativeWindow parent,
179 net::X509Certificate::OSCertHandle cert) { 183 net::X509Certificate::OSCertHandle cert) {
180 new Exporter(web_contents, parent, cert); 184 new Exporter(web_contents, parent, cert);
181 } 185 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698