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

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

Issue 10448066: Move the web dialogs code to src/ui/web_dialogs from src/chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 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
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/observer_list.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/ui/webui/web_dialog_delegate.h"
16 #include "content/public/browser/web_ui_message_handler.h" 15 #include "content/public/browser/web_ui_message_handler.h"
17 #include "net/base/x509_certificate.h" 16 #include "net/base/x509_certificate.h"
18 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
18 #include "ui/web_dialogs/web_dialog_delegate.h"
19 19
20 namespace ui {
20 class WebDialogObserver; 21 class WebDialogObserver;
22 }
21 23
22 // Displays the native or WebUI certificate viewer dialog for the given 24 // Displays the native or WebUI certificate viewer dialog for the given
23 // certificate. 25 // certificate.
24 void ShowCertificateViewer(gfx::NativeWindow parent, 26 void ShowCertificateViewer(gfx::NativeWindow parent,
25 net::X509Certificate*); 27 net::X509Certificate*);
26 28
27 // Dialog for displaying detailed certificate information. This is used in linux 29 // Dialog for displaying detailed certificate information. This is used in linux
28 // and chromeos builds to display detailed information in a floating dialog when 30 // and chromeos builds to display detailed information in a floating dialog when
29 // the user clicks on "Certificate Information" from the lock icon of a web site 31 // the user clicks on "Certificate Information" from the lock icon of a web site
30 // or "View" from the Certificate Manager. 32 // or "View" from the Certificate Manager.
31 class CertificateViewerDialog : private WebDialogDelegate { 33 class CertificateViewerDialog : private ui::WebDialogDelegate {
32 public: 34 public:
33 // Construct a certificate viewer for the passed in certificate. A reference 35 // Construct a certificate viewer for the passed in certificate. A reference
34 // 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
35 // viewer. 37 // viewer.
36 explicit CertificateViewerDialog(net::X509Certificate* cert); 38 explicit CertificateViewerDialog(net::X509Certificate* cert);
37 virtual ~CertificateViewerDialog(); 39 virtual ~CertificateViewerDialog();
38 40
39 // Show the dialog using the given parent window. 41 // Show the dialog using the given parent window.
40 void Show(gfx::NativeWindow parent); 42 void Show(gfx::NativeWindow parent);
41 43
42 // Add WebDialogObserver for this dialog. 44 // Add WebDialogObserver for this dialog.
43 void AddObserver(WebDialogObserver* observer); 45 void AddObserver(ui::WebDialogObserver* observer);
44 46
45 // Remove WebDialogObserver for this dialog. 47 // Remove WebDialogObserver for this dialog.
46 void RemoveObserver(WebDialogObserver* observer); 48 void RemoveObserver(ui::WebDialogObserver* observer);
47 49
48 private: 50 private:
49 // Overridden from WebDialogDelegate: 51 // Overridden from ui::WebDialogDelegate:
50 virtual ui::ModalType GetDialogModalType() const OVERRIDE; 52 virtual ui::ModalType GetDialogModalType() const OVERRIDE;
51 virtual string16 GetDialogTitle() const OVERRIDE; 53 virtual string16 GetDialogTitle() const OVERRIDE;
52 virtual GURL GetDialogContentURL() const OVERRIDE; 54 virtual GURL GetDialogContentURL() const OVERRIDE;
53 virtual void GetWebUIMessageHandlers( 55 virtual void GetWebUIMessageHandlers(
54 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; 56 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
55 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; 57 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
56 virtual std::string GetDialogArgs() const OVERRIDE; 58 virtual std::string GetDialogArgs() const OVERRIDE;
57 virtual void OnDialogShown( 59 virtual void OnDialogShown(
58 content::WebUI* webui, 60 content::WebUI* webui,
59 content::RenderViewHost* render_view_host) OVERRIDE; 61 content::RenderViewHost* render_view_host) OVERRIDE;
60 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; 62 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
61 virtual void OnCloseContents( 63 virtual void OnCloseContents(
62 content::WebContents* source, bool* out_close_dialog) OVERRIDE; 64 content::WebContents* source, bool* out_close_dialog) OVERRIDE;
63 virtual bool ShouldShowDialogTitle() const OVERRIDE; 65 virtual bool ShouldShowDialogTitle() const OVERRIDE;
64 66
65 // The certificate being viewed. 67 // The certificate being viewed.
66 scoped_refptr<net::X509Certificate> cert_; 68 scoped_refptr<net::X509Certificate> cert_;
67 69
68 // The window displaying this dialog. 70 // The window displaying this dialog.
69 gfx::NativeWindow window_; 71 gfx::NativeWindow window_;
70 72
71 // The title of the certificate viewer dialog, Certificate Viewer: CN. 73 // The title of the certificate viewer dialog, Certificate Viewer: CN.
72 string16 title_; 74 string16 title_;
73 75
74 ObserverList<WebDialogObserver> observers_; 76 ObserverList<ui::WebDialogObserver> observers_;
75 77
76 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog); 78 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialog);
77 }; 79 };
78 80
79 // Dialog handler which handles calls from the JS WebUI code to view certificate 81 // Dialog handler which handles calls from the JS WebUI code to view certificate
80 // details and export the certificate. 82 // details and export the certificate.
81 class CertificateViewerDialogHandler : public content::WebUIMessageHandler { 83 class CertificateViewerDialogHandler : public content::WebUIMessageHandler {
82 public: 84 public:
83 CertificateViewerDialogHandler(gfx::NativeWindow window, 85 CertificateViewerDialogHandler(gfx::NativeWindow window,
84 net::X509Certificate* cert); 86 net::X509Certificate* cert);
(...skipping 26 matching lines...) Expand all
111 // The dialog window. 113 // The dialog window.
112 gfx::NativeWindow window_; 114 gfx::NativeWindow window_;
113 115
114 // The certificate chain. 116 // The certificate chain.
115 net::X509Certificate::OSCertHandles cert_chain_; 117 net::X509Certificate::OSCertHandles cert_chain_;
116 118
117 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler); 119 DISALLOW_COPY_AND_ASSIGN(CertificateViewerDialogHandler);
118 }; 120 };
119 121
120 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_ 122 #endif // CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_WEBUI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/certificate_viewer_ui.cc ('k') | chrome/browser/ui/webui/certificate_viewer_webui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698