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 "chrome/browser/ui/passwords/account_avatar_fetcher.h"
11 #include "components/password_manager/core/common/credential_manager_types.h"
12 #include "ui/views/controls/button/label_button.h"
23 class URLRequestContextGetter
;
31 // CredentialsItemView represents a credential view in the account chooser
33 class CredentialsItemView
: public AccountAvatarFetcherDelegate
,
34 public views::LabelButton
{
36 CredentialsItemView(views::ButtonListener
* button_listener
,
37 const autofill::PasswordForm
* form
,
38 password_manager::CredentialType credential_type
,
39 const base::string16
& upper_text
,
40 const base::string16
& lower_text
,
41 net::URLRequestContextGetter
* request_context
);
42 ~CredentialsItemView() override
;
44 const autofill::PasswordForm
* form() const { return form_
; }
45 password_manager::CredentialType
credential_type() const {
46 return credential_type_
;
49 // AccountAvatarFetcherDelegate:
50 void UpdateAvatar(const gfx::ImageSkia
& image
) override
;
53 // views::LabelButton:
54 gfx::Size
GetPreferredSize() const override
;
55 int GetHeightForWidth(int w
) const override
;
56 void Layout() override
;
58 const autofill::PasswordForm
* form_
;
59 const password_manager::CredentialType credential_type_
;
61 views::ImageView
* image_view_
;
62 views::Label
* upper_label_
;
63 views::Label
* lower_label_
;
65 base::WeakPtrFactory
<CredentialsItemView
> weak_ptr_factory_
;
67 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView
);
70 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_