Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / views / passwords / credentials_item_view.h
blobc9f98deb8255af863c079ed07381118975c2cfc4
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"
14 namespace autofill {
15 struct PasswordForm;
18 namespace gfx {
19 class ImageSkia;
22 namespace net {
23 class URLRequestContextGetter;
26 namespace views {
27 class ImageView;
28 class Label;
31 // CredentialsItemView represents a credential view in the account chooser
32 // bubble.
33 class CredentialsItemView : public AccountAvatarFetcherDelegate,
34 public views::LabelButton {
35 public:
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;
52 private:
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_