| 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 #include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h" | 5 #include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // BadgeImageSource ----------------------------------------------------------- | 81 // BadgeImageSource ----------------------------------------------------------- |
| 82 class BadgeImageSource: public gfx::CanvasImageSource { | 82 class BadgeImageSource: public gfx::CanvasImageSource { |
| 83 public: | 83 public: |
| 84 BadgeImageSource(const gfx::ImageSkia& icon, | 84 BadgeImageSource(const gfx::ImageSkia& icon, |
| 85 const gfx::Size& icon_size, | 85 const gfx::Size& icon_size, |
| 86 const gfx::ImageSkia& badge); | 86 const gfx::ImageSkia& badge); |
| 87 | 87 |
| 88 virtual ~BadgeImageSource(); | 88 virtual ~BadgeImageSource(); |
| 89 | 89 |
| 90 // Overridden from CanvasImageSource: | 90 // Overridden from CanvasImageSource: |
| 91 virtual void Draw(gfx::Canvas* canvas) OVERRIDE; | 91 virtual void Draw(gfx::Canvas* canvas) override; |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 gfx::Size ComputeSize(const gfx::ImageSkia& icon, | 94 gfx::Size ComputeSize(const gfx::ImageSkia& icon, |
| 95 const gfx::Size& size, | 95 const gfx::Size& size, |
| 96 const gfx::ImageSkia& badge); | 96 const gfx::ImageSkia& badge); |
| 97 | 97 |
| 98 const gfx::ImageSkia icon_; | 98 const gfx::ImageSkia icon_; |
| 99 gfx::Size icon_size_; | 99 gfx::Size icon_size_; |
| 100 const gfx::ImageSkia badge_; | 100 const gfx::ImageSkia badge_; |
| 101 | 101 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // EditProfileLink ------------------------------------------------------------ | 145 // EditProfileLink ------------------------------------------------------------ |
| 146 | 146 |
| 147 // A custom Link control that forwards highlight state changes. We need to do | 147 // A custom Link control that forwards highlight state changes. We need to do |
| 148 // this to make sure that the ProfileItemView looks highlighted even when | 148 // this to make sure that the ProfileItemView looks highlighted even when |
| 149 // the mouse is over this link. | 149 // the mouse is over this link. |
| 150 class EditProfileLink : public views::Link { | 150 class EditProfileLink : public views::Link { |
| 151 public: | 151 public: |
| 152 explicit EditProfileLink(const base::string16& title, | 152 explicit EditProfileLink(const base::string16& title, |
| 153 HighlightDelegate* delegate); | 153 HighlightDelegate* delegate); |
| 154 | 154 |
| 155 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 155 virtual void OnMouseEntered(const ui::MouseEvent& event) override; |
| 156 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 156 virtual void OnMouseExited(const ui::MouseEvent& event) override; |
| 157 virtual void OnFocus() OVERRIDE; | 157 virtual void OnFocus() override; |
| 158 virtual void OnBlur() OVERRIDE; | 158 virtual void OnBlur() override; |
| 159 | 159 |
| 160 views::CustomButton::ButtonState state() { return state_; } | 160 views::CustomButton::ButtonState state() { return state_; } |
| 161 | 161 |
| 162 private: | 162 private: |
| 163 HighlightDelegate* delegate_; | 163 HighlightDelegate* delegate_; |
| 164 views::CustomButton::ButtonState state_; | 164 views::CustomButton::ButtonState state_; |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 EditProfileLink::EditProfileLink(const base::string16& title, | 167 EditProfileLink::EditProfileLink(const base::string16& title, |
| 168 HighlightDelegate* delegate) | 168 HighlightDelegate* delegate) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // ProfileItemView ------------------------------------------------------------ | 200 // ProfileItemView ------------------------------------------------------------ |
| 201 | 201 |
| 202 // Control that shows information about a single profile. | 202 // Control that shows information about a single profile. |
| 203 class ProfileItemView : public views::CustomButton, | 203 class ProfileItemView : public views::CustomButton, |
| 204 public HighlightDelegate { | 204 public HighlightDelegate { |
| 205 public: | 205 public: |
| 206 ProfileItemView(const AvatarMenu::Item& item, | 206 ProfileItemView(const AvatarMenu::Item& item, |
| 207 AvatarMenuBubbleView* parent, | 207 AvatarMenuBubbleView* parent, |
| 208 AvatarMenu* menu); | 208 AvatarMenu* menu); |
| 209 | 209 |
| 210 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 210 virtual gfx::Size GetPreferredSize() const override; |
| 211 virtual void Layout() OVERRIDE; | 211 virtual void Layout() override; |
| 212 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 212 virtual void OnMouseEntered(const ui::MouseEvent& event) override; |
| 213 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 213 virtual void OnMouseExited(const ui::MouseEvent& event) override; |
| 214 virtual void OnFocus() OVERRIDE; | 214 virtual void OnFocus() override; |
| 215 virtual void OnBlur() OVERRIDE; | 215 virtual void OnBlur() override; |
| 216 | 216 |
| 217 virtual void OnHighlightStateChanged() OVERRIDE; | 217 virtual void OnHighlightStateChanged() override; |
| 218 virtual void OnFocusStateChanged(bool has_focus) OVERRIDE; | 218 virtual void OnFocusStateChanged(bool has_focus) override; |
| 219 | 219 |
| 220 const AvatarMenu::Item& item() const { return item_; } | 220 const AvatarMenu::Item& item() const { return item_; } |
| 221 EditProfileLink* edit_link() { return edit_link_; } | 221 EditProfileLink* edit_link() { return edit_link_; } |
| 222 | 222 |
| 223 private: | 223 private: |
| 224 gfx::ImageSkia GetBadgedIcon(const gfx::ImageSkia& icon); | 224 gfx::ImageSkia GetBadgedIcon(const gfx::ImageSkia& icon); |
| 225 | 225 |
| 226 bool IsHighlighted(); | 226 bool IsHighlighted(); |
| 227 | 227 |
| 228 AvatarMenu::Item item_; | 228 AvatarMenu::Item item_; |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 Layout(); | 796 Layout(); |
| 797 if (GetBubbleFrameView()) | 797 if (GetBubbleFrameView()) |
| 798 SizeToContents(); | 798 SizeToContents(); |
| 799 } | 799 } |
| 800 | 800 |
| 801 void AvatarMenuBubbleView::SetBackgroundColors() { | 801 void AvatarMenuBubbleView::SetBackgroundColors() { |
| 802 for (size_t i = 0; i < item_views_.size(); ++i) { | 802 for (size_t i = 0; i < item_views_.size(); ++i) { |
| 803 item_views_[i]->OnHighlightStateChanged(); | 803 item_views_[i]->OnHighlightStateChanged(); |
| 804 } | 804 } |
| 805 } | 805 } |
| OLD | NEW |