| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "net/cert/x509_certificate.h" | 12 #include "net/cert/x509_certificate.h" |
| 13 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/button.h" |
| 14 #include "ui/views/controls/table/table_view_observer.h" | 14 #include "ui/views/controls/table/table_view_observer.h" |
| 15 #include "ui/views/window/dialog_delegate.h" | 15 #include "ui/views/window/dialog_delegate.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class WebContents; | 18 class WebContents; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 class LabelButton; | 22 class LabelButton; |
| 23 class TableView; | 23 class TableView; |
| 24 class View; | 24 class View; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace ui { |
| 28 class TableModel; |
| 29 } |
| 30 |
| 27 namespace chrome { | 31 namespace chrome { |
| 28 | 32 |
| 29 // A base class for dialogs that show a given list of certificates to the user. | 33 // A base class for dialogs that show a given list of certificates to the user. |
| 30 // The user can select a single certificate and look at details of each | 34 // The user can select a single certificate and look at details of each |
| 31 // certificate. | 35 // certificate. |
| 32 // The currently selected certificate can be obtained using |GetSelectedCert()|. | 36 // The currently selected certificate can be obtained using |GetSelectedCert()|. |
| 33 // The explanatory text shown to the user must be provided to |InitWithText()|. | 37 // The explanatory text shown to the user must be provided to |InitWithText()|. |
| 34 class CertificateSelector : public views::DialogDelegateView, | 38 class CertificateSelector : public views::DialogDelegateView, |
| 35 public views::ButtonListener, | 39 public views::ButtonListener, |
| 36 public views::TableViewObserver { | 40 public views::TableViewObserver { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 protected: | 76 protected: |
| 73 // The dimensions of the certificate selector table view, in pixels. | 77 // The dimensions of the certificate selector table view, in pixels. |
| 74 static const int kTableViewWidth; | 78 static const int kTableViewWidth; |
| 75 static const int kTableViewHeight; | 79 static const int kTableViewHeight; |
| 76 | 80 |
| 77 // Initializes the dialog. |text| is shown above the list of certificates | 81 // Initializes the dialog. |text| is shown above the list of certificates |
| 78 // and is supposed to explain to the user what the implication of the | 82 // and is supposed to explain to the user what the implication of the |
| 79 // certificate selection is. | 83 // certificate selection is. |
| 80 void InitWithText(std::unique_ptr<views::View> text_label); | 84 void InitWithText(std::unique_ptr<views::View> text_label); |
| 81 | 85 |
| 86 ui::TableModel* table_model_for_testing() const; |
| 87 |
| 82 private: | 88 private: |
| 83 class CertificateTableModel; | 89 class CertificateTableModel; |
| 84 | 90 |
| 85 net::CertificateList certificates_; | 91 net::CertificateList certificates_; |
| 86 | 92 |
| 87 // Whether to show the provider column in the table or not. Certificates | 93 // Whether to show the provider column in the table or not. Certificates |
| 88 // provided by the platform show the empty string as provider. That column is | 94 // provided by the platform show the empty string as provider. That column is |
| 89 // shown only if there is at least one non-empty provider, i.e. non-platform | 95 // shown only if there is at least one non-empty provider, i.e. non-platform |
| 90 // certificate. | 96 // certificate. |
| 91 bool show_provider_column_ = false; | 97 bool show_provider_column_ = false; |
| 92 std::unique_ptr<CertificateTableModel> model_; | 98 std::unique_ptr<CertificateTableModel> model_; |
| 93 | 99 |
| 94 content::WebContents* const web_contents_; | 100 content::WebContents* const web_contents_; |
| 95 | 101 |
| 96 views::TableView* table_; | 102 views::TableView* table_; |
| 97 views::LabelButton* view_cert_button_; | 103 views::LabelButton* view_cert_button_; |
| 98 | 104 |
| 99 DISALLOW_COPY_AND_ASSIGN(CertificateSelector); | 105 DISALLOW_COPY_AND_ASSIGN(CertificateSelector); |
| 100 }; | 106 }; |
| 101 | 107 |
| 102 } // namespace chrome | 108 } // namespace chrome |
| 103 | 109 |
| 104 #endif // CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_ | 110 #endif // CHROME_BROWSER_UI_VIEWS_CERTIFICATE_SELECTOR_H_ |
| OLD | NEW |