OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/certificate_viewer.h" | 5 #include "chrome/browser/certificate_viewer.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <cryptuiapi.h> | 8 #include <cryptuiapi.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/task_runner.h" | 16 #include "base/task_runner.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
19 #include "net/cert/x509_certificate.h" | 19 #include "net/cert/x509_certificate.h" |
20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
21 #include "ui/aura/window_tree_host.h" | 21 #include "ui/aura/window_tree_host.h" |
22 #include "ui/shell_dialogs/base_shell_dialog_win.h" | 22 #include "ui/shell_dialogs/base_shell_dialog_win.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Shows a Windows certificate viewer dialog on a background thread to avoid | 26 // Shows a Windows certificate viewer dialog on a background thread to avoid |
27 // nested message loops. | 27 // nested run loops. |
28 class CertificateViewerDialog : public ui::BaseShellDialogImpl { | 28 class CertificateViewerDialog : public ui::BaseShellDialogImpl { |
29 public: | 29 public: |
30 CertificateViewerDialog() {} | 30 CertificateViewerDialog() {} |
31 | 31 |
32 // Shows the dialog and calls |callback| when the dialog closes. The caller | 32 // Shows the dialog and calls |callback| when the dialog closes. The caller |
33 // must ensure the CertificateViewerDialog remains valid until then. | 33 // must ensure the CertificateViewerDialog remains valid until then. |
34 void Show(HWND parent, | 34 void Show(HWND parent, |
35 net::X509Certificate* cert, | 35 net::X509Certificate* cert, |
36 const base::Closure& callback) { | 36 const base::Closure& callback) { |
37 if (IsRunningDialogForOwner(parent)) { | 37 if (IsRunningDialogForOwner(parent)) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } // namespace | 85 } // namespace |
86 | 86 |
87 void ShowCertificateViewer(content::WebContents* web_contents, | 87 void ShowCertificateViewer(content::WebContents* web_contents, |
88 gfx::NativeWindow parent, | 88 gfx::NativeWindow parent, |
89 net::X509Certificate* cert) { | 89 net::X509Certificate* cert) { |
90 CertificateViewerDialog* dialog = new CertificateViewerDialog; | 90 CertificateViewerDialog* dialog = new CertificateViewerDialog; |
91 dialog->Show( | 91 dialog->Show( |
92 parent->GetHost()->GetAcceleratedWidget(), cert, | 92 parent->GetHost()->GetAcceleratedWidget(), cert, |
93 base::Bind(&base::DeletePointer<CertificateViewerDialog>, dialog)); | 93 base::Bind(&base::DeletePointer<CertificateViewerDialog>, dialog)); |
94 } | 94 } |
OLD | NEW |