Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/browser/ui/webui/certificate_viewer_webui.h

Issue 10332231: Remove chrome::NOTIFICATION_WEB_DIALOG_SHOWN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add web_dialog_observer.h to chrome_browser.gypi Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/certificate_viewer_webui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/observer_list.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/browser/ui/webui/web_dialog_delegate.h" 15 #include "chrome/browser/ui/webui/web_dialog_delegate.h"
15 #include "content/public/browser/web_ui_message_handler.h" 16 #include "content/public/browser/web_ui_message_handler.h"
16 #include "net/base/x509_certificate.h" 17 #include "net/base/x509_certificate.h"
17 #include "ui/gfx/native_widget_types.h" 18 #include "ui/gfx/native_widget_types.h"
18 19
20 class WebDialogObserver;
21
19 // Displays the native or WebUI certificate viewer dialog for the given 22 // Displays the native or WebUI certificate viewer dialog for the given
20 // certificate. 23 // certificate.
21 void ShowCertificateViewer(gfx::NativeWindow parent, 24 void ShowCertificateViewer(gfx::NativeWindow parent,
22 net::X509Certificate*); 25 net::X509Certificate*);
23 26
24 // Dialog for displaying detailed certificate information. This is used in linux 27 // Dialog for displaying detailed certificate information. This is used in linux
25 // and chromeos builds to display detailed information in a floating dialog when 28 // and chromeos builds to display detailed information in a floating dialog when
26 // the user clicks on "Certificate Information" from the lock icon of a web site 29 // the user clicks on "Certificate Information" from the lock icon of a web site
27 // or "View" from the Certificate Manager. 30 // or "View" from the Certificate Manager.
28 class CertificateViewerDialog : private WebDialogDelegate { 31 class CertificateViewerDialog : private WebDialogDelegate {
29 public: 32 public:
30 // Shows the certificate viewer dialog for the passed in certificate.
31 static void ShowDialog(gfx::NativeWindow parent,
32 net::X509Certificate* cert);
33 virtual ~CertificateViewerDialog();
34
35 private:
36 // Construct a certificate viewer for the passed in certificate. A reference 33 // Construct a certificate viewer for the passed in certificate. A reference
37 // to the certificate pointer is added for the lifetime of the certificate 34 // to the certificate pointer is added for the lifetime of the certificate
38 // viewer. 35 // viewer.
39 explicit CertificateViewerDialog(net::X509Certificate* cert); 36 explicit CertificateViewerDialog(net::X509Certificate* cert);
37 virtual ~CertificateViewerDialog();
40 38
41 // Show the dialog using the given parent window. 39 // Show the dialog using the given parent window.
42 void Show(gfx::NativeWindow parent); 40 void Show(gfx::NativeWindow parent);
43 41
42 // Add WebDialogObserver for this dialog.
43 void AddObserver(WebDialogObserver* observer);
44
45 // Remove WebDialogObserver for this dialog.
46 void RemoveObserver(WebDialogObserver* observer);
47
48 private:
44 // Overridden from WebDialogDelegate: 49 // Overridden from WebDialogDelegate:
45 virtual ui::ModalType GetDialogModalType() const OVERRIDE; 50 virtual ui::ModalType GetDialogModalType() const OVERRIDE;
46 virtual string16 GetDialogTitle() const OVERRIDE; 51 virtual string16 GetDialogTitle() const OVERRIDE;
47 virtual GURL GetDialogContentURL() const OVERRIDE; 52 virtual GURL GetDialogContentURL() const OVERRIDE;
48 virtual void GetWebUIMessageHandlers( 53 virtual void GetWebUIMessageHandlers(
49 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; 54 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
50 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; 55 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
51 virtual std::string GetDialogArgs() const OVERRIDE; 56 virtual std::string GetDialogArgs() const OVERRIDE;
57 virtual void OnDialogShown(
58 content::WebUI* webui,
59 content::RenderViewHost* render_view_host) OVERRIDE;
52 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; 60 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
53 virtual void OnCloseContents( 61 virtual void OnCloseContents(
54 content::WebContents* source, bool* out_close_dialog) OVERRIDE; 62 content::WebContents* source, bool* out_close_dialog) OVERRIDE;
55 virtual bool ShouldShowDialogTitle() const OVERRIDE; 63 virtual bool ShouldShowDialogTitle() const OVERRIDE;
56 64
57 // The certificate being viewed. 65 // The certificate being viewed.
58 scoped_refptr<net::X509Certificate> cert_; 66 scoped_refptr<net::X509Certificate> cert_;
59 67
60 // The window displaying this dialog. 68 // The window displaying this dialog.
61 gfx::NativeWindow window_; 69 gfx::NativeWindow window_;
62 70
63 // The title of the certificate viewer dialog, Certificate Viewer: CN. 71 // The title of the certificate viewer dialog, Certificate Viewer: CN.
64 string16 title_; 72 string16 title_;
65 73
74 ObserverList<WebDialogObserver> observers_;
75
66 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); 76 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog);
67 }; 77 };
68 78
69 // Dialog handler which handles calls from the JS WebUI code to view certificate 79 // Dialog handler which handles calls from the JS WebUI code to view certificate
70 // details and export the certificate. 80 // details and export the certificate.
71 class CertificateViewerDialogHandler : public content::WebUIMessageHandler { 81 class CertificateViewerDialogHandler : public content::WebUIMessageHandler {
72 public: 82 public:
73 CertificateViewerDialogHandler(gfx::NativeWindow window, 83 CertificateViewerDialogHandler(gfx::NativeWindow window,
74 net::X509Certificate* cert); 84 net::X509Certificate* cert);
75 virtual ~CertificateViewerDialogHandler(); 85 virtual ~CertificateViewerDialogHandler();
(...skipping 25 matching lines...) Expand all
101 // The dialog window. 111 // The dialog window.
102 gfx::NativeWindow window_; 112 gfx::NativeWindow window_;
103 113
104 // The certificate chain. 114 // The certificate chain.
105 net::X509Certificate::OSCertHandles cert_chain_; 115 net::X509Certificate::OSCertHandles cert_chain_;
106 116
107 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); 117 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler);
108 }; 118 };
109 119
110 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ 120 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/certificate_viewer_webui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698