Chromium Code Reviews| 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/custom_button.h" |
| 12 | 12 |
| 13 namespace autofill { | 13 namespace autofill { |
| 14 struct PasswordForm; | 14 struct PasswordForm; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class ImageSkia; | 18 class ImageSkia; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 class URLRequestContextGetter; | 22 class URLRequestContextGetter; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace views { | 25 namespace views { |
| 26 class ImageView; | 26 class ImageView; |
| 27 class Label; | 27 class Label; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // CredentialsItemView represents a credential view in the account chooser | 30 // CredentialsItemView represents a credential view in the account chooser |
| 31 // bubble. | 31 // bubble. |
| 32 class CredentialsItemView : public AccountAvatarFetcherDelegate, | 32 class CredentialsItemView : public AccountAvatarFetcherDelegate, |
| 33 public views::LabelButton { | 33 public views::CustomButton { |
| 34 public: | 34 public: |
| 35 CredentialsItemView(views::ButtonListener* button_listener, | 35 CredentialsItemView(views::ButtonListener* button_listener, |
| 36 const base::string16& upper_text, | 36 const base::string16& upper_text, |
| 37 const base::string16& lower_text, | 37 const base::string16& lower_text, |
| 38 SkColor hover_color, | 38 SkColor hover_color, |
| 39 const autofill::PasswordForm* form, | 39 const autofill::PasswordForm* form, |
| 40 net::URLRequestContextGetter* request_context); | 40 net::URLRequestContextGetter* request_context); |
| 41 ~CredentialsItemView() override; | 41 ~CredentialsItemView() override; |
| 42 | 42 |
| 43 const autofill::PasswordForm* form() const { return form_; } | 43 const autofill::PasswordForm* form() const { return form_; } |
| 44 | 44 |
| 45 // AccountAvatarFetcherDelegate: | 45 // AccountAvatarFetcherDelegate: |
| 46 void UpdateAvatar(const gfx::ImageSkia& image) override; | 46 void UpdateAvatar(const gfx::ImageSkia& image) override; |
| 47 | 47 |
| 48 void SetLowerLabelColor(SkColor color); | 48 void SetLowerLabelColor(SkColor color); |
| 49 void SetHoverColor(SkColor color); | 49 void SetHoverColor(SkColor color); |
| 50 | 50 |
| 51 int GetPreferredHeight() const; | 51 int GetPreferredHeight() const; |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 // views::LabelButton: | 54 // views::View: |
| 55 gfx::Size GetPreferredSize() const override; | 55 gfx::Size GetPreferredSize() const override; |
| 56 int GetHeightForWidth(int w) const override; | 56 int GetHeightForWidth(int w) const override; |
| 57 void Layout() override; | 57 void Layout() override; |
| 58 void OnPaint(gfx::Canvas* canvas) override; | 58 void OnPaint(gfx::Canvas* canvas) override; |
| 59 | 59 |
| 60 void NotifyClick(const ui::Event& event) override; | |
|
msw
2017/02/15 21:06:37
nit: add |// views::CustomButton:| above this
vasilii
2017/02/16 14:28:06
It's obsolete code.
| |
| 61 | |
| 60 const autofill::PasswordForm* form_; | 62 const autofill::PasswordForm* form_; |
| 61 | 63 |
| 62 views::ImageView* image_view_; | 64 views::ImageView* image_view_; |
| 63 views::Label* upper_label_; | 65 views::Label* upper_label_; |
| 64 views::Label* lower_label_; | 66 views::Label* lower_label_; |
| 65 views::ImageView* info_icon_; | 67 views::ImageView* info_icon_; |
| 66 | 68 |
| 67 SkColor hover_color_; | 69 SkColor hover_color_; |
| 68 | 70 |
| 69 base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_; | 71 base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_; |
| 70 | 72 |
| 71 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView); | 73 DISALLOW_COPY_AND_ASSIGN(CredentialsItemView); |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ | 76 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_ |
| OLD | NEW |