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_PASSWORDS_MANAGE_CREDENTIAL_ITEM_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_CREDENTIAL_ITEM_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_CREDENTIAL_ITEM_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_CREDENTIAL_ITEM_VIEW_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "components/autofill/core/common/password_form.h" | |
11 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
12 #include "ui/views/controls/link_listener.h" | 11 #include "ui/views/controls/link_listener.h" |
13 | 12 |
14 class CredentialsItemView; | 13 class CredentialsItemView; |
15 class ManagePasswordsBubbleModel; | 14 class ManagePasswordsBubbleModel; |
16 | 15 |
| 16 namespace autofill { |
| 17 struct PasswordForm; |
| 18 } |
| 19 |
17 namespace views { | 20 namespace views { |
18 class ImageButton; | 21 class ImageButton; |
19 class Link; | 22 class Link; |
20 } | 23 } |
21 | 24 |
22 // A custom view that represents one credential row. There are two states: | 25 // A custom view that represents one credential row. There are two states: |
23 // * Present a credential to the user for management. | 26 // * Present a credential to the user for management. |
24 // * Offer the user the ability to undo a deletion action. | 27 // * Offer the user the ability to undo a deletion action. |
25 class ManageCredentialItemView : public views::View, | 28 class ManageCredentialItemView : public views::View, |
26 public views::ButtonListener, | 29 public views::ButtonListener, |
27 public views::LinkListener { | 30 public views::LinkListener { |
28 public: | 31 public: |
| 32 // The caller is responsible for |password_form| lifetime. |
29 ManageCredentialItemView(ManagePasswordsBubbleModel* model, | 33 ManageCredentialItemView(ManagePasswordsBubbleModel* model, |
30 const autofill::PasswordForm* password_form); | 34 const autofill::PasswordForm* password_form); |
31 ~ManageCredentialItemView() override; | 35 ~ManageCredentialItemView() override; |
32 | 36 |
33 private: | 37 private: |
34 void Refresh(); | 38 void Refresh(); |
35 | 39 |
36 // ButtonListener: | 40 // ButtonListener: |
37 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 41 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
38 | 42 |
39 // LinkListener: | 43 // LinkListener: |
40 void LinkClicked(views::Link* source, int event_flags) override; | 44 void LinkClicked(views::Link* source, int event_flags) override; |
41 | 45 |
42 autofill::PasswordForm form_; | 46 const autofill::PasswordForm* const form_; |
43 scoped_ptr<CredentialsItemView> credential_button_; | 47 scoped_ptr<CredentialsItemView> credential_button_; |
44 views::ImageButton* delete_button_; | 48 views::ImageButton* delete_button_; |
45 views::Link* undo_link_; | 49 views::Link* undo_link_; |
46 | 50 |
47 ManagePasswordsBubbleModel* const model_; | 51 ManagePasswordsBubbleModel* const model_; |
48 bool form_deleted_; | 52 bool form_deleted_; |
49 | 53 |
50 DISALLOW_COPY_AND_ASSIGN(ManageCredentialItemView); | 54 DISALLOW_COPY_AND_ASSIGN(ManageCredentialItemView); |
51 }; | 55 }; |
52 | 56 |
53 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_CREDENTIAL_ITEM_VIEW_H_ | 57 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_CREDENTIAL_ITEM_VIEW_H_ |
OLD | NEW |