| 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 "chrome/browser/ui/passwords/account_avatar_fetcher.h" | 10 #include "chrome/browser/ui/passwords/account_avatar_fetcher.h" |
| 11 #include "ui/views/controls/button/label_button.h" | 11 #include "ui/views/controls/button/label_button.h" |
| 12 #include "ui/views/controls/button/vector_icon_button_delegate.h" |
| 12 | 13 |
| 13 namespace autofill { | 14 namespace autofill { |
| 14 struct PasswordForm; | 15 struct PasswordForm; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace gfx { | 18 namespace gfx { |
| 18 class ImageSkia; | 19 class ImageSkia; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace net { | 22 namespace net { |
| 22 class URLRequestContextGetter; | 23 class URLRequestContextGetter; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace views { | 26 namespace views { |
| 26 class ImageView; | 27 class ImageView; |
| 27 class Label; | 28 class Label; |
| 29 class VectorIconButton; |
| 28 } | 30 } |
| 29 | 31 |
| 30 // CredentialsItemView represents a credential view in the account chooser | 32 // CredentialsItemView represents a credential view in the account chooser |
| 31 // bubble. | 33 // bubble. |
| 32 class CredentialsItemView : public AccountAvatarFetcherDelegate, | 34 class CredentialsItemView : public AccountAvatarFetcherDelegate, |
| 35 public views::VectorIconButtonDelegate, |
| 33 public views::LabelButton { | 36 public views::LabelButton { |
| 34 public: | 37 public: |
| 35 CredentialsItemView(views::ButtonListener* button_listener, | 38 CredentialsItemView(views::ButtonListener* button_listener, |
| 36 const base::string16& upper_text, | 39 const base::string16& upper_text, |
| 37 const base::string16& lower_text, | 40 const base::string16& lower_text, |
| 38 SkColor hover_color, | 41 SkColor hover_color, |
| 39 const autofill::PasswordForm* form, | 42 const autofill::PasswordForm* form, |
| 40 net::URLRequestContextGetter* request_context); | 43 net::URLRequestContextGetter* request_context); |
| 41 ~CredentialsItemView() override; | 44 ~CredentialsItemView() override; |
| 42 | 45 |
| 43 const autofill::PasswordForm* form() const { return form_; } | 46 const autofill::PasswordForm* form() const { return form_; } |
| 44 | 47 |
| 45 // AccountAvatarFetcherDelegate: | 48 // AccountAvatarFetcherDelegate: |
| 46 void UpdateAvatar(const gfx::ImageSkia& image) override; | 49 void UpdateAvatar(const gfx::ImageSkia& image) override; |
| 47 | 50 |
| 48 void SetLowerLabelColor(SkColor color); | 51 void SetLowerLabelColor(SkColor color); |
| 49 void SetHoverColor(SkColor color); | 52 void SetHoverColor(SkColor color); |
| 50 | 53 |
| 51 int GetPreferredHeight() const; | 54 int GetPreferredHeight() const; |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 // views::LabelButton: | 57 // views::LabelButton: |
| 55 gfx::Size GetPreferredSize() const override; | 58 gfx::Size GetPreferredSize() const override; |
| 56 int GetHeightForWidth(int w) const override; | 59 int GetHeightForWidth(int w) const override; |
| 57 void Layout() override; | 60 void Layout() override; |
| 58 void OnPaint(gfx::Canvas* canvas) override; | 61 void OnPaint(gfx::Canvas* canvas) override; |
| 59 | 62 |
| 63 // VectorIconButtonDelegate: |
| 64 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 65 SkColor GetVectorIconBaseColor() const override; |
| 66 |
| 60 const autofill::PasswordForm* form_; | 67 const autofill::PasswordForm* form_; |
| 61 | 68 |
| 62 views::ImageView* image_view_; | 69 views::ImageView* image_view_; |
| 63 views::Label* upper_label_; | 70 views::Label* upper_label_; |
| 64 views::Label* lower_label_; | 71 views::Label* lower_label_; |
| 72 views::VectorIconButton* info_button_; |
| 65 | 73 |
| 66 SkColor hover_color_; | 74 SkColor hover_color_; |
| 67 | 75 |
| 68 base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_; | 76 base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_; |
| 69 | 77 |
| 70 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView); | 78 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView); |
| 71 }; | 79 }; |
| 72 | 80 |
| 73 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ | 81 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ |
| OLD | NEW |