OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "components/autofill/core/common/password_form.h" | 10 #include "components/autofill/core/common/password_form.h" |
| 11 #include "components/password_manager/content/common/credential_manager_types.h" |
11 #include "ui/views/controls/button/label_button.h" | 12 #include "ui/views/controls/button/label_button.h" |
12 | 13 |
13 namespace gfx { | 14 namespace gfx { |
14 class ImageSkia; | 15 class ImageSkia; |
15 } | 16 } |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 class URLRequestContextGetter; | 19 class URLRequestContextGetter; |
19 } | 20 } |
20 | 21 |
21 namespace views { | 22 namespace views { |
22 class ImageView; | 23 class ImageView; |
23 class Label; | 24 class Label; |
24 } | 25 } |
25 | 26 |
26 // CredentialsItemView represents a credential view in the account chooser | 27 // CredentialsItemView represents a credential view in the account chooser |
27 // bubble. | 28 // bubble. |
28 class CredentialsItemView : public views::LabelButton { | 29 class CredentialsItemView : public views::LabelButton { |
29 public: | 30 public: |
30 CredentialsItemView(views::ButtonListener* button_listener, | 31 CredentialsItemView(views::ButtonListener* button_listener, |
31 const autofill::PasswordForm& form, | 32 const autofill::PasswordForm& form, |
| 33 password_manager::CredentialType credential_type, |
32 net::URLRequestContextGetter* request_context); | 34 net::URLRequestContextGetter* request_context); |
33 ~CredentialsItemView() override; | 35 ~CredentialsItemView() override; |
34 | 36 |
35 const autofill::PasswordForm& form() const { return form_; } | 37 const autofill::PasswordForm& form() const { return form_; } |
| 38 password_manager::CredentialType credential_type() const { |
| 39 return credential_type_; |
| 40 } |
36 | 41 |
37 private: | 42 private: |
38 class AvatarFetcher; | 43 class AvatarFetcher; |
39 | 44 |
40 // views::LabelButton: | 45 // views::LabelButton: |
41 gfx::Size GetPreferredSize() const override; | 46 gfx::Size GetPreferredSize() const override; |
42 int GetHeightForWidth(int w) const override; | 47 int GetHeightForWidth(int w) const override; |
43 void Layout() override; | 48 void Layout() override; |
44 | 49 |
45 void UpdateAvatar(const gfx::ImageSkia& image); | 50 void UpdateAvatar(const gfx::ImageSkia& image); |
46 | 51 |
47 autofill::PasswordForm form_; | 52 autofill::PasswordForm form_; |
| 53 password_manager::CredentialType credential_type_; |
48 | 54 |
49 views::ImageView* image_view_; | 55 views::ImageView* image_view_; |
50 views::Label* full_name_label_; | 56 views::Label* full_name_label_; |
51 views::Label* username_label_; | 57 views::Label* username_label_; |
52 | 58 |
53 base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_; | 59 base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_; |
54 | 60 |
55 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView); | 61 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView); |
56 }; | 62 }; |
57 | 63 |
58 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ | 64 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ |
OLD | NEW |