Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PASSWORDS_MANAGE_PASSWORD_ITEMS_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEMS_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEMS_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEMS_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "components/autofill/core/common/password_form.h" | 12 #include "components/autofill/core/common/password_form.h" |
| 13 #include "ui/views/focus/focus_manager.h" | |
|
vasilii
2017/06/30 15:28:06
Seems like it's not used in the header?
irmakk
2017/07/03 14:56:54
Done.
| |
| 13 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
| 14 | 15 |
| 15 class ManagePasswordsBubbleModel; | 16 class ManagePasswordsBubbleModel; |
| 16 | 17 |
| 17 // A custom view of individual credentials. The view is represented as a table | 18 // A custom view of individual credentials. The view is represented as a table |
| 18 // where each row can be in three distinct states: | 19 // where each row can be in three distinct states: |
| 19 // | 20 // |
| 20 // * Present credentials the user may choose to save. | 21 // * Present credentials the user may choose to save. |
| 21 // * Present already-saved credentials to the user for management. | 22 // * Present already-saved credentials to the user for management. |
| 22 // * Offer the user the ability to undo a deletion action. | 23 // * Offer the user the ability to undo a deletion action. |
| 23 class ManagePasswordItemsView : public views::View { | 24 class ManagePasswordItemsView : public views::View { |
| 24 public: | 25 public: |
| 26 class ManagePasswordItemsDelegate { | |
|
vasilii
2017/06/30 15:28:06
I'd declare it outside of this class because it's
| |
| 27 public: | |
| 28 virtual void FocusedOnEditable() = 0; | |
| 29 virtual void FocusLostOnEditable() = 0; | |
| 30 }; | |
| 31 enum RowStatus { DEFAULT, DELETED, EDITING }; | |
|
vasilii
2017/06/30 15:28:07
"DEFAULT" isn't clear. I don't understand if it's
| |
| 25 ManagePasswordItemsView( | 32 ManagePasswordItemsView( |
| 26 ManagePasswordsBubbleModel* manage_passwords_bubble_model, | 33 ManagePasswordsBubbleModel* manage_passwords_bubble_model, |
| 27 const std::vector<autofill::PasswordForm>* password_forms); | 34 const std::vector<autofill::PasswordForm>* password_forms); |
| 28 ManagePasswordItemsView( | 35 ManagePasswordItemsView( |
| 29 ManagePasswordsBubbleModel* manage_passwords_bubble_model, | 36 ManagePasswordsBubbleModel* manage_passwords_bubble_model, |
| 30 const autofill::PasswordForm* password_form); | 37 const autofill::PasswordForm* password_form, |
| 38 ManagePasswordItemsDelegate* manage_password_items_delegate = nullptr); | |
|
vasilii
2017/06/30 15:28:06
I don't think we win anything with the default arg
irmakk
2017/07/03 14:56:54
This constructor is also used for the update pendi
| |
| 39 void SetRowStatusForPendingViewRow(RowStatus row_status); | |
|
vasilii
2017/06/30 15:28:07
A blank line before please.
irmakk
2017/07/03 14:56:54
Done.
| |
| 31 | 40 |
| 32 private: | 41 private: |
| 33 class PasswordFormRow; | 42 class PasswordFormRow; |
| 34 | 43 |
| 35 ~ManagePasswordItemsView() override; | 44 ~ManagePasswordItemsView() override; |
| 36 | 45 |
| 46 bool OnKeyPressed(const ui::KeyEvent& event) override; | |
|
vasilii
2017/06/30 15:28:06
Add a comment // View:
irmakk
2017/07/03 14:56:54
Done.
| |
| 47 | |
| 37 void AddRows(); | 48 void AddRows(); |
| 38 void NotifyPasswordFormStatusChanged( | 49 void NotifyPasswordFormStatusChanged( |
| 39 const autofill::PasswordForm& password_form, bool deleted); | 50 const autofill::PasswordForm& password_form, bool deleted); |
| 40 | 51 |
| 41 // Changes the views according to the state of |password_forms_rows_|. | 52 // Changes the views according to the state of |password_forms_rows_|. |
| 42 void Refresh(); | 53 void Refresh(); |
| 43 | 54 |
| 44 std::vector<std::unique_ptr<PasswordFormRow>> password_forms_rows_; | 55 std::vector<std::unique_ptr<PasswordFormRow>> password_forms_rows_; |
| 45 ManagePasswordsBubbleModel* model_; | 56 ManagePasswordsBubbleModel* model_; |
| 57 ManagePasswordItemsDelegate* delegate_; | |
| 46 | 58 |
| 47 DISALLOW_COPY_AND_ASSIGN(ManagePasswordItemsView); | 59 DISALLOW_COPY_AND_ASSIGN(ManagePasswordItemsView); |
| 48 }; | 60 }; |
| 49 | 61 |
| 50 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEMS_VIEW_H_ | 62 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEMS_VIEW_H_ |
| OLD | NEW |