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

Side by Side Diff: chrome/browser/ui/views/certificate_selector.h

Issue 932553002: Refactor SSLClientCertificateSelector for reuse with platformKeys API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert_perms
Patch Set: Cleaned up includes. Fixed compilation. Created 5 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_CERTIFICATE_SELECTOR_H_
6 #define CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ 6 #define CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_
7 7
8 #include <string>
9 #include <vector> 8 #include <vector>
10 9
11 #include "base/basictypes.h" 10 #include "base/macros.h"
12 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
13 #include "chrome/browser/ssl/ssl_client_auth_observer.h"
14 #include "chrome/browser/ssl/ssl_client_certificate_selector.h"
15 #include "ui/views/controls/button/button.h" 12 #include "ui/views/controls/button/button.h"
16 #include "ui/views/controls/table/table_view_observer.h" 13 #include "ui/views/controls/table/table_view_observer.h"
17 #include "ui/views/window/dialog_delegate.h" 14 #include "ui/views/window/dialog_delegate.h"
18 15
19 // This header file exists only for testing. Chrome should access the 16 namespace content {
20 // certificate selector only through the cross-platform interface 17 class WebContents;
21 // chrome/browser/ssl_client_certificate_selector.h. 18 }
22 19
23 namespace net { 20 namespace net {
24 class SSLCertRequestInfo;
25 class X509Certificate; 21 class X509Certificate;
22 typedef std::vector<scoped_refptr<X509Certificate>> CertificateList;
davidben 2015/02/18 20:32:01 :-( It looks like everything else duplicates the
pneubeck (no reviews) 2015/02/19 15:12:24 Acknowledged.
26 } 23 }
27 24
28 namespace views { 25 namespace views {
29 class LabelButton; 26 class LabelButton;
30 class TableView; 27 class TableView;
31 class Widget;
32 } 28 }
33 29
34 class CertificateSelectorTableModel; 30 namespace chrome {
35 31
36 class SSLClientCertificateSelector : public SSLClientAuthObserver, 32 class CertificateSelector : public views::DialogDelegateView,
37 public views::DialogDelegateView, 33 public views::ButtonListener,
38 public views::ButtonListener, 34 public views::TableViewObserver {
39 public views::TableViewObserver {
40 public: 35 public:
41 SSLClientCertificateSelector( 36 class CertificateTableModel;
42 content::WebContents* web_contents,
43 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info,
44 const chrome::SelectCertificateCallback& callback);
45 ~SSLClientCertificateSelector() override;
46 37
47 void Init(); 38 using SelectCertificateCallback = base::Callback<void(
39 const scoped_refptr<net::X509Certificate>& selected_cert)>;
davidben 2015/02/18 20:32:01 Note: this'll conflict with this CL. I expect your
pneubeck (no reviews) 2015/02/19 15:12:24 Thinking more about it, I have the impression that
davidben 2015/02/19 20:54:20 (Agreed. That UI is terrible. Though we'll still n
48 40
49 net::X509Certificate* GetSelectedCert() const; 41 CertificateSelector(content::WebContents* web_contents,
42 const net::CertificateList& certificates,
43 const SelectCertificateCallback& callback);
44 ~CertificateSelector() override;
50 45
51 // SSLClientAuthObserver implementation: 46 void Init(const base::string16& text);
52 void OnCertSelectedByNotification() override;
53 47
54 // DialogDelegateView: 48 // DialogDelegateView:
55 bool CanResize() const override; 49 bool CanResize() const override;
56 base::string16 GetWindowTitle() const override; 50 base::string16 GetWindowTitle() const override;
57 void DeleteDelegate() override; 51 void DeleteDelegate() override;
58 bool IsDialogButtonEnabled(ui::DialogButton button) const override; 52 bool IsDialogButtonEnabled(ui::DialogButton button) const override;
59 bool Cancel() override; 53 bool Cancel() override;
60 bool Accept() override; 54 bool Accept() override;
61 views::View* GetInitiallyFocusedView() override; 55 views::View* GetInitiallyFocusedView() override;
62 views::View* CreateExtraView() override; 56 views::View* CreateExtraView() override;
63 ui::ModalType GetModalType() const override; 57 ui::ModalType GetModalType() const override;
64 58
65 // views::ButtonListener: 59 // views::ButtonListener:
66 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 60 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
67 61
68 // views::TableViewObserver: 62 // views::TableViewObserver:
69 void OnSelectionChanged() override; 63 void OnSelectionChanged() override;
70 void OnDoubleClick() override; 64 void OnDoubleClick() override;
71 65
66 protected:
67 net::X509Certificate* GetSelectedCert() const;
68
72 private: 69 private:
73 void CreateCertTable(); 70 void CreateCertTable();
74 71
75 // Callback after unlocking certificate slot. 72 const net::CertificateList certificates_;
76 void Unlocked(net::X509Certificate* cert); 73 const SelectCertificateCallback callback_;
77 74 scoped_ptr<CertificateTableModel> model_;
78 scoped_ptr<CertificateSelectorTableModel> model_;
79 75
80 content::WebContents* web_contents_; 76 content::WebContents* web_contents_;
81 77
82 views::TableView* table_; 78 views::TableView* table_;
83 views::LabelButton* view_cert_button_; 79 views::LabelButton* view_cert_button_;
84 80
85 DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector); 81 DISALLOW_COPY_AND_ASSIGN(CertificateSelector);
86 }; 82 };
87 83
88 #endif // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ 84 } // namespace chrome
85
86 #endif // CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/certificate_selector.cc » ('j') | chrome/browser/ui/views/certificate_selector.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698