OLD | NEW |
1 // Copyright 2015 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_CERTIFICATE_SELECTOR_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // A base class for dialogs that show a given list of certificates to the user. | 28 // A base class for dialogs that show a given list of certificates to the user. |
29 // The user can select a single certificate and look at details of each | 29 // The user can select a single certificate and look at details of each |
30 // certificate. | 30 // certificate. |
31 // The currently selected certificate can be obtained using |GetSelectedCert()|. | 31 // The currently selected certificate can be obtained using |GetSelectedCert()|. |
32 // The explanatory text shown to the user must be provided to |InitWithText()|. | 32 // The explanatory text shown to the user must be provided to |InitWithText()|. |
33 class CertificateSelector : public views::DialogDelegateView, | 33 class CertificateSelector : public views::DialogDelegateView, |
34 public views::ButtonListener, | 34 public views::ButtonListener, |
35 public views::TableViewObserver { | 35 public views::TableViewObserver { |
36 public: | 36 public: |
| 37 // Indicates if the dialog can be successfully shown. |
| 38 // TODO(davidben): Remove this when the certificate selector prompt is moved |
| 39 // to the WebContentsDelegate. https://crbug.com/456255. |
| 40 static bool CanShow(content::WebContents* web_contents); |
| 41 |
37 class CertificateTableModel; | 42 class CertificateTableModel; |
38 | 43 |
39 // |web_contents| must not be null. | 44 // |web_contents| must not be null. |
40 CertificateSelector(const net::CertificateList& certificates, | 45 CertificateSelector(const net::CertificateList& certificates, |
41 content::WebContents* web_contents); | 46 content::WebContents* web_contents); |
42 ~CertificateSelector() override; | 47 ~CertificateSelector() override; |
43 | 48 |
44 // Returns the currently selected certificate or null if none is selected. | 49 // Returns the currently selected certificate or null if none is selected. |
45 // Must be called after |InitWithText()|. | 50 // Must be called after |InitWithText()|. |
46 net::X509Certificate* GetSelectedCert() const; | 51 net::X509Certificate* GetSelectedCert() const; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 88 |
84 views::TableView* table_; | 89 views::TableView* table_; |
85 views::LabelButton* view_cert_button_; | 90 views::LabelButton* view_cert_button_; |
86 | 91 |
87 DISALLOW_COPY_AND_ASSIGN(CertificateSelector); | 92 DISALLOW_COPY_AND_ASSIGN(CertificateSelector); |
88 }; | 93 }; |
89 | 94 |
90 } // namespace chrome | 95 } // namespace chrome |
91 | 96 |
92 #endif // CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_ | 97 #endif // CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_ |
OLD | NEW |