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

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: 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..53a35ae155589f2bbbf6773776e276a70b6e4aa3
--- /dev/null
+++ b/ui/shell_dialogs/certificate_viewer_dialog_win.h
@@ -0,0 +1,69 @@
+// 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.
+class SHELL_DIALOGS_EXPORT CertificateViewerDialogWin
sky 2013/11/05 22:34:03 Document why this runs on a background thread.
scottmg 2013/11/05 23:40:33 Done, and updated CL description.
+ : 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, net::X509Certificate* certificate);
sky 2013/11/05 22:34:03 Can this take a const net::X509C& ?
scottmg 2013/11/05 23:40:33 Done.
+
+ private:
+ CertificateViewerDialogWin(HWND owning_window,
+ 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;
sky 2013/11/05 22:34:03 Does this need to be freed? And is this tied to th
scottmg 2013/11/05 23:40:33 Yes, it does. It's freed in CertificateViewerCompl
Ryan Sleevi 2013/11/06 22:47:50 Correct, it copies into a new one, since the dialo
+ 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