manage_password_item_view.h revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
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 views::LinkListener { 21 public: 22 ManagePasswordItemView( 23 ManagePasswordsBubbleModel* manage_passwords_bubble_model, 24 autofill::PasswordForm password_form, 25 int field_1_width, 26 int field_2_width); 27 28 static base::string16 GetPasswordDisplayString( 29 const base::string16& password); 30 31 private: 32 virtual ~ManagePasswordItemView(); 33 34 // Changes the views according to the state of |delete_password_|. 35 void Refresh(); 36 37 // views::ButtonListener: 38 virtual void ButtonPressed(views::Button* sender, 39 const ui::Event& event) OVERRIDE; 40 41 // views::LinkListener: 42 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; 43 44 views::Label* label_1_; 45 46 // This link is used to display the password dots when |delete_password_| is 47 // not set and to display an undo link if it is set. Clicking the undo link 48 // will change the view and unset |delete_password_|. 49 views::Link* label_2_; 50 51 // This button is used to set |delete_password_| and to bring up the the undo 52 // link in |label_2|. 53 views::LabelButton* delete_button_; 54 55 ManagePasswordsBubbleModel* manage_passwords_bubble_model_; 56 autofill::PasswordForm password_form_; 57 bool delete_password_; 58 int field_1_width_; 59 int field_2_width_; 60 61 DISALLOW_COPY_AND_ASSIGN(ManagePasswordItemView); 62}; 63 64#endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_H_ 65