| 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 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_SELECTION_VIEW_H_ | 4 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_SELECTION_VIEW_H_ |
| 5 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_SELECTION_VIEW_H_ | 5 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_SELECTION_VIEW_H_ |
| 6 | 6 |
| 7 #include <memory> |
| 7 #include <vector> | 8 #include <vector> |
| 8 | 9 |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "components/autofill/core/common/password_form.h" | 11 #include "components/autofill/core/common/password_form.h" |
| 11 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 12 | 13 |
| 13 namespace views { | 14 namespace views { |
| 14 class Combobox; | 15 class Combobox; |
| 15 } | 16 } |
| 16 | 17 |
| 18 namespace ui { |
| 19 class SimpleComboboxModel; |
| 20 } |
| 21 |
| 17 class ManagePasswordsBubbleModel; | 22 class ManagePasswordsBubbleModel; |
| 18 | 23 |
| 19 // A view where the user can select a credential. | 24 // A view where the user can select a credential. |
| 20 class CredentialsSelectionView : public views::View { | 25 class CredentialsSelectionView : public views::View { |
| 21 public: | 26 public: |
| 22 explicit CredentialsSelectionView( | 27 explicit CredentialsSelectionView( |
| 23 ManagePasswordsBubbleModel* manage_passwords_bubble_model); | 28 ManagePasswordsBubbleModel* manage_passwords_bubble_model); |
| 24 ~CredentialsSelectionView() override; | 29 ~CredentialsSelectionView() override; |
| 25 | 30 |
| 26 // This methods also reports a user action. | 31 // This methods also reports a user action. |
| 27 const autofill::PasswordForm* GetSelectedCredentials(); | 32 const autofill::PasswordForm* GetSelectedCredentials(); |
| 28 | 33 |
| 29 private: | 34 private: |
| 30 views::Combobox* GenerateUsernameCombobox( | 35 void GenerateUsernameCombobox(const base::string16& best_matched_username); |
| 31 const base::string16& best_matched_username); | |
| 32 void ReportUserActionOnce(bool was_update_rejected, int selected_index); | 36 void ReportUserActionOnce(bool was_update_rejected, int selected_index); |
| 33 | 37 |
| 34 const std::vector<autofill::PasswordForm>* password_forms_; | 38 const std::vector<autofill::PasswordForm>* password_forms_; |
| 35 views::Combobox* combobox_; | 39 std::unique_ptr<views::Combobox> combobox_; |
| 40 std::unique_ptr<ui::SimpleComboboxModel> combobox_model_; |
| 36 int default_index_; | 41 int default_index_; |
| 37 bool is_default_best_match_; | 42 bool is_default_best_match_; |
| 38 bool is_default_preferred_; | 43 bool is_default_preferred_; |
| 39 bool action_reported_; | 44 bool action_reported_; |
| 40 | 45 |
| 41 DISALLOW_COPY_AND_ASSIGN(CredentialsSelectionView); | 46 DISALLOW_COPY_AND_ASSIGN(CredentialsSelectionView); |
| 42 }; | 47 }; |
| 43 | 48 |
| 44 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_SELECTION_VIEW_H_ | 49 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_SELECTION_VIEW_H_ |
| OLD | NEW |