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 |
(...skipping 14 matching lines...) Expand all Loading... |
25 // Modal dialog for displaying detailed certificate information. This is used in | 25 // Modal dialog for displaying detailed certificate information. This is used in |
26 // chromeos builds to display detailed information in a modal dialog when the | 26 // chromeos builds to display detailed information in a modal dialog when the |
27 // user clicks on "View" from the Certificate Manager dialog. | 27 // user clicks on "View" from the Certificate Manager dialog. |
28 class CertificateViewerModalDialog : public ui::WebDialogDelegate { | 28 class CertificateViewerModalDialog : public ui::WebDialogDelegate { |
29 public: | 29 public: |
30 // Construct a certificate viewer for the passed in certificate. A reference | 30 // Construct a certificate viewer for the passed in certificate. A reference |
31 // to the certificate pointer is added for the lifetime of the certificate | 31 // to the certificate pointer is added for the lifetime of the certificate |
32 // viewer. | 32 // viewer. |
33 explicit CertificateViewerModalDialog( | 33 explicit CertificateViewerModalDialog( |
34 net::X509Certificate* cert); | 34 net::X509Certificate* cert); |
35 virtual ~CertificateViewerModalDialog(); | 35 ~CertificateViewerModalDialog() override; |
36 | 36 |
37 virtual void Show(content::WebContents* web_contents, | 37 virtual void Show(content::WebContents* web_contents, |
38 gfx::NativeWindow parent); | 38 gfx::NativeWindow parent); |
39 virtual web_modal::NativeWebContentsModalDialog | 39 virtual web_modal::NativeWebContentsModalDialog |
40 GetNativeWebContentsModalDialog(); | 40 GetNativeWebContentsModalDialog(); |
41 const content::WebUI* GetWebUI() const { return webui_; } | 41 const content::WebUI* GetWebUI() const { return webui_; } |
42 | 42 |
43 protected: | 43 protected: |
44 // Overridden from ui::WebDialogDelegate: | 44 // Overridden from ui::WebDialogDelegate: |
45 virtual ui::ModalType GetDialogModalType() const override; | 45 ui::ModalType GetDialogModalType() const override; |
46 virtual base::string16 GetDialogTitle() const override; | 46 base::string16 GetDialogTitle() const override; |
47 virtual GURL GetDialogContentURL() const override; | 47 GURL GetDialogContentURL() const override; |
48 virtual void GetWebUIMessageHandlers( | 48 void GetWebUIMessageHandlers( |
49 std::vector<content::WebUIMessageHandler*>* handlers) const override; | 49 std::vector<content::WebUIMessageHandler*>* handlers) const override; |
50 virtual void GetDialogSize(gfx::Size* size) const override; | 50 void GetDialogSize(gfx::Size* size) const override; |
51 virtual std::string GetDialogArgs() const override; | 51 std::string GetDialogArgs() const override; |
52 virtual void OnDialogShown( | 52 void OnDialogShown(content::WebUI* webui, |
53 content::WebUI* webui, | 53 content::RenderViewHost* render_view_host) override; |
54 content::RenderViewHost* render_view_host) override; | 54 void OnDialogClosed(const std::string& json_retval) override; |
55 virtual void OnDialogClosed(const std::string& json_retval) override; | 55 void OnCloseContents(content::WebContents* source, |
56 virtual void OnCloseContents( | 56 bool* out_close_dialog) override; |
57 content::WebContents* source, bool* out_close_dialog) override; | 57 bool ShouldShowDialogTitle() const override; |
58 virtual bool ShouldShowDialogTitle() const override; | |
59 | 58 |
60 // The certificate being viewed. | 59 // The certificate being viewed. |
61 scoped_refptr<net::X509Certificate> cert_; | 60 scoped_refptr<net::X509Certificate> cert_; |
62 | 61 |
63 // The title of the certificate viewer dialog, Certificate Viewer: CN. | 62 // The title of the certificate viewer dialog, Certificate Viewer: CN. |
64 base::string16 title_; | 63 base::string16 title_; |
65 | 64 |
66 private: | 65 private: |
67 content::WebUI* webui_; | 66 content::WebUI* webui_; |
68 gfx::NativeWindow window_; | 67 gfx::NativeWindow window_; |
69 DISALLOW_COPY_AND_ASSIGN(CertificateViewerModalDialog); | 68 DISALLOW_COPY_AND_ASSIGN(CertificateViewerModalDialog); |
70 }; | 69 }; |
71 | 70 |
72 // Dialog for displaying detailed certificate information. This is used in linux | 71 // Dialog for displaying detailed certificate information. This is used in linux |
73 // and chromeos builds to display detailed information in a floating dialog when | 72 // and chromeos builds to display detailed information in a floating dialog when |
74 // the user clicks on "Certificate Information" from the lock icon of a web site | 73 // the user clicks on "Certificate Information" from the lock icon of a web site |
75 // or "View" from the Certificate Manager. | 74 // or "View" from the Certificate Manager. |
76 class CertificateViewerDialog : public CertificateViewerModalDialog { | 75 class CertificateViewerDialog : public CertificateViewerModalDialog { |
77 public: | 76 public: |
78 // Construct a certificate viewer for the passed in certificate. A reference | 77 // Construct a certificate viewer for the passed in certificate. A reference |
79 // to the certificate pointer is added for the lifetime of the certificate | 78 // to the certificate pointer is added for the lifetime of the certificate |
80 // viewer. | 79 // viewer. |
81 explicit CertificateViewerDialog(net::X509Certificate* cert); | 80 explicit CertificateViewerDialog(net::X509Certificate* cert); |
82 virtual ~CertificateViewerDialog(); | 81 ~CertificateViewerDialog() override; |
83 | 82 |
84 // CertificateViewerModalDialog overrides. | 83 // CertificateViewerModalDialog overrides. |
85 virtual void Show(content::WebContents* web_contents, | 84 void Show(content::WebContents* web_contents, |
86 gfx::NativeWindow parent) override; | 85 gfx::NativeWindow parent) override; |
87 virtual web_modal::NativeWebContentsModalDialog | 86 web_modal::NativeWebContentsModalDialog GetNativeWebContentsModalDialog() |
88 GetNativeWebContentsModalDialog() override; | 87 override; |
89 | 88 |
90 protected: | 89 protected: |
91 // Overridden from ui::WebDialogDelegate: | 90 // Overridden from ui::WebDialogDelegate: |
92 virtual GURL GetDialogContentURL() const override; | 91 GURL GetDialogContentURL() const override; |
93 virtual ui::ModalType GetDialogModalType() const override; | 92 ui::ModalType GetDialogModalType() const override; |
94 | 93 |
95 private: | 94 private: |
96 ConstrainedWebDialogDelegate* dialog_; | 95 ConstrainedWebDialogDelegate* dialog_; |
97 | 96 |
98 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); | 97 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); |
99 }; | 98 }; |
100 | 99 |
101 // Dialog handler which handles calls from the JS WebUI code to view certificate | 100 // Dialog handler which handles calls from the JS WebUI code to view certificate |
102 // details and export the certificate. | 101 // details and export the certificate. |
103 class CertificateViewerDialogHandler : public content::WebUIMessageHandler { | 102 class CertificateViewerDialogHandler : public content::WebUIMessageHandler { |
104 public: | 103 public: |
105 CertificateViewerDialogHandler(CertificateViewerModalDialog* dialog, | 104 CertificateViewerDialogHandler(CertificateViewerModalDialog* dialog, |
106 net::X509Certificate* cert); | 105 net::X509Certificate* cert); |
107 virtual ~CertificateViewerDialogHandler(); | 106 ~CertificateViewerDialogHandler() override; |
108 | 107 |
109 // Overridden from WebUIMessageHandler | 108 // Overridden from WebUIMessageHandler |
110 virtual void RegisterMessages() override; | 109 void RegisterMessages() override; |
111 | 110 |
112 private: | 111 private: |
113 // Brings up the export certificate dialog for the chosen certificate in the | 112 // Brings up the export certificate dialog for the chosen certificate in the |
114 // chain. | 113 // chain. |
115 // | 114 // |
116 // The input is an integer index to the certificate in the chain to export. | 115 // The input is an integer index to the certificate in the chain to export. |
117 void ExportCertificate(const base::ListValue* args); | 116 void ExportCertificate(const base::ListValue* args); |
118 | 117 |
119 // Gets the details for a specific certificate in the certificate chain. Calls | 118 // Gets the details for a specific certificate in the certificate chain. Calls |
120 // the javascript function cert_viewer.getCertificateFields with a tree | 119 // the javascript function cert_viewer.getCertificateFields with a tree |
(...skipping 13 matching lines...) Expand all Loading... |
134 CertificateViewerModalDialog* dialog_; | 133 CertificateViewerModalDialog* dialog_; |
135 | 134 |
136 // The certificate chain. Does not take references, so only valid as long as | 135 // The certificate chain. Does not take references, so only valid as long as |
137 // |cert_| is. | 136 // |cert_| is. |
138 net::X509Certificate::OSCertHandles cert_chain_; | 137 net::X509Certificate::OSCertHandles cert_chain_; |
139 | 138 |
140 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); | 139 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); |
141 }; | 140 }; |
142 | 141 |
143 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ | 142 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ |
OLD | NEW |