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

Side by Side Diff: chrome/browser/ui/views/profiles/avatar_menu_bubble_view.cc

Issue 257843004: Add in resize logic for the non-badged icons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change resize function used Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 AvatarMenuBubbleView* parent, 253 AvatarMenuBubbleView* parent,
254 AvatarMenu* menu) 254 AvatarMenu* menu)
255 : views::CustomButton(parent), 255 : views::CustomButton(parent),
256 item_(item), 256 item_(item),
257 parent_(parent), 257 parent_(parent),
258 menu_(menu) { 258 menu_(menu) {
259 set_notify_enter_exit_on_child(true); 259 set_notify_enter_exit_on_child(true);
260 260
261 image_view_ = new ProfileImageView(); 261 image_view_ = new ProfileImageView();
262 gfx::ImageSkia profile_icon = *item_.icon.ToImageSkia(); 262 gfx::ImageSkia profile_icon = *item_.icon.ToImageSkia();
263 if (item_.active || item_.signin_required) 263 if (item_.active || item_.signin_required) {
264 image_view_->SetImage(GetBadgedIcon(profile_icon)); 264 image_view_->SetImage(GetBadgedIcon(profile_icon));
265 else 265 } else {
266 // The image may be too large are require resizing
msw 2014/04/28 17:56:52 nit: s/are/and/; also add a period at the end.
Mike Lerman 2014/04/28 18:21:07 Done.
267 image_view_->SetImageSize(
msw 2014/04/28 17:56:52 Should this be set all the time, not just in this
Mike Lerman 2014/04/28 18:21:07 The other case, the GetBadgedIcon method, already
msw 2014/04/28 18:40:19 Yeah, I saw that, but BadgeImageSource::ComputeSiz
268 gfx::Size(profiles::kAvatarIconWidth, kItemHeight));
266 image_view_->SetImage(profile_icon); 269 image_view_->SetImage(profile_icon);
270 }
267 AddChildView(image_view_); 271 AddChildView(image_view_);
268 272
269 // Add a label to show the profile name. 273 // Add a label to show the profile name.
270 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 274 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
271 name_label_ = new views::Label(item_.name, 275 name_label_ = new views::Label(item_.name,
272 rb->GetFontList(item_.active ? 276 rb->GetFontList(item_.active ?
273 ui::ResourceBundle::BoldFont : 277 ui::ResourceBundle::BoldFont :
274 ui::ResourceBundle::BaseFont)); 278 ui::ResourceBundle::BaseFont));
275 name_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 279 name_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
276 AddChildView(name_label_); 280 AddChildView(name_label_);
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 Layout(); 803 Layout();
800 if (GetBubbleFrameView()) 804 if (GetBubbleFrameView())
801 SizeToContents(); 805 SizeToContents();
802 } 806 }
803 807
804 void AvatarMenuBubbleView::SetBackgroundColors() { 808 void AvatarMenuBubbleView::SetBackgroundColors() {
805 for (size_t i = 0; i < item_views_.size(); ++i) { 809 for (size_t i = 0; i < item_views_.size(); ++i) {
806 item_views_[i]->OnHighlightStateChanged(); 810 item_views_[i]->OnHighlightStateChanged();
807 } 811 }
808 } 812 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698