Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Unified Diff: ui/shell_dialogs/certificate_viewer_dialog_win.h

Issue 61093002: Make certificate viewer non-modal using BaseShellDialog to fix aura painting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/shell_dialogs/DEPS ('k') | ui/shell_dialogs/certificate_viewer_dialog_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/shell_dialogs/certificate_viewer_dialog_win.h
diff --git a/ui/shell_dialogs/certificate_viewer_dialog_win.h b/ui/shell_dialogs/certificate_viewer_dialog_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8ce6e8640c89b25ef3288a147d6439424e30356
--- /dev/null
+++ b/ui/shell_dialogs/certificate_viewer_dialog_win.h
@@ -0,0 +1,72 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_SHELL_DIALOGS_CERTIFICATE_VIEWER_DIALOG_WIN_H_
+#define UI_SHELL_DIALOGS_CERTIFICATE_VIEWER_DIALOG_WIN_H_
+
+#include <windows.h>
+#include <cryptuiapi.h>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "base/message_loop/message_loop_proxy.h"
+#include "ui/shell_dialogs/base_shell_dialog_win.h"
+#include "ui/shell_dialogs/shell_dialogs_export.h"
+
+namespace net {
+class X509Certificate;
+}
+
+namespace ui {
+
+// A thin wrapper around the native certificate viewer dialog that uses
+// BaseShellDialog to have the dialog run on a background thread. This needs
+// to be on a background thread so that base::MessageLoop can keep running
+// and run delayed tasks (mostly importantly the gpu messages that do
+// painting).
+class SHELL_DIALOGS_EXPORT CertificateViewerDialogWin
+ : public BaseShellDialogImpl {
+ public:
+ // Called to open the certificate dialog on a background thread.
+ // |owning_window| is the parent HWND, and |certificate| is the certificate
+ // to be displayed.
+ static void Show(HWND owning_window, const net::X509Certificate& certificate);
+
+ private:
+ CertificateViewerDialogWin(HWND owning_window,
+ const net::X509Certificate& certificate);
+
+ // A struct for holding all the state necessary for displaying the
+ // certificate viewer dialog.
+ struct ExecuteCertificateViewerParams {
+ ExecuteCertificateViewerParams(RunState run_state,
+ HWND owner,
+ PCCERT_CONTEXT cert_list)
+ : run_state(run_state),
+ owner(owner),
+ cert_list(cert_list),
+ ui_proxy(base::MessageLoopForUI::current()->message_loop_proxy()) {}
+
+ RunState run_state;
+ HWND owner;
+ PCCERT_CONTEXT cert_list;
+ scoped_refptr<base::MessageLoopProxy> ui_proxy;
+ };
+
+ // Runs the certificate viewer dialog. Should be run on the the
+ // BaseShellDialogImpl thread. Posts back to CertificateViewerCompleted on
+ // the UI thread on completion.
+ void ExecuteCertificateViewer(const ExecuteCertificateViewerParams& params);
+
+ // Handler for the result of the certificate viewer dialog. Should be run on
+ // the UI thread.
+ void CertificateViewerCompleted(const ExecuteCertificateViewerParams& params);
+
+ DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogWin);
+};
+
+} // namespace ui
+
+#endif // UI_SHELL_DIALOGS_CERTIFICATE_VIEWER_DIALOG_WIN_H_
« no previous file with comments | « ui/shell_dialogs/DEPS ('k') | ui/shell_dialogs/certificate_viewer_dialog_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698