Chromium Code Reviews| 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..a4a87b156987ea6f97c02c25d0420c597e6cba0a 100644 |
| --- a/chrome/browser/ui/views/ssl_client_certificate_selector.h |
| +++ b/chrome/browser/ui/views/certificate_selector.h |
| @@ -1,63 +1,60 @@ |
| -// 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> |
|
bartfab (slow)
2015/02/20 12:19:47
This: This is only needed in the implementation fi
pneubeck (no reviews)
2015/02/20 14:02:50
Done.
|
| -#include "base/basictypes.h" |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
|
bartfab (slow)
2015/02/20 12:19:47
This: This is only needed in the implementation fi
pneubeck (no reviews)
2015/02/20 14:02:50
Done.
|
| +#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 "net/cert/x509_certificate.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 net { |
| -class SSLCertRequestInfo; |
| -class X509Certificate; |
| +namespace content { |
| +class WebContents; |
| } |
| 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 base class for dialogs that shows a given list of certificates to the user. |
|
bartfab (slow)
2015/02/20 12:19:47
Nit: s/shows/show/
pneubeck (no reviews)
2015/02/20 14:02:50
Done.
|
| +// The user can select a single certificate and look at details of each |
| +// certificate. |
| +// The currently selected certificate can be obtained using |GetSelectedCert()|. |
| +// The explanatory text shown to the user must be provided to |Init()|. |
| +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; |
| + // Returns the currently selected certificate or null if none is selected. |
| + // Must be called after Init(). |
|
bartfab (slow)
2015/02/20 12:19:47
Nit: This documentation needs updating. There is n
pneubeck (no reviews)
2015/02/20 14:02:50
Done.
|
| net::X509Certificate* GetSelectedCert() const; |
| - // SSLClientAuthObserver implementation: |
| - void OnCertSelectedByNotification() override; |
| + // Shows this dialog as a constrained web modal dialog and focuses the first |
| + // certificate. |
|
bartfab (slow)
2015/02/20 12:19:47
Nit: Does InitWithText() need to be called before
pneubeck (no reviews)
2015/02/20 14:02:50
Done.
|
| + void Show(); |
| // 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; |
| @@ -69,20 +66,24 @@ class SSLClientCertificateSelector : public SSLClientAuthObserver, |
| void OnSelectionChanged() override; |
| void OnDoubleClick() override; |
| - private: |
| - void CreateCertTable(); |
| - |
| - // Callback after unlocking certificate slot. |
| - void Unlocked(net::X509Certificate* cert); |
| + protected: |
| + // Initializes the dialog. |text| is shown above the list of certificates |
| + // and is supposed to explain to the user what the implication of the |
| + // certificate selection is. |
| + void InitWithText(const base::string16& text); |
| - scoped_ptr<CertificateSelectorTableModel> model_; |
| + private: |
| + const net::CertificateList certificates_; |
| + scoped_ptr<CertificateTableModel> model_; |
| - content::WebContents* web_contents_; |
| + content::WebContents* const web_contents_; |
| 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_ |