Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: chrome/browser/ui/views/passwords/manage_password_item_view.h

Issue 534543002: Clean up ManagePasswordsBubbleView and ManagePasswordItemView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/passwords/manage_password_item_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ITEM_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_
7 7
8 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
9 #include "components/autofill/core/common/password_form.h" 8 #include "components/autofill/core/common/password_form.h"
10 #include "components/password_manager/core/common/password_manager_ui.h" 9 #include "components/password_manager/core/common/password_manager_ui.h"
10 #include "ui/views/view.h"
11 11
12 class ManagePasswordsBubbleModel; 12 class ManagePasswordsBubbleModel;
13 13
14 namespace views {
15 class GridLayout;
16 class ImageButton;
17 }
18
19 // A custom view for credentials which allows the management of the specific 14 // A custom view for credentials which allows the management of the specific
20 // credentials. The view has three distinct states: 15 // credentials. The view has three distinct states:
21 // 16 //
22 // * Present credentials to the user which she may choose to save. 17 // * Present credentials to the user which she may choose to save.
23 // * Present already-saved credentials to the user for management. 18 // * Present already-saved credentials to the user for management.
24 // * Offer the user the ability to undo a deletion action. 19 // * Offer the user the ability to undo a deletion action.
25 // 20 //
26 // The ManagePasswordItemView serves as a container for a single view 21 // The ManagePasswordItemView serves as a container for a single view
27 // representing one of these states. 22 // representing one of these states.
28 class ManagePasswordItemView : public views::View { 23 class ManagePasswordItemView : public views::View {
29 public: 24 public:
30 // Render credentials in two columns: username and password.
31 class PendingView : public views::View {
32 public:
33 explicit PendingView(ManagePasswordItemView* parent);
34
35 private:
36 virtual ~PendingView();
37 };
38
39 // Render credentials in three columns: username, password, and delete.
40 class ManageView : public views::View, public views::ButtonListener {
41 public:
42 explicit ManageView(ManagePasswordItemView* parent);
43
44 private:
45 virtual ~ManageView();
46
47 // views::ButtonListener:
48 virtual void ButtonPressed(views::Button* sender,
49 const ui::Event& event) OVERRIDE;
50
51 views::ImageButton* delete_button_;
52 ManagePasswordItemView* parent_;
53 };
54
55 // Render a notification to the user that a password has been removed, and
56 // offer an undo link.
57 class UndoView : public views::View, public views::LinkListener {
58 public:
59 explicit UndoView(ManagePasswordItemView* parent);
60
61 private:
62 virtual ~UndoView();
63
64 // views::LinkListener:
65 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
66
67 views::Link* undo_link_;
68 ManagePasswordItemView* parent_;
69 };
70
71 ManagePasswordItemView( 25 ManagePasswordItemView(
72 ManagePasswordsBubbleModel* manage_passwords_bubble_model, 26 ManagePasswordsBubbleModel* manage_passwords_bubble_model,
73 autofill::PasswordForm password_form, 27 autofill::PasswordForm password_form,
74 password_manager::ui::PasswordItemPosition position); 28 password_manager::ui::PasswordItemPosition position);
75 29
76 private: 30 private:
31 class ManageView;
32 class PendingView;
33 class UndoView;
34
77 virtual ~ManagePasswordItemView(); 35 virtual ~ManagePasswordItemView();
78 36
79 void NotifyClickedDelete(); 37 void NotifyClickedDelete();
80 void NotifyClickedUndo(); 38 void NotifyClickedUndo();
81 39
82 // Changes the views according to the state of |delete_password_|. 40 // Changes the views according to the state of |delete_password_|.
83 void Refresh(); 41 void Refresh();
84 42
85 ManagePasswordsBubbleModel* model_; 43 ManagePasswordsBubbleModel* model_;
86 autofill::PasswordForm password_form_; 44 autofill::PasswordForm password_form_;
87 bool delete_password_; 45 bool delete_password_;
88 46
89 DISALLOW_COPY_AND_ASSIGN(ManagePasswordItemView); 47 DISALLOW_COPY_AND_ASSIGN(ManagePasswordItemView);
90 }; 48 };
91 49
92 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_ 50 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/passwords/manage_password_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698