Index: chrome/browser/ui/views/certificate_selector.h |
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector.h b/chrome/browser/ui/views/certificate_selector.h |
similarity index 36% |
copy from chrome/browser/ui/views/ssl_client_certificate_selector.h |
copy to chrome/browser/ui/views/certificate_selector.h |
index de4fbed4bffbf4aa25163267776bff05652bbe0c..99da1fb65160be6a98a265e9a26019e1cb587e48 100644 |
--- a/chrome/browser/ui/views/ssl_client_certificate_selector.h |
+++ b/chrome/browser/ui/views/certificate_selector.h |
@@ -1,63 +1,64 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ |
-#define CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ |
+#ifndef CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_ |
+#define CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_ |
-#include <string> |
#include <vector> |
-#include "base/basictypes.h" |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/strings/string16.h" |
-#include "chrome/browser/ssl/ssl_client_auth_observer.h" |
-#include "chrome/browser/ssl/ssl_client_certificate_selector.h" |
#include "ui/views/controls/button/button.h" |
#include "ui/views/controls/table/table_view_observer.h" |
#include "ui/views/window/dialog_delegate.h" |
-// This header file exists only for testing. Chrome should access the |
-// certificate selector only through the cross-platform interface |
-// chrome/browser/ssl_client_certificate_selector.h. |
+namespace content { |
+class WebContents; |
+} |
namespace net { |
-class SSLCertRequestInfo; |
class X509Certificate; |
+typedef std::vector<scoped_refptr<X509Certificate>> CertificateList; |
msw
2015/02/19 19:53:53
nit: avoid the X509Certificate forward decl and du
pneubeck (no reviews)
2015/02/19 20:43:49
Done.
|
} |
namespace views { |
class LabelButton; |
class TableView; |
-class Widget; |
} |
-class CertificateSelectorTableModel; |
+namespace chrome { |
-class SSLClientCertificateSelector : public SSLClientAuthObserver, |
- public views::DialogDelegateView, |
- public views::ButtonListener, |
- public views::TableViewObserver { |
+// A dialog that shows a given list of certificates to the user. The user can |
+// select a single certificate and look at details of each certificate. |
+// Sub-classes can get the current certificate using |GetSelectedCert()|. The |
bartfab (slow)
2015/02/19 17:53:07
Why can only subclasses get the certificate? GetSe
pneubeck (no reviews)
2015/02/19 19:43:51
Done.
|
+// explnatory text shown to the user must be provided to |Init()|. |
bartfab (slow)
2015/02/19 17:53:07
Nit: s/explnatory/explanatory/
pneubeck (no reviews)
2015/02/19 19:43:51
Done.
|
+class CertificateSelector : public views::DialogDelegateView, |
+ public views::ButtonListener, |
+ public views::TableViewObserver { |
public: |
- SSLClientCertificateSelector( |
- content::WebContents* web_contents, |
- const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, |
- const chrome::SelectCertificateCallback& callback); |
- ~SSLClientCertificateSelector() override; |
+ class CertificateTableModel; |
- void Init(); |
+ // |web_contents| must not be null. |
+ CertificateSelector(const net::CertificateList& certificates, |
+ content::WebContents* web_contents); |
+ ~CertificateSelector() override; |
- net::X509Certificate* GetSelectedCert() const; |
+ // Initializes the dialog and shows it as a constrained web modal dialog. |
+ // |text| is shown above the list of certificates and is supposed to explain |
+ // the user what the implication of the certificate selection is. |
bartfab (slow)
2015/02/19 17:53:07
Nit: s/the/to the/
pneubeck (no reviews)
2015/02/19 19:43:51
Done.
|
+ void Init(const base::string16& text); |
- // SSLClientAuthObserver implementation: |
- void OnCertSelectedByNotification() override; |
+ // Returns the currently selected certificate or null if none is selected. |
+ net::X509Certificate* GetSelectedCert() const; |
// DialogDelegateView: |
bool CanResize() const override; |
base::string16 GetWindowTitle() const override; |
void DeleteDelegate() override; |
bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
- bool Cancel() override; |
- bool Accept() override; |
views::View* GetInitiallyFocusedView() override; |
views::View* CreateExtraView() override; |
ui::ModalType GetModalType() const override; |
@@ -70,19 +71,19 @@ class SSLClientCertificateSelector : public SSLClientAuthObserver, |
void OnDoubleClick() override; |
private: |
- void CreateCertTable(); |
+ views::TableView* CreateCertTable(); |
bartfab (slow)
2015/02/19 17:53:07
Nit: Return a scoped_ptr.
pneubeck (no reviews)
2015/02/19 19:43:51
Done.
|
- // Callback after unlocking certificate slot. |
- void Unlocked(net::X509Certificate* cert); |
+ const net::CertificateList certificates_; |
+ scoped_ptr<CertificateTableModel> model_; |
- scoped_ptr<CertificateSelectorTableModel> model_; |
+ content::WebContents* const web_contents_; |
- content::WebContents* web_contents_; |
+ views::TableView* table_ = nullptr; |
msw
2015/02/19 19:53:53
Do not assign default values here, use the constru
pneubeck (no reviews)
2015/02/19 20:43:49
I wonder why, considering that this doesn't requir
|
+ views::LabelButton* view_cert_button_ = nullptr; |
- views::TableView* table_; |
- views::LabelButton* view_cert_button_; |
- |
- DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector); |
+ DISALLOW_COPY_AND_ASSIGN(CertificateSelector); |
}; |
-#endif // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ |
+} // namespace chrome |
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_ |