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

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

Issue 854173003: Credential Management API: the account chooser dialog supports custom avatars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 "components/autofill/core/common/password_form.h" 10 #include "components/autofill/core/common/password_form.h"
10 #include "ui/views/controls/button/label_button.h" 11 #include "ui/views/controls/button/label_button.h"
11 12
13 class Profile;
14
15 namespace gfx {
16 class Image;
17 }
18
12 namespace views { 19 namespace views {
13 class ImageView; 20 class ImageView;
14 class Label; 21 class Label;
15 } 22 }
16 23
17 // CredentialsItemView represents a credential view in the account chooser 24 // CredentialsItemView represents a credential view in the account chooser
18 // bubble. 25 // bubble.
19 class CredentialsItemView : public views::LabelButton { 26 class CredentialsItemView : public views::LabelButton {
20 public: 27 public:
21 CredentialsItemView(views::ButtonListener* button_listener, 28 CredentialsItemView(views::ButtonListener* button_listener,
22 const autofill::PasswordForm& form); 29 const autofill::PasswordForm& form,
30 Profile* profile);
23 ~CredentialsItemView() override; 31 ~CredentialsItemView() override;
24 32
25 const autofill::PasswordForm& form() const { return form_; } 33 const autofill::PasswordForm& form() const { return form_; }
26 34
27 private: 35 private:
36 class AvatarFetcher;
37
28 // views::LabelButton: 38 // views::LabelButton:
29 gfx::Size GetPreferredSize() const override; 39 gfx::Size GetPreferredSize() const override;
30 int GetHeightForWidth(int w) const override; 40 int GetHeightForWidth(int w) const override;
31 void Layout() override; 41 void Layout() override;
32 42
43 void UpdateAvatar(const gfx::Image& image);
44
33 autofill::PasswordForm form_; 45 autofill::PasswordForm form_;
34 46
35 views::ImageView* image_view_; 47 views::ImageView* image_view_;
36 views::Label* full_name_label_; 48 views::Label* full_name_label_;
37 views::Label* username_label_; 49 views::Label* username_label_;
38 50
51 base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_;
52
39 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView); 53 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView);
40 }; 54 };
41 55
42 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ 56 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698