Chromium Code Reviews| 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 #if defined(OS_CHROMEOS) | |
| 15 #include "chrome/browser/chromeos/frame/bubble_window_style.h" | |
| 16 #endif | |
| 17 | |
| 14 // Displays the native or WebUI certificate viewer dialog for the given | 18 // Displays the native or WebUI certificate viewer dialog for the given |
| 15 // certificate. | 19 // certificate. |
| 16 void ShowCertificateViewer(gfx::NativeWindow parent, | 20 void ShowCertificateViewer(gfx::NativeWindow parent, |
| 17 net::X509Certificate*); | 21 net::X509Certificate*); |
| 18 | 22 |
| 19 // Dialog for displaying detailed certificate information. This is used in linux | 23 // Dialog for displaying detailed certificate information. This is used in linux |
| 20 // and chromeos builds to display detailed information in a floating dialog when | 24 // and chromeos builds to display detailed information in a floating dialog when |
| 21 // the user clicks on "Certificate Information" from the lock icon of a web site | 25 // the user clicks on "Certificate Information" from the lock icon of a web site |
| 22 // or "View" from the Certificate Manager. | 26 // or "View" from the Certificate Manager. |
| 23 class CertificateViewerDialog : private HtmlDialogUIDelegate { | 27 class CertificateViewerDialog : private HtmlDialogUIDelegate { |
| 24 public: | 28 public: |
| 25 // Shows the certificate viewer dialog for the passed in certificate. | 29 // Shows the certificate viewer dialog for the passed in certificate. |
| 26 static void ShowDialog(gfx::NativeWindow parent, | 30 static void ShowDialog(gfx::NativeWindow parent, |
| 27 net::X509Certificate* cert); | 31 net::X509Certificate* cert); |
| 28 virtual ~CertificateViewerDialog(); | 32 virtual ~CertificateViewerDialog(); |
| 29 | 33 |
| 30 private: | 34 private: |
| 31 // Construct a certificate viewer for the passed in certificate. A reference | 35 // Construct a certificate viewer for the passed in certificate. A reference |
| 32 // to the certificate pointer is added for the lifetime of the certificate | 36 // to the certificate pointer is added for the lifetime of the certificate |
| 33 // viewer. | 37 // viewer. |
| 38 #if defined(OS_CHROMEOS) | |
| 39 explicit CertificateViewerDialog(net::X509Certificate* cert, | |
| 40 chromeos::BubbleWindowStyle style); | |
| 41 #else | |
| 34 explicit CertificateViewerDialog(net::X509Certificate* cert); | 42 explicit CertificateViewerDialog(net::X509Certificate* cert); |
| 43 #endif | |
| 35 | 44 |
| 36 // Show the dialog using the given parent window. | 45 // Show the dialog using the given parent window. |
| 37 void Show(gfx::NativeWindow parent); | 46 void Show(gfx::NativeWindow parent); |
| 38 | 47 |
| 39 // Overridden from HtmlDialogUI::Delegate: | 48 // Overridden from HtmlDialogUI::Delegate: |
| 40 virtual bool IsDialogModal() const OVERRIDE; | 49 virtual bool IsDialogModal() const OVERRIDE; |
| 41 virtual string16 GetDialogTitle() const OVERRIDE; | 50 virtual string16 GetDialogTitle() const OVERRIDE; |
| 42 virtual GURL GetDialogContentURL() const OVERRIDE; | 51 virtual GURL GetDialogContentURL() const OVERRIDE; |
| 43 virtual void GetWebUIMessageHandlers( | 52 virtual void GetWebUIMessageHandlers( |
| 44 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; | 53 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; |
| 45 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | 54 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
| 46 virtual std::string GetDialogArgs() const OVERRIDE; | 55 virtual std::string GetDialogArgs() const OVERRIDE; |
| 47 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | 56 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
| 48 virtual void OnCloseContents( | 57 virtual void OnCloseContents( |
| 49 TabContents* source, bool* out_close_dialog) OVERRIDE; | 58 TabContents* source, bool* out_close_dialog) OVERRIDE; |
| 50 virtual bool ShouldShowDialogTitle() const OVERRIDE; | 59 virtual bool ShouldShowDialogTitle() const OVERRIDE; |
| 51 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; | 60 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; |
| 52 | 61 |
| 53 // The certificate being viewed. | 62 // The certificate being viewed. |
| 54 scoped_refptr<net::X509Certificate> cert_; | 63 scoped_refptr<net::X509Certificate> cert_; |
| 55 | 64 |
| 56 // The window displaying this dialog. | 65 // The window displaying this dialog. |
| 57 gfx::NativeWindow window_; | 66 gfx::NativeWindow window_; |
| 58 | 67 |
| 59 // The title of the certificate viewer dialog, Certificate Viewer: CN. | 68 // The title of the certificate viewer dialog, Certificate Viewer: CN. |
| 60 string16 title_; | 69 string16 title_; |
| 61 | 70 |
| 71 #if defined(OS_CHROMEOS) | |
| 72 chromeos::BubbleWindowStyle style_; | |
| 73 #endif | |
|
flackr
2011/11/10 16:03:16
Don't add style as a parameter to the class, just
bshe
2011/11/21 16:09:37
Done.
| |
| 74 | |
| 62 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); | 75 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); |
| 63 }; | 76 }; |
| 64 | 77 |
| 65 // Dialog handler which handles calls from the JS WebUI code to view certificate | 78 // Dialog handler which handles calls from the JS WebUI code to view certificate |
| 66 // details and export the certificate. | 79 // details and export the certificate. |
| 67 class CertificateViewerDialogHandler : public WebUIMessageHandler { | 80 class CertificateViewerDialogHandler : public WebUIMessageHandler { |
| 68 public: | 81 public: |
| 69 CertificateViewerDialogHandler(gfx::NativeWindow window, | 82 CertificateViewerDialogHandler(gfx::NativeWindow window, |
| 70 net::X509Certificate* cert); | 83 net::X509Certificate* cert); |
| 71 virtual ~CertificateViewerDialogHandler(); | 84 virtual ~CertificateViewerDialogHandler(); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 97 // The dialog window. | 110 // The dialog window. |
| 98 gfx::NativeWindow window_; | 111 gfx::NativeWindow window_; |
| 99 | 112 |
| 100 // The certificate chain. | 113 // The certificate chain. |
| 101 net::X509Certificate::OSCertHandles cert_chain_; | 114 net::X509Certificate::OSCertHandles cert_chain_; |
| 102 | 115 |
| 103 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); | 116 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); |
| 104 }; | 117 }; |
| 105 | 118 |
| 106 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_H_ | 119 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_H_ |
| OLD | NEW |