[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / passwords / manage_password_item_view.h
blobf052d12acfe143f779c64a21ea74d49772396796
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"
11 class ManagePasswordsBubbleModel;
13 namespace views {
14 class GridLayout;
15 class ImageButton;
18 // A custom view for credentials which allows the management of the specific
19 // credentials. The view has three distinct states:
21 // * Present credentials to the user which she may choose to save.
22 // * Present already-saved credentials to the user for management.
23 // * Offer the user the ability to undo a deletion action.
25 // The ManagePasswordItemView serves as a container for a single view
26 // representing one of these states.
27 class ManagePasswordItemView : public views::View {
28 public:
29 // Render credentials in two columns: username and password.
30 class PendingView : public views::View {
31 public:
32 explicit PendingView(ManagePasswordItemView* parent);
34 private:
35 virtual ~PendingView();
38 // Render credentials in three columns: username, password, and delete.
39 class ManageView : public views::View, public views::ButtonListener {
40 public:
41 explicit ManageView(ManagePasswordItemView* parent);
43 private:
44 virtual ~ManageView();
46 // views::ButtonListener:
47 virtual void ButtonPressed(views::Button* sender,
48 const ui::Event& event) OVERRIDE;
50 views::ImageButton* delete_button_;
51 ManagePasswordItemView* parent_;
54 // Render a notification to the user that a password has been removed, and
55 // offer an undo link.
56 class UndoView : public views::View, public views::LinkListener {
57 public:
58 explicit UndoView(ManagePasswordItemView* parent);
60 private:
61 virtual ~UndoView();
63 // views::LinkListener:
64 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
66 views::Link* undo_link_;
67 ManagePasswordItemView* parent_;
70 enum Position { FIRST_ITEM, SUBSEQUENT_ITEM };
72 ManagePasswordItemView(
73 ManagePasswordsBubbleModel* manage_passwords_bubble_model,
74 autofill::PasswordForm password_form,
75 Position position);
77 private:
78 virtual ~ManagePasswordItemView();
80 void NotifyClickedDelete();
81 void NotifyClickedUndo();
83 // Changes the views according to the state of |delete_password_|.
84 void Refresh();
86 ManagePasswordsBubbleModel* model_;
87 autofill::PasswordForm password_form_;
88 bool delete_password_;
90 DISALLOW_COPY_AND_ASSIGN(ManagePasswordItemView);
93 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_