Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_SHELL_DIALOGS_CERTIFICATE_VIEWER_DIALOG_WIN_H_ | |
| 6 #define UI_SHELL_DIALOGS_CERTIFICATE_VIEWER_DIALOG_WIN_H_ | |
| 7 | |
| 8 #include <windows.h> | |
| 9 #include <cryptuiapi.h> | |
| 10 | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/message_loop/message_loop.h" | |
| 14 #include "base/message_loop/message_loop_proxy.h" | |
| 15 #include "ui/shell_dialogs/base_shell_dialog_win.h" | |
| 16 #include "ui/shell_dialogs/shell_dialogs_export.h" | |
| 17 | |
| 18 namespace net { | |
| 19 class X509Certificate; | |
| 20 } | |
| 21 | |
| 22 namespace ui { | |
| 23 | |
| 24 // A thin wrapper around the native certificate viewer dialog that uses | |
| 25 // BaseShellDialog to have the dialog run on a background thread. | |
| 26 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.
| |
| 27 : public BaseShellDialogImpl { | |
| 28 public: | |
| 29 // Called to open the certificate dialog on a background thread. | |
| 30 // |owning_window| is the parent HWND, and |certificate| is the certificate | |
| 31 // to be displayed. | |
| 32 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.
| |
| 33 | |
| 34 private: | |
| 35 CertificateViewerDialogWin(HWND owning_window, | |
| 36 net::X509Certificate* certificate); | |
| 37 | |
| 38 // A struct for holding all the state necessary for displaying the | |
| 39 // certificate viewer dialog. | |
| 40 struct ExecuteCertificateViewerParams { | |
| 41 ExecuteCertificateViewerParams(RunState run_state, | |
| 42 HWND owner, | |
| 43 PCCERT_CONTEXT cert_list) | |
| 44 : run_state(run_state), | |
| 45 owner(owner), | |
| 46 cert_list(cert_list), | |
| 47 ui_proxy(base::MessageLoopForUI::current()->message_loop_proxy()) {} | |
| 48 | |
| 49 RunState run_state; | |
| 50 HWND owner; | |
| 51 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
| |
| 52 scoped_refptr<base::MessageLoopProxy> ui_proxy; | |
| 53 }; | |
| 54 | |
| 55 // Runs the certificate viewer dialog. Should be run on the the | |
| 56 // BaseShellDialogImpl thread. Posts back to CertificateViewerCompleted on | |
| 57 // the UI thread on completion. | |
| 58 void ExecuteCertificateViewer(const ExecuteCertificateViewerParams& params); | |
| 59 | |
| 60 // Handler for the result of the certificate viewer dialog. Should be run on | |
| 61 // the UI thread. | |
| 62 void CertificateViewerCompleted(const ExecuteCertificateViewerParams& params); | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogWin); | |
| 65 }; | |
| 66 | |
| 67 } // namespace ui | |
| 68 | |
| 69 #endif // UI_SHELL_DIALOGS_CERTIFICATE_VIEWER_DIALOG_WIN_H_ | |
| OLD | NEW |