| 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 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 HCERTSTORE cert_store = cert_list->hCertStore; | 36 HCERTSTORE cert_store = cert_list->hCertStore; |
| 37 view_info.cStores = 1; | 37 view_info.cStores = 1; |
| 38 view_info.rghStores = &cert_store; | 38 view_info.rghStores = &cert_store; |
| 39 BOOL properties_changed; | 39 BOOL properties_changed; |
| 40 | 40 |
| 41 // We must allow nested tasks to dispatch so that, e.g. gpu tasks are | 41 // We must allow nested tasks to dispatch so that, e.g. gpu tasks are |
| 42 // processed for painting. This allows a second window to continue painting | 42 // processed for painting. This allows a second window to continue painting |
| 43 // while the the certificate dialog is open. | 43 // while the the certificate dialog is open. |
| 44 base::MessageLoop::ScopedNestableTaskAllower allow( | 44 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 45 base::MessageLoop::current()); | 45 base::MessageLoop::current()); |
| 46 |
| 47 // Tell the message loop to only handle certain types of messages while the |
| 48 // dialog is open to avoid bad things happening. See https://crbug.com/344012 |
| 49 // for details. |
| 50 base::MessageLoop::current()->set_os_modal_loop(true); |
| 46 // This next call blocks but keeps processing windows messages, making it | 51 // This next call blocks but keeps processing windows messages, making it |
| 47 // modal to the browser window. | 52 // modal to the browser window. |
| 48 ::CryptUIDlgViewCertificate(&view_info, &properties_changed); | 53 ::CryptUIDlgViewCertificate(&view_info, &properties_changed); |
| 49 | 54 |
| 55 base::MessageLoop::current()->set_os_modal_loop(false); |
| 50 CertFreeCertificateContext(cert_list); | 56 CertFreeCertificateContext(cert_list); |
| 51 } | 57 } |
| 52 | 58 |
| 53 } // namespace | 59 } // namespace |
| 54 | 60 |
| 55 void ShowCertificateViewer(content::WebContents* web_contents, | 61 void ShowCertificateViewer(content::WebContents* web_contents, |
| 56 gfx::NativeWindow parent, | 62 gfx::NativeWindow parent, |
| 57 net::X509Certificate* cert) { | 63 net::X509Certificate* cert) { |
| 58 if (chrome::GetHostDesktopTypeForNativeWindow(parent) != | 64 if (chrome::GetHostDesktopTypeForNativeWindow(parent) != |
| 59 chrome::HOST_DESKTOP_TYPE_ASH) { | 65 chrome::HOST_DESKTOP_TYPE_ASH) { |
| 60 ShowCertificateViewerImpl( | 66 ShowCertificateViewerImpl( |
| 61 web_contents, | 67 web_contents, |
| 62 parent->GetHost()->GetAcceleratedWidget(), cert); | 68 parent->GetHost()->GetAcceleratedWidget(), cert); |
| 63 } else { | 69 } else { |
| 64 NOTIMPLEMENTED(); | 70 NOTIMPLEMENTED(); |
| 65 } | 71 } |
| 66 } | 72 } |
| OLD | NEW |