OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 10 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
11 #include "net/base/x509_certificate.h" | 11 #include "net/base/x509_certificate.h" |
12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
13 | 13 |
14 // Displays the WebUI certificate viewer dialog for the passed in certificate. | 14 // Displays the native or WebUI certificate viewer dialog for the given |
| 15 // certificate. |
15 void ShowCertificateViewer(gfx::NativeWindow parent, | 16 void ShowCertificateViewer(gfx::NativeWindow parent, |
16 net::X509Certificate*); | 17 net::X509Certificate*); |
17 | 18 |
18 // Dialog for displaying detailed certificate information. This is used in linux | 19 // Dialog for displaying detailed certificate information. This is used in linux |
19 // and chromeos builds to display detailed information in a floating dialog when | 20 // and chromeos builds to display detailed information in a floating dialog when |
20 // the user clicks on "Certificate Information" from the lock icon of a web site | 21 // the user clicks on "Certificate Information" from the lock icon of a web site |
21 // or "View" from the Certificate Manager. | 22 // or "View" from the Certificate Manager. |
22 class CertificateViewerDialog : private HtmlDialogUIDelegate { | 23 class CertificateViewerDialog : private HtmlDialogUIDelegate { |
23 public: | 24 public: |
24 // Shows the certificate viewer dialog for the passed in certificate. | 25 // Shows the certificate viewer dialog for the passed in certificate. |
25 static void ShowDialog(gfx::NativeWindow parent, | 26 static void ShowDialog(gfx::NativeWindow parent, |
26 net::X509Certificate* cert); | 27 net::X509Certificate* cert); |
| 28 virtual ~CertificateViewerDialog(); |
27 | 29 |
28 private: | 30 private: |
29 // Construct a certificate viewer for the passed in certificate. A reference | 31 // Construct a certificate viewer for the passed in certificate. A reference |
30 // to the certificate pointer is added for the lifetime of the certificate | 32 // to the certificate pointer is added for the lifetime of the certificate |
31 // viewer. | 33 // viewer. |
32 explicit CertificateViewerDialog(gfx::NativeWindow parent, | 34 explicit CertificateViewerDialog(gfx::NativeWindow parent, |
33 net::X509Certificate* cert); | 35 net::X509Certificate* cert); |
34 | 36 |
35 // Overridden from HtmlDialogUI::Delegate: | 37 // Overridden from HtmlDialogUI::Delegate: |
36 virtual bool IsDialogModal() const OVERRIDE; | 38 virtual bool IsDialogModal() const OVERRIDE; |
(...skipping 20 matching lines...) Expand all Loading... |
57 | 59 |
58 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); | 60 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); |
59 }; | 61 }; |
60 | 62 |
61 // Dialog handler which handles calls from the JS WebUI code to view certificate | 63 // Dialog handler which handles calls from the JS WebUI code to view certificate |
62 // details and export the certificate. | 64 // details and export the certificate. |
63 class CertificateViewerDialogHandler : public WebUIMessageHandler { | 65 class CertificateViewerDialogHandler : public WebUIMessageHandler { |
64 public: | 66 public: |
65 CertificateViewerDialogHandler(gfx::NativeWindow parent, | 67 CertificateViewerDialogHandler(gfx::NativeWindow parent, |
66 net::X509Certificate* cert); | 68 net::X509Certificate* cert); |
| 69 virtual ~CertificateViewerDialogHandler(); |
67 | 70 |
68 // Overridden from WebUIMessageHandler | 71 // Overridden from WebUIMessageHandler |
69 virtual void RegisterMessages(); | 72 virtual void RegisterMessages(); |
70 | 73 |
71 private: | 74 private: |
72 // Brings up the export certificate dialog for the chosen certificate in the | 75 // Brings up the export certificate dialog for the chosen certificate in the |
73 // chain. | 76 // chain. |
74 // | 77 // |
75 // The input is an integer index to the certificate in the chain to export. | 78 // The input is an integer index to the certificate in the chain to export. |
76 void ExportCertificate(const base::ListValue* args); | 79 void ExportCertificate(const base::ListValue* args); |
(...skipping 15 matching lines...) Expand all Loading... |
92 // The parent window. | 95 // The parent window. |
93 gfx::NativeWindow parent_; | 96 gfx::NativeWindow parent_; |
94 | 97 |
95 // The certificate chain. | 98 // The certificate chain. |
96 net::X509Certificate::OSCertHandles cert_chain_; | 99 net::X509Certificate::OSCertHandles cert_chain_; |
97 | 100 |
98 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); | 101 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); |
99 }; | 102 }; |
100 | 103 |
101 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_H_ | 104 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_H_ |
OLD | NEW |