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

Side by Side Diff: chrome/browser/ui/views/ssl_client_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: Addressed comments, some cleanup like const-ness, CHECKs, logging, includes, ... 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 (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();
msw 2015/02/19 19:53:53 nit: avoid overloading the non-virtual base class
pneubeck (no reviews) 2015/02/19 20:43:50 I can come up with any other random name (e.g. Ini
msw 2015/02/19 21:03:31 Consider CertificateSelector::InitAndShow, since i
pneubeck (no reviews) 2015/02/20 09:54:00 I considered the splitting as well. It makes the I
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(); 45 void CreateCertTable();
msw 2015/02/19 19:53:54 nit: avoid overloading the non-virtual base class
pneubeck (no reviews) 2015/02/19 20:43:50 deleted.
74 46
75 // Callback after unlocking certificate slot. 47 // Callback after unlocking certificate slot.
76 void Unlocked(net::X509Certificate* cert); 48 void Unlocked(net::X509Certificate* cert);
77 49
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); 50 DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector);
86 }; 51 };
87 52
88 #endif // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ 53 #endif // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698