| OLD | NEW |
| 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_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include "base/macros.h" |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/strings/string16.h" | |
| 13 #include "chrome/browser/ssl/ssl_client_auth_observer.h" | 9 #include "chrome/browser/ssl/ssl_client_auth_observer.h" |
| 14 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" | 10 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" |
| 15 #include "ui/views/controls/button/button.h" | 11 #include "chrome/browser/ui/views/certificate_selector.h" |
| 16 #include "ui/views/controls/table/table_view_observer.h" | |
| 17 #include "ui/views/window/dialog_delegate.h" | |
| 18 | 12 |
| 19 // This header file exists only for testing. Chrome should access the | 13 // This header file exists only for testing. Chrome should access the |
| 20 // certificate selector only through the cross-platform interface | 14 // certificate selector only through the cross-platform interface |
| 21 // chrome/browser/ssl_client_certificate_selector.h. | 15 // chrome/browser/ssl_client_certificate_selector.h. |
| 22 | 16 |
| 17 namespace content { |
| 18 class WebContents; |
| 19 } |
| 20 |
| 23 namespace net { | 21 namespace net { |
| 24 class SSLCertRequestInfo; | 22 class SSLCertRequestInfo; |
| 25 class X509Certificate; | 23 class X509Certificate; |
| 26 } | 24 } |
| 27 | 25 |
| 28 namespace views { | 26 class SSLClientCertificateSelector : public chrome::CertificateSelector, |
| 29 class LabelButton; | 27 public SSLClientAuthObserver { |
| 30 class TableView; | |
| 31 class Widget; | |
| 32 } | |
| 33 | |
| 34 class CertificateSelectorTableModel; | |
| 35 | |
| 36 class SSLClientCertificateSelector : public SSLClientAuthObserver, | |
| 37 public views::DialogDelegateView, | |
| 38 public views::ButtonListener, | |
| 39 public views::TableViewObserver { | |
| 40 public: | 28 public: |
| 41 SSLClientCertificateSelector( | 29 SSLClientCertificateSelector( |
| 42 content::WebContents* web_contents, | 30 content::WebContents* web_contents, |
| 43 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, | 31 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, |
| 44 const chrome::SelectCertificateCallback& callback); | 32 const chrome::SelectCertificateCallback& callback); |
| 45 ~SSLClientCertificateSelector() override; | 33 ~SSLClientCertificateSelector() override; |
| 46 | 34 |
| 47 void Init(); | 35 void Init(); |
| 48 | 36 |
| 49 net::X509Certificate* GetSelectedCert() const; | 37 // SSLClientAuthObserver: |
| 50 | |
| 51 // SSLClientAuthObserver implementation: | |
| 52 void OnCertSelectedByNotification() override; | 38 void OnCertSelectedByNotification() override; |
| 53 | 39 |
| 54 // DialogDelegateView: | 40 // chrome::CertificateSelector: |
| 55 bool CanResize() const override; | |
| 56 base::string16 GetWindowTitle() const override; | |
| 57 void DeleteDelegate() override; | |
| 58 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | |
| 59 bool Cancel() override; | 41 bool Cancel() override; |
| 60 bool Accept() override; | 42 bool Accept() override; |
| 61 views::View* GetInitiallyFocusedView() override; | |
| 62 views::View* CreateExtraView() override; | |
| 63 ui::ModalType GetModalType() const override; | |
| 64 | |
| 65 // views::ButtonListener: | |
| 66 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
| 67 | |
| 68 // views::TableViewObserver: | |
| 69 void OnSelectionChanged() override; | |
| 70 void OnDoubleClick() override; | |
| 71 | 43 |
| 72 private: | 44 private: |
| 73 void CreateCertTable(); | |
| 74 | |
| 75 // Callback after unlocking certificate slot. | 45 // Callback after unlocking certificate slot. |
| 76 void Unlocked(net::X509Certificate* cert); | 46 void Unlocked(net::X509Certificate* cert); |
| 77 | 47 |
| 78 scoped_ptr<CertificateSelectorTableModel> model_; | |
| 79 | |
| 80 content::WebContents* web_contents_; | |
| 81 | |
| 82 views::TableView* table_; | |
| 83 views::LabelButton* view_cert_button_; | |
| 84 | |
| 85 DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector); | 48 DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector); |
| 86 }; | 49 }; |
| 87 | 50 |
| 88 #endif // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ | 51 #endif // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ |
| OLD | NEW |