OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "components/web_modal/native_web_contents_modal_dialog.h" | |
14 #include "content/public/browser/web_ui_message_handler.h" | 13 #include "content/public/browser/web_ui_message_handler.h" |
15 #include "net/cert/x509_certificate.h" | 14 #include "net/cert/x509_certificate.h" |
16 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/web_dialogs/web_dialog_delegate.h" | 16 #include "ui/web_dialogs/web_dialog_delegate.h" |
18 | 17 |
19 namespace content { | 18 namespace content { |
20 class WebContents; | 19 class WebContents; |
21 } | 20 } |
22 | 21 |
23 class ConstrainedWebDialogDelegate; | 22 class ConstrainedWebDialogDelegate; |
24 | 23 |
25 // Modal dialog for displaying detailed certificate information. This is used in | 24 // Modal dialog for displaying detailed certificate information. This is used in |
26 // chromeos builds to display detailed information in a modal dialog when the | 25 // chromeos builds to display detailed information in a modal dialog when the |
27 // user clicks on "View" from the Certificate Manager dialog. | 26 // user clicks on "View" from the Certificate Manager dialog. |
28 class CertificateViewerModalDialog : public ui::WebDialogDelegate { | 27 class CertificateViewerModalDialog : public ui::WebDialogDelegate { |
29 public: | 28 public: |
30 // Construct a certificate viewer for the passed in certificate. A reference | 29 // Construct a certificate viewer for the passed in certificate. A reference |
31 // to the certificate pointer is added for the lifetime of the certificate | 30 // to the certificate pointer is added for the lifetime of the certificate |
32 // viewer. | 31 // viewer. |
33 explicit CertificateViewerModalDialog( | 32 explicit CertificateViewerModalDialog( |
34 net::X509Certificate* cert); | 33 net::X509Certificate* cert); |
35 ~CertificateViewerModalDialog() override; | 34 ~CertificateViewerModalDialog() override; |
36 | 35 |
37 virtual void Show(content::WebContents* web_contents, | 36 virtual void Show(content::WebContents* web_contents, |
38 gfx::NativeWindow parent); | 37 gfx::NativeWindow parent); |
39 virtual web_modal::NativeWebContentsModalDialog | 38 virtual gfx::NativeWindow GetNativeWebContentsModalDialog(); |
40 GetNativeWebContentsModalDialog(); | |
41 const content::WebUI* GetWebUI() const { return webui_; } | 39 const content::WebUI* GetWebUI() const { return webui_; } |
42 | 40 |
43 protected: | 41 protected: |
44 // Overridden from ui::WebDialogDelegate: | 42 // Overridden from ui::WebDialogDelegate: |
45 ui::ModalType GetDialogModalType() const override; | 43 ui::ModalType GetDialogModalType() const override; |
46 base::string16 GetDialogTitle() const override; | 44 base::string16 GetDialogTitle() const override; |
47 GURL GetDialogContentURL() const override; | 45 GURL GetDialogContentURL() const override; |
48 void GetWebUIMessageHandlers( | 46 void GetWebUIMessageHandlers( |
49 std::vector<content::WebUIMessageHandler*>* handlers) const override; | 47 std::vector<content::WebUIMessageHandler*>* handlers) const override; |
50 void GetDialogSize(gfx::Size* size) const override; | 48 void GetDialogSize(gfx::Size* size) const override; |
(...skipping 25 matching lines...) Expand all Loading... |
76 public: | 74 public: |
77 // Construct a certificate viewer for the passed in certificate. A reference | 75 // Construct a certificate viewer for the passed in certificate. A reference |
78 // to the certificate pointer is added for the lifetime of the certificate | 76 // to the certificate pointer is added for the lifetime of the certificate |
79 // viewer. | 77 // viewer. |
80 explicit CertificateViewerDialog(net::X509Certificate* cert); | 78 explicit CertificateViewerDialog(net::X509Certificate* cert); |
81 ~CertificateViewerDialog() override; | 79 ~CertificateViewerDialog() override; |
82 | 80 |
83 // CertificateViewerModalDialog overrides. | 81 // CertificateViewerModalDialog overrides. |
84 void Show(content::WebContents* web_contents, | 82 void Show(content::WebContents* web_contents, |
85 gfx::NativeWindow parent) override; | 83 gfx::NativeWindow parent) override; |
86 web_modal::NativeWebContentsModalDialog GetNativeWebContentsModalDialog() | 84 gfx::NativeWindow GetNativeWebContentsModalDialog() override; |
87 override; | |
88 | 85 |
89 protected: | 86 protected: |
90 // Overridden from ui::WebDialogDelegate: | 87 // Overridden from ui::WebDialogDelegate: |
91 GURL GetDialogContentURL() const override; | 88 GURL GetDialogContentURL() const override; |
92 ui::ModalType GetDialogModalType() const override; | 89 ui::ModalType GetDialogModalType() const override; |
93 | 90 |
94 private: | 91 private: |
95 ConstrainedWebDialogDelegate* dialog_; | 92 ConstrainedWebDialogDelegate* dialog_; |
96 | 93 |
97 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); | 94 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 CertificateViewerModalDialog* dialog_; | 130 CertificateViewerModalDialog* dialog_; |
134 | 131 |
135 // The certificate chain. Does not take references, so only valid as long as | 132 // The certificate chain. Does not take references, so only valid as long as |
136 // |cert_| is. | 133 // |cert_| is. |
137 net::X509Certificate::OSCertHandles cert_chain_; | 134 net::X509Certificate::OSCertHandles cert_chain_; |
138 | 135 |
139 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); | 136 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); |
140 }; | 137 }; |
141 | 138 |
142 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ | 139 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ |
OLD | NEW |