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

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: resize avatar manually so it looks cool! 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 namespace gfx {
14 class Image;
15 }
16
17 namespace net {
18 class URLRequestContextGetter;
19 }
20
12 namespace views { 21 namespace views {
13 class ImageView; 22 class ImageView;
14 class Label; 23 class Label;
15 } 24 }
16 25
17 // CredentialsItemView represents a credential view in the account chooser 26 // CredentialsItemView represents a credential view in the account chooser
18 // bubble. 27 // bubble.
19 class CredentialsItemView : public views::LabelButton { 28 class CredentialsItemView : public views::LabelButton {
20 public: 29 public:
21 CredentialsItemView(views::ButtonListener* button_listener, 30 CredentialsItemView(views::ButtonListener* button_listener,
22 const autofill::PasswordForm& form); 31 const autofill::PasswordForm& form,
32 net::URLRequestContextGetter* request_context);
23 ~CredentialsItemView() override; 33 ~CredentialsItemView() override;
24 34
25 const autofill::PasswordForm& form() const { return form_; } 35 const autofill::PasswordForm& form() const { return form_; }
26 36
27 private: 37 private:
38 class AvatarFetcher;
39
28 // views::LabelButton: 40 // views::LabelButton:
29 gfx::Size GetPreferredSize() const override; 41 gfx::Size GetPreferredSize() const override;
30 int GetHeightForWidth(int w) const override; 42 int GetHeightForWidth(int w) const override;
31 void Layout() override; 43 void Layout() override;
32 44
45 void UpdateAvatar(const gfx::Image& image);
46
33 autofill::PasswordForm form_; 47 autofill::PasswordForm form_;
34 48
35 views::ImageView* image_view_; 49 views::ImageView* image_view_;
36 views::Label* full_name_label_; 50 views::Label* full_name_label_;
37 views::Label* username_label_; 51 views::Label* username_label_;
38 52
53 base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_;
54
39 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView); 55 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView);
40 }; 56 };
41 57
42 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ 58 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698