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

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

Issue 10382144: Change SetImage, SetBackground, and SetToggledImage to take in a gfx::ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/avatar_menu_bubble_view.h" 5 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 ProfileItemView::ProfileItemView(const AvatarMenuModel::Item& item, 177 ProfileItemView::ProfileItemView(const AvatarMenuModel::Item& item,
178 views::ButtonListener* switch_profile_listener, 178 views::ButtonListener* switch_profile_listener,
179 views::LinkListener* edit_profile_listener) 179 views::LinkListener* edit_profile_listener)
180 : views::CustomButton(switch_profile_listener), 180 : views::CustomButton(switch_profile_listener),
181 item_(item) { 181 item_(item) {
182 image_view_ = new ProfileImageView(); 182 image_view_ = new ProfileImageView();
183 SkBitmap profile_icon = *item_.icon.ToSkBitmap(); 183 SkBitmap profile_icon = *item_.icon.ToSkBitmap();
184 if (item_.active) { 184 if (item_.active) {
185 SkBitmap badged_icon(GetBadgedIcon(profile_icon)); 185 SkBitmap badged_icon(GetBadgedIcon(profile_icon));
186 image_view_->SetImage(&badged_icon); 186 image_view_->SetImage(badged_icon);
187 } else { 187 } else {
188 image_view_->SetImage(&profile_icon); 188 image_view_->SetImage(profile_icon);
189 } 189 }
190 AddChildView(image_view_); 190 AddChildView(image_view_);
191 191
192 // Add a label to show the profile name. 192 // Add a label to show the profile name.
193 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 193 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
194 const gfx::Font base_font = rb.GetFont(ui::ResourceBundle::BaseFont); 194 const gfx::Font base_font = rb.GetFont(ui::ResourceBundle::BaseFont);
195 const int style = item_.active ? gfx::Font::BOLD : 0; 195 const int style = item_.active ? gfx::Font::BOLD : 0;
196 const int kNameFontDelta = 1; 196 const int kNameFontDelta = 1;
197 name_label_ = new views::Label(item_.name, 197 name_label_ = new views::Label(item_.name,
198 base_font.DeriveFont(kNameFontDelta, style)); 198 base_font.DeriveFont(kNameFontDelta, style));
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 505 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
506 add_profile_link_->SetBackgroundColor(color()); 506 add_profile_link_->SetBackgroundColor(color());
507 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6)); 507 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6));
508 AddChildView(add_profile_link_); 508 AddChildView(add_profile_link_);
509 509
510 // If the bubble has already been shown then resize and reposition the bubble. 510 // If the bubble has already been shown then resize and reposition the bubble.
511 Layout(); 511 Layout();
512 if (GetBubbleFrameView()) 512 if (GetBubbleFrameView())
513 SizeToContents(); 513 SizeToContents();
514 } 514 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698