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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_
8 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
9 #include "components/autofill/core/common/password_form.h"
10 #include "components/password_manager/core/common/password_manager_ui.h"
12 class ManagePasswordsBubbleModel;
19 // A custom view for credentials which allows the management of the specific
20 // credentials. The view has three distinct states:
22 // * Present credentials to the user which she may choose to save.
23 // * Present already-saved credentials to the user for management.
24 // * Offer the user the ability to undo a deletion action.
26 // The ManagePasswordItemView serves as a container for a single view
27 // representing one of these states.
28 class ManagePasswordItemView : public views::View {
30 // Render credentials in two columns: username and password.
31 class PendingView : public views::View {
33 explicit PendingView(ManagePasswordItemView* parent);
36 virtual ~PendingView();
39 // Render credentials in three columns: username, password, and delete.
40 class ManageView : public views::View, public views::ButtonListener {
42 explicit ManageView(ManagePasswordItemView* parent);
45 virtual ~ManageView();
47 // views::ButtonListener:
48 virtual void ButtonPressed(views::Button* sender,
49 const ui::Event& event) OVERRIDE;
51 views::ImageButton* delete_button_;
52 ManagePasswordItemView* parent_;
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 {
59 explicit UndoView(ManagePasswordItemView* parent);
64 // views::LinkListener:
65 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
67 views::Link* undo_link_;
68 ManagePasswordItemView* parent_;
71 ManagePasswordItemView(
72 ManagePasswordsBubbleModel* manage_passwords_bubble_model,
73 autofill::PasswordForm password_form,
74 password_manager::ui::PasswordItemPosition position);
77 virtual ~ManagePasswordItemView();
79 void NotifyClickedDelete();
80 void NotifyClickedUndo();
82 // Changes the views according to the state of |delete_password_|.
85 ManagePasswordsBubbleModel* model_;
86 autofill::PasswordForm password_form_;
87 bool delete_password_;
89 DISALLOW_COPY_AND_ASSIGN(ManagePasswordItemView);
92 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_