Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / ssl_client_certificate_selector.h
blob2056b527427b9bd87817e3c02318e1749ddc12df
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_
6 #define CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/strings/string16.h"
14 #include "chrome/browser/ssl/ssl_client_auth_observer.h"
15 #include "chrome/browser/ssl/ssl_client_certificate_selector.h"
16 #include "ui/views/controls/button/button.h"
17 #include "ui/views/controls/table/table_view_observer.h"
18 #include "ui/views/view.h"
19 #include "ui/views/window/dialog_delegate.h"
21 // This header file exists only for testing. Chrome should access the
22 // certificate selector only through the cross-platform interface
23 // chrome/browser/ssl_client_certificate_selector.h.
25 namespace net {
26 class SSLCertRequestInfo;
27 class X509Certificate;
30 namespace views {
31 class LabelButton;
32 class TableView;
33 class Widget;
36 class CertificateSelectorTableModel;
38 class SSLClientCertificateSelector : public SSLClientAuthObserver,
39 public views::DialogDelegateView,
40 public views::ButtonListener,
41 public views::TableViewObserver {
42 public:
43 SSLClientCertificateSelector(
44 content::WebContents* web_contents,
45 const net::HttpNetworkSession* network_session,
46 net::SSLCertRequestInfo* cert_request_info,
47 const chrome::SelectCertificateCallback& callback);
48 virtual ~SSLClientCertificateSelector();
50 void Init();
52 net::X509Certificate* GetSelectedCert() const;
54 // SSLClientAuthObserver implementation:
55 virtual void OnCertSelectedByNotification() OVERRIDE;
57 // DialogDelegateView:
58 virtual bool CanResize() const OVERRIDE;
59 virtual base::string16 GetWindowTitle() const OVERRIDE;
60 virtual void DeleteDelegate() OVERRIDE;
61 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE;
62 virtual bool Cancel() OVERRIDE;
63 virtual bool Accept() OVERRIDE;
64 virtual views::NonClientFrameView* CreateNonClientFrameView(
65 views::Widget* widget) OVERRIDE;
66 virtual views::View* GetInitiallyFocusedView() OVERRIDE;
67 virtual views::View* CreateExtraView() OVERRIDE;
68 virtual ui::ModalType GetModalType() const OVERRIDE;
70 // views::ButtonListener:
71 virtual void ButtonPressed(views::Button* sender,
72 const ui::Event& event) OVERRIDE;
74 // views::TableViewObserver:
75 virtual void OnSelectionChanged() OVERRIDE;
76 virtual void OnDoubleClick() OVERRIDE;
78 private:
79 void CreateCertTable();
81 // Callback after unlocking certificate slot.
82 void Unlocked(net::X509Certificate* cert);
84 scoped_ptr<CertificateSelectorTableModel> model_;
86 content::WebContents* web_contents_;
88 views::Widget* window_;
89 views::TableView* table_;
90 views::LabelButton* view_cert_button_;
92 DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector);
95 #endif // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_