| 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_
|
|
|