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 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "chrome/browser/ui/chrome_select_file_policy.h" | 15 #include "chrome/browser/ui/chrome_select_file_policy.h" |
16 #include "chrome/common/net/x509_certificate_model.h" | 16 #include "chrome/common/net/x509_certificate_model.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
20 #include "ui/shell_dialogs/select_file_dialog.h" | 20 #include "ui/shell_dialogs/select_file_dialog.h" |
21 | 21 |
22 using content::BrowserThread; | 22 using content::BrowserThread; |
23 using content::WebContents; | 23 using content::WebContents; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 void WriterCallback(const base::FilePath& path, const std::string& data) { | 27 void WriterCallback(const base::FilePath& path, const std::string& data) { |
28 int bytes_written = file_util::WriteFile(path, data.data(), data.size()); | 28 int bytes_written = base::WriteFile(path, data.data(), data.size()); |
29 if (bytes_written != static_cast<ssize_t>(data.size())) { | 29 if (bytes_written != static_cast<ssize_t>(data.size())) { |
30 LOG(ERROR) << "Writing " << path.value() << " (" | 30 LOG(ERROR) << "Writing " << path.value() << " (" |
31 << data.size() << "B) returned " << bytes_written; | 31 << data.size() << "B) returned " << bytes_written; |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 void WriteFileOnFileThread(const base::FilePath& path, | 35 void WriteFileOnFileThread(const base::FilePath& path, |
36 const std::string& data) { | 36 const std::string& data) { |
37 BrowserThread::PostTask( | 37 BrowserThread::PostTask( |
38 BrowserThread::FILE, FROM_HERE, base::Bind(&WriterCallback, path, data)); | 38 BrowserThread::FILE, FROM_HERE, base::Bind(&WriterCallback, path, data)); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 1, // 1-based index for |file_type_info.extensions| to specify default. | 172 1, // 1-based index for |file_type_info.extensions| to specify default. |
173 FILE_PATH_LITERAL("crt"), | 173 FILE_PATH_LITERAL("crt"), |
174 parent, params); | 174 parent, params); |
175 } | 175 } |
176 | 176 |
177 void ShowCertExportDialog(WebContents* web_contents, | 177 void ShowCertExportDialog(WebContents* web_contents, |
178 gfx::NativeWindow parent, | 178 gfx::NativeWindow parent, |
179 net::X509Certificate::OSCertHandle cert) { | 179 net::X509Certificate::OSCertHandle cert) { |
180 new Exporter(web_contents, parent, cert); | 180 new Exporter(web_contents, parent, cert); |
181 } | 181 } |
OLD | NEW |