manage_password_item_view.h revision f2477e01787aa58f445919b809d89e252beef54f
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.
4
5#ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_
6#define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_
7
8#include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
9#include "components/autofill/core/common/password_form.h"
10#include "ui/base/resource/resource_bundle.h"
11
12namespace views {
13class LabelButton;
14}
15
16// A custom view for credentials which allows the management of the specific
17// credentials.
18class ManagePasswordItemView : public views::View,
19                               public views::ButtonListener {
20 public:
21  ManagePasswordItemView(
22      ManagePasswordsBubbleModel* manage_passwords_bubble_model,
23      autofill::PasswordForm password_form,
24      int field_1_width,
25      int field_2_width);
26
27  static string16 GetPasswordDisplayString(const string16& password);
28
29 private:
30  virtual ~ManagePasswordItemView();
31
32  // Changes the views according to the state of |delete_password_|.
33  void Refresh();
34
35  // views::ButtonListener:
36  virtual void ButtonPressed(views::Button* sender,
37                             const ui::Event& event) OVERRIDE;
38
39  views::Label* label_1_;
40  views::Label* label_2_;
41
42  // This button is used to set |delete_password_| and to change the view
43  // accordingly. Clicking on it again will toggle it and restore the original
44  // view.
45  views::LabelButton* delete_or_undo_button_;
46
47  ManagePasswordsBubbleModel* manage_passwords_bubble_model_;
48  autofill::PasswordForm password_form_;
49  bool delete_password_;
50  int field_1_width_;
51  int field_2_width_;
52
53  DISALLOW_COPY_AND_ASSIGN(ManagePasswordItemView);
54};
55
56#endif  // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_
57