1 // Copyright 2014 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_CREDENTIALS_ITEM_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/autofill/core/common/password_form.h"
11 #include "components/password_manager/content/common/credential_manager_types.h"
12 #include "ui/views/controls/button/label_button.h"
19 class URLRequestContextGetter
;
27 // CredentialsItemView represents a credential view in the account chooser
29 class CredentialsItemView
: public views::LabelButton
{
31 CredentialsItemView(views::ButtonListener
* button_listener
,
32 const autofill::PasswordForm
& form
,
33 password_manager::CredentialType credential_type
,
34 net::URLRequestContextGetter
* request_context
);
35 ~CredentialsItemView() override
;
37 const autofill::PasswordForm
& form() const { return form_
; }
38 password_manager::CredentialType
credential_type() const {
39 return credential_type_
;
45 // views::LabelButton:
46 gfx::Size
GetPreferredSize() const override
;
47 int GetHeightForWidth(int w
) const override
;
48 void Layout() override
;
50 void UpdateAvatar(const gfx::ImageSkia
& image
);
52 autofill::PasswordForm form_
;
53 password_manager::CredentialType credential_type_
;
55 views::ImageView
* image_view_
;
56 views::Label
* full_name_label_
;
57 views::Label
* username_label_
;
59 base::WeakPtrFactory
<CredentialsItemView
> weak_ptr_factory_
;
61 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView
);
64 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_