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