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_
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.
26 class SSLCertRequestInfo
;
27 class X509Certificate
;
36 class CertificateSelectorTableModel
;
38 class SSLClientCertificateSelector
: public SSLClientAuthObserver
,
39 public views::DialogDelegateView
,
40 public views::ButtonListener
,
41 public views::TableViewObserver
{
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();
52 net::X509Certificate
* GetSelectedCert() const;
54 // SSLClientAuthObserver implementation:
55 virtual void OnCertSelectedByNotification() OVERRIDE
;
57 // DialogDelegateView:
58 virtual bool CanResize() const OVERRIDE
;
59 virtual 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
;
79 void CreateCertTable();
81 scoped_ptr
<CertificateSelectorTableModel
> model_
;
83 content::WebContents
* web_contents_
;
85 views::Widget
* window_
;
86 views::TableView
* table_
;
87 views::LabelButton
* view_cert_button_
;
89 DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector
);
92 #endif // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_