| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 11 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 12 #include "content/public/browser/web_ui_message_handler.h" |
| 12 #include "net/base/x509_certificate.h" | 13 #include "net/base/x509_certificate.h" |
| 13 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 14 | 15 |
| 15 // Displays the native or WebUI certificate viewer dialog for the given | 16 // Displays the native or WebUI certificate viewer dialog for the given |
| 16 // certificate. | 17 // certificate. |
| 17 void ShowCertificateViewer(gfx::NativeWindow parent, | 18 void ShowCertificateViewer(gfx::NativeWindow parent, |
| 18 net::X509Certificate*); | 19 net::X509Certificate*); |
| 19 | 20 |
| 20 // Dialog for displaying detailed certificate information. This is used in linux | 21 // Dialog for displaying detailed certificate information. This is used in linux |
| 21 // and chromeos builds to display detailed information in a floating dialog when | 22 // and chromeos builds to display detailed information in a floating dialog when |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 explicit CertificateViewerDialog(net::X509Certificate* cert); | 36 explicit CertificateViewerDialog(net::X509Certificate* cert); |
| 36 | 37 |
| 37 // Show the dialog using the given parent window. | 38 // Show the dialog using the given parent window. |
| 38 void Show(gfx::NativeWindow parent); | 39 void Show(gfx::NativeWindow parent); |
| 39 | 40 |
| 40 // Overridden from HtmlDialogUI::Delegate: | 41 // Overridden from HtmlDialogUI::Delegate: |
| 41 virtual bool IsDialogModal() const OVERRIDE; | 42 virtual bool IsDialogModal() const OVERRIDE; |
| 42 virtual string16 GetDialogTitle() const OVERRIDE; | 43 virtual string16 GetDialogTitle() const OVERRIDE; |
| 43 virtual GURL GetDialogContentURL() const OVERRIDE; | 44 virtual GURL GetDialogContentURL() const OVERRIDE; |
| 44 virtual void GetWebUIMessageHandlers( | 45 virtual void GetWebUIMessageHandlers( |
| 45 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; | 46 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; |
| 46 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | 47 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
| 47 virtual std::string GetDialogArgs() const OVERRIDE; | 48 virtual std::string GetDialogArgs() const OVERRIDE; |
| 48 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | 49 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
| 49 virtual void OnCloseContents( | 50 virtual void OnCloseContents( |
| 50 content::WebContents* source, bool* out_close_dialog) OVERRIDE; | 51 content::WebContents* source, bool* out_close_dialog) OVERRIDE; |
| 51 virtual bool ShouldShowDialogTitle() const OVERRIDE; | 52 virtual bool ShouldShowDialogTitle() const OVERRIDE; |
| 52 | 53 |
| 53 // The certificate being viewed. | 54 // The certificate being viewed. |
| 54 scoped_refptr<net::X509Certificate> cert_; | 55 scoped_refptr<net::X509Certificate> cert_; |
| 55 | 56 |
| 56 // The window displaying this dialog. | 57 // The window displaying this dialog. |
| 57 gfx::NativeWindow window_; | 58 gfx::NativeWindow window_; |
| 58 | 59 |
| 59 // The title of the certificate viewer dialog, Certificate Viewer: CN. | 60 // The title of the certificate viewer dialog, Certificate Viewer: CN. |
| 60 string16 title_; | 61 string16 title_; |
| 61 | 62 |
| 62 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); | 63 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 // Dialog handler which handles calls from the JS WebUI code to view certificate | 66 // Dialog handler which handles calls from the JS WebUI code to view certificate |
| 66 // details and export the certificate. | 67 // details and export the certificate. |
| 67 class CertificateViewerDialogHandler : public WebUIMessageHandler { | 68 class CertificateViewerDialogHandler : public content::WebUIMessageHandler { |
| 68 public: | 69 public: |
| 69 CertificateViewerDialogHandler(gfx::NativeWindow window, | 70 CertificateViewerDialogHandler(gfx::NativeWindow window, |
| 70 net::X509Certificate* cert); | 71 net::X509Certificate* cert); |
| 71 virtual ~CertificateViewerDialogHandler(); | 72 virtual ~CertificateViewerDialogHandler(); |
| 72 | 73 |
| 73 // Overridden from WebUIMessageHandler | 74 // Overridden from WebUIMessageHandler |
| 74 virtual void RegisterMessages() OVERRIDE; | 75 virtual void RegisterMessages() OVERRIDE; |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 // Brings up the export certificate dialog for the chosen certificate in the | 78 // Brings up the export certificate dialog for the chosen certificate in the |
| (...skipping 19 matching lines...) Expand all Loading... |
| 97 // The dialog window. | 98 // The dialog window. |
| 98 gfx::NativeWindow window_; | 99 gfx::NativeWindow window_; |
| 99 | 100 |
| 100 // The certificate chain. | 101 // The certificate chain. |
| 101 net::X509Certificate::OSCertHandles cert_chain_; | 102 net::X509Certificate::OSCertHandles cert_chain_; |
| 102 | 103 |
| 103 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); | 104 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ | 107 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ |
| OLD | NEW |