OLD | NEW |
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 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 20 matching lines...) Expand all Loading... |
31 void WriterCallback(const base::FilePath& path, const std::string& data) { | 31 void WriterCallback(const base::FilePath& path, const std::string& data) { |
32 int bytes_written = base::WriteFile(path, data.data(), data.size()); | 32 int bytes_written = base::WriteFile(path, data.data(), data.size()); |
33 if (bytes_written != static_cast<ssize_t>(data.size())) { | 33 if (bytes_written != static_cast<ssize_t>(data.size())) { |
34 LOG(ERROR) << "Writing " << path.value() << " (" | 34 LOG(ERROR) << "Writing " << path.value() << " (" |
35 << data.size() << "B) returned " << bytes_written; | 35 << data.size() << "B) returned " << bytes_written; |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 void WriteFileOnFileThread(const base::FilePath& path, | 39 void WriteFileOnFileThread(const base::FilePath& path, |
40 const std::string& data) { | 40 const std::string& data) { |
41 BrowserThread::PostTask( | 41 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
42 BrowserThread::FILE, FROM_HERE, base::Bind(&WriterCallback, path, data)); | 42 base::BindOnce(&WriterCallback, path, data)); |
43 } | 43 } |
44 | 44 |
45 std::string WrapAt64(const std::string &str) { | 45 std::string WrapAt64(const std::string &str) { |
46 std::string result; | 46 std::string result; |
47 for (size_t i = 0; i < str.size(); i += 64) { | 47 for (size_t i = 0; i < str.size(); i += 64) { |
48 result.append(str, i, 64); // Append clamps the len arg internally. | 48 result.append(str, i, 64); // Append clamps the len arg internally. |
49 result.append("\r\n"); | 49 result.append("\r\n"); |
50 } | 50 } |
51 return result; | 51 return result; |
52 } | 52 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 new Exporter(web_contents, parent, cert_chain.begin(), cert_chain.end()); | 209 new Exporter(web_contents, parent, cert_chain.begin(), cert_chain.end()); |
210 } | 210 } |
211 | 211 |
212 void ShowCertExportDialog( | 212 void ShowCertExportDialog( |
213 content::WebContents* web_contents, | 213 content::WebContents* web_contents, |
214 gfx::NativeWindow parent, | 214 gfx::NativeWindow parent, |
215 net::X509Certificate::OSCertHandles::iterator certs_begin, | 215 net::X509Certificate::OSCertHandles::iterator certs_begin, |
216 net::X509Certificate::OSCertHandles::iterator certs_end) { | 216 net::X509Certificate::OSCertHandles::iterator certs_end) { |
217 new Exporter(web_contents, parent, certs_begin, certs_end); | 217 new Exporter(web_contents, parent, certs_begin, certs_end); |
218 } | 218 } |
OLD | NEW |