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 #pragma comment(lib, "cryptui.lib") | 9 #pragma comment(lib, "cryptui.lib") |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop/message_loop.h" |
12 #include "net/cert/x509_certificate.h" | 13 #include "net/cert/x509_certificate.h" |
13 | 14 |
14 #if defined(USE_AURA) | 15 #if defined(USE_AURA) |
15 #include "chrome/browser/ui/host_desktop.h" | 16 #include "chrome/browser/ui/host_desktop.h" |
16 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
17 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
18 #endif | 19 #endif |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
(...skipping 11 matching lines...) Expand all Loading... |
33 // in CryptUIDlgViewCertificate modal to the browser. | 34 // in CryptUIDlgViewCertificate modal to the browser. |
34 view_info.hwndParent = parent; | 35 view_info.hwndParent = parent; |
35 view_info.dwFlags = CRYPTUI_DISABLE_EDITPROPERTIES | | 36 view_info.dwFlags = CRYPTUI_DISABLE_EDITPROPERTIES | |
36 CRYPTUI_DISABLE_ADDTOSTORE; | 37 CRYPTUI_DISABLE_ADDTOSTORE; |
37 view_info.pCertContext = cert_list; | 38 view_info.pCertContext = cert_list; |
38 HCERTSTORE cert_store = cert_list->hCertStore; | 39 HCERTSTORE cert_store = cert_list->hCertStore; |
39 view_info.cStores = 1; | 40 view_info.cStores = 1; |
40 view_info.rghStores = &cert_store; | 41 view_info.rghStores = &cert_store; |
41 BOOL properties_changed; | 42 BOOL properties_changed; |
42 | 43 |
| 44 // We must allow nested tasks to dispatch so that, e.g. gpu tasks are |
| 45 // processed for painting. This allows a second window to continue painting |
| 46 // while the the certificate dialog is open. |
| 47 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 48 base::MessageLoop::current()); |
43 // This next call blocks but keeps processing windows messages, making it | 49 // This next call blocks but keeps processing windows messages, making it |
44 // modal to the browser window. | 50 // modal to the browser window. |
45 BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed); | 51 BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed); |
46 | 52 |
47 CertFreeCertificateContext(cert_list); | 53 CertFreeCertificateContext(cert_list); |
48 } | 54 } |
49 | 55 |
50 } // namespace | 56 } // namespace |
51 | 57 |
52 #if defined(USE_AURA) | 58 #if defined(USE_AURA) |
53 void ShowCertificateViewer(content::WebContents* web_contents, | 59 void ShowCertificateViewer(content::WebContents* web_contents, |
54 gfx::NativeWindow parent, | 60 gfx::NativeWindow parent, |
55 net::X509Certificate* cert) { | 61 net::X509Certificate* cert) { |
56 if (chrome::GetHostDesktopTypeForNativeWindow(parent) != | 62 if (chrome::GetHostDesktopTypeForNativeWindow(parent) != |
57 chrome::HOST_DESKTOP_TYPE_ASH) { | 63 chrome::HOST_DESKTOP_TYPE_ASH) { |
58 ShowCertificateViewerImpl( | 64 ShowCertificateViewerImpl( |
59 web_contents, parent->GetDispatcher()->GetAcceleratedWidget(), cert); | 65 web_contents, parent->GetDispatcher()->GetAcceleratedWidget(), cert); |
60 } else { | 66 } else { |
61 NOTIMPLEMENTED(); | 67 NOTIMPLEMENTED(); |
62 } | 68 } |
63 } | 69 } |
64 #else | 70 #else |
65 void ShowCertificateViewer(content::WebContents* web_contents, | 71 void ShowCertificateViewer(content::WebContents* web_contents, |
66 gfx::NativeWindow parent, | 72 gfx::NativeWindow parent, |
67 net::X509Certificate* cert) { | 73 net::X509Certificate* cert) { |
68 ShowCertificateViewerImpl(web_contents, parent, cert); | 74 ShowCertificateViewerImpl(web_contents, parent, cert); |
69 } | 75 } |
70 #endif | 76 #endif |
OLD | NEW |