Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/ui/views/passwords/credentials_item_view.h

Issue 901493003: Extract some account chooser views things for cross-platform use. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/ui/passwords/account_avatar_fetcher.h"
10 #include "components/autofill/core/common/password_form.h" 11 #include "components/autofill/core/common/password_form.h"
11 #include "components/password_manager/content/common/credential_manager_types.h" 12 #include "components/password_manager/content/common/credential_manager_types.h"
12 #include "ui/views/controls/button/label_button.h" 13 #include "ui/views/controls/button/label_button.h"
13 14
14 namespace gfx { 15 namespace gfx {
15 class ImageSkia; 16 class ImageSkia;
16 } 17 }
17 18
18 namespace net { 19 namespace net {
19 class URLRequestContextGetter; 20 class URLRequestContextGetter;
20 } 21 }
21 22
22 namespace views { 23 namespace views {
23 class ImageView; 24 class ImageView;
24 class Label; 25 class Label;
25 } 26 }
26 27
27 // CredentialsItemView represents a credential view in the account chooser 28 // CredentialsItemView represents a credential view in the account chooser
28 // bubble. 29 // bubble.
29 class CredentialsItemView : public views::LabelButton { 30 class CredentialsItemView : public AccountAvatarFetcherDelegate,
31 public views::LabelButton {
30 public: 32 public:
31 CredentialsItemView(views::ButtonListener* button_listener, 33 CredentialsItemView(views::ButtonListener* button_listener,
32 const autofill::PasswordForm& form, 34 const autofill::PasswordForm& form,
33 password_manager::CredentialType credential_type, 35 password_manager::CredentialType credential_type,
34 net::URLRequestContextGetter* request_context); 36 net::URLRequestContextGetter* request_context);
35 ~CredentialsItemView() override; 37 ~CredentialsItemView() override;
36 38
37 const autofill::PasswordForm& form() const { return form_; } 39 const autofill::PasswordForm& form() const { return form_; }
38 password_manager::CredentialType credential_type() const { 40 password_manager::CredentialType credential_type() const {
39 return credential_type_; 41 return credential_type_;
40 } 42 }
41 43
44 // AccountAvatarFetcherDelegate:
45 void UpdateAvatar(const gfx::ImageSkia& image) override;
46
42 private: 47 private:
43 class AvatarFetcher;
44
45 // views::LabelButton: 48 // views::LabelButton:
46 gfx::Size GetPreferredSize() const override; 49 gfx::Size GetPreferredSize() const override;
47 int GetHeightForWidth(int w) const override; 50 int GetHeightForWidth(int w) const override;
48 void Layout() override; 51 void Layout() override;
49 52
50 void UpdateAvatar(const gfx::ImageSkia& image);
51
52 autofill::PasswordForm form_; 53 autofill::PasswordForm form_;
53 password_manager::CredentialType credential_type_; 54 password_manager::CredentialType credential_type_;
54 55
55 views::ImageView* image_view_; 56 views::ImageView* image_view_;
56 views::Label* full_name_label_; 57 views::Label* full_name_label_;
57 views::Label* username_label_; 58 views::Label* username_label_;
58 59
59 base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_; 60 base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_;
60 61
61 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView); 62 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView);
62 }; 63 };
63 64
64 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ 65 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_view_utils.cc ('k') | chrome/browser/ui/views/passwords/credentials_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698