Fast user switcher: Distinguish supervised users from child accounts
[chromium-blink-merge.git] / chrome / browser / ui / views / passwords / credentials_item_view.h
blob4291513fe799a81f6402291ff6f39a54285fe879
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"
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 enum Style {
37 ACCOUNT_CHOOSER,
38 AUTO_SIGNIN,
41 CredentialsItemView(views::ButtonListener* button_listener,
42 const autofill::PasswordForm* form,
43 password_manager::CredentialType credential_type,
44 Style style,
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;
56 private:
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_