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/content/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
{
41 CredentialsItemView(views::ButtonListener
* button_listener
,
42 const autofill::PasswordForm
* form
,
43 password_manager::CredentialType credential_type
,
45 net::URLRequestContextGetter
* request_context
);
46 ~CredentialsItemView() override
;
48 const autofill::PasswordForm
* form() const { return form_
; }
49 password_manager::CredentialType
credential_type() const {
50 return credential_type_
;
53 // AccountAvatarFetcherDelegate:
54 void UpdateAvatar(const gfx::ImageSkia
& image
) override
;
57 // views::LabelButton:
58 gfx::Size
GetPreferredSize() const override
;
59 int GetHeightForWidth(int w
) const override
;
60 void Layout() override
;
62 const autofill::PasswordForm
* form_
;
63 const password_manager::CredentialType credential_type_
;
65 views::ImageView
* image_view_
;
66 views::Label
* upper_label_
;
67 views::Label
* lower_label_
;
69 base::WeakPtrFactory
<CredentialsItemView
> weak_ptr_factory_
;
71 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView
);
74 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_