OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 icon.width(), icon.height(), 0, 0, kIconWidth, kItemHeight); | 303 icon.width(), icon.height(), 0, 0, kIconWidth, kItemHeight); |
304 | 304 |
305 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 305 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
306 SkBitmap badge = rb.GetImageNamed(IDR_PROFILE_SELECTED); | 306 SkBitmap badge = rb.GetImageNamed(IDR_PROFILE_SELECTED); |
307 const float kBadgeOverlapRatioX = 1.0f / 5.0f; | 307 const float kBadgeOverlapRatioX = 1.0f / 5.0f; |
308 int width = icon_rect.width() + badge.width() * kBadgeOverlapRatioX; | 308 int width = icon_rect.width() + badge.width() * kBadgeOverlapRatioX; |
309 const float kBadgeOverlapRatioY = 1.0f / 3.0f; | 309 const float kBadgeOverlapRatioY = 1.0f / 3.0f; |
310 int height = icon_rect.height() + badge.height() * kBadgeOverlapRatioY; | 310 int height = icon_rect.height() + badge.height() * kBadgeOverlapRatioY; |
311 | 311 |
312 gfx::CanvasSkia canvas(width, height, false); | 312 gfx::CanvasSkia canvas(width, height, false); |
313 canvas.DrawBitmapInt(icon, 0, 0, icon.width(), icon.height(), 0, 0, | 313 if (icon.width() == icon_rect.width() && |
314 icon_rect.width(), icon_rect.height(), true); | 314 icon.height() == icon_rect.height()) { |
| 315 canvas.DrawBitmapInt(icon, 1, 1); |
| 316 } else { |
| 317 canvas.DrawBitmapInt(icon, 0, 0, icon.width(), icon.height(), 0, 0, |
| 318 icon_rect.width(), icon_rect.height(), true); |
| 319 } |
315 canvas.DrawBitmapInt(badge, width - badge.width(), height - badge.height()); | 320 canvas.DrawBitmapInt(badge, width - badge.width(), height - badge.height()); |
316 return canvas.ExtractBitmap(); | 321 return canvas.ExtractBitmap(); |
317 } | 322 } |
318 | 323 |
319 bool ProfileItemView::IsHighlighted() { | 324 bool ProfileItemView::IsHighlighted() { |
320 return state() == views::CustomButton::BS_PUSHED || | 325 return state() == views::CustomButton::BS_PUSHED || |
321 state() == views::CustomButton::BS_HOT || | 326 state() == views::CustomButton::BS_HOT || |
322 edit_link_->state() == views::CustomButton::BS_PUSHED || | 327 edit_link_->state() == views::CustomButton::BS_PUSHED || |
323 edit_link_->state() == views::CustomButton::BS_HOT || | 328 edit_link_->state() == views::CustomButton::BS_HOT || |
324 HasFocus() || | 329 HasFocus() || |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 add_profile_link_ = new views::Link( | 492 add_profile_link_ = new views::Link( |
488 l10n_util::GetStringUTF16(IDS_PROFILES_CREATE_NEW_PROFILE_LINK)); | 493 l10n_util::GetStringUTF16(IDS_PROFILES_CREATE_NEW_PROFILE_LINK)); |
489 add_profile_link_->set_listener(this); | 494 add_profile_link_->set_listener(this); |
490 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 495 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
491 add_profile_link_->SetBackgroundColor(Bubble::kBackgroundColor); | 496 add_profile_link_->SetBackgroundColor(Bubble::kBackgroundColor); |
492 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6)); | 497 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6)); |
493 AddChildView(add_profile_link_); | 498 AddChildView(add_profile_link_); |
494 | 499 |
495 PreferredSizeChanged(); | 500 PreferredSizeChanged(); |
496 } | 501 } |
OLD | NEW |