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

Unified Diff: chrome/browser/ui/views/avatar_menu_bubble_view.cc

Issue 8744010: Revert 112171 - Views: Custom drawing for GAIA avatar pictures (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/avatar_menu_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/avatar_menu_bubble_view.cc
===================================================================
--- chrome/browser/ui/views/avatar_menu_bubble_view.cc (revision 112173)
+++ chrome/browser/ui/views/avatar_menu_bubble_view.cc (working copy)
@@ -10,7 +10,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/avatar_menu_model.h"
#include "chrome/browser/profiles/profile_info_cache.h"
-#include "chrome/browser/profiles/profile_info_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "grit/generated_resources.h"
@@ -35,6 +34,7 @@
const int kItemHeight = 44;
const int kItemMarginY = 4;
+const int kIconWidth = 38;
const int kIconMarginX = 6;
const int kSeparatorPaddingY = 5;
@@ -226,26 +226,17 @@
int width = std::max(name_label_->GetPreferredSize().width(),
sync_state_label_->GetPreferredSize().width());
width = std::max(edit_link_->GetPreferredSize().width(), width);
- return gfx::Size(profiles::kAvatarIconWidth + kIconMarginX + width,
- kItemHeight);
+ return gfx::Size(kIconWidth + kIconMarginX + width, kItemHeight);
}
void ProfileItemView::Layout() {
// Profile icon.
- gfx::Rect icon_rect;
- if (item_.active) {
- // If this is the active item then the icon is already scaled and so
- // just use the preferred size.
- icon_rect.set_size(image_view_->GetPreferredSize());
- icon_rect.set_y((height() - icon_rect.height()) / 2);
- } else {
- const SkBitmap& icon = image_view_->GetImage();
- icon_rect = GetCenteredAndScaledRect(icon.width(), icon.height(), 0, 0,
- profiles::kAvatarIconWidth, height());
- }
+ const SkBitmap& icon = image_view_->GetImage();
+ gfx::Rect icon_rect = GetCenteredAndScaledRect(
+ icon.width(), icon.height(), 0, 0, kIconWidth, height());
image_view_->SetBoundsRect(icon_rect);
- int label_x = profiles::kAvatarIconWidth + kIconMarginX;
+ int label_x = icon_rect.right() + kIconMarginX;
int max_label_width = std::max(width() - label_x, 0);
gfx::Size name_size = name_label_->GetPreferredSize();
name_size.set_width(std::min(name_size.width(), max_label_width));
@@ -306,8 +297,8 @@
// static
SkBitmap ProfileItemView::GetBadgedIcon(const SkBitmap& icon) {
- gfx::Rect icon_rect = GetCenteredAndScaledRect(icon.width(), icon.height(),
- 0, 0, profiles::kAvatarIconWidth, kItemHeight);
+ gfx::Rect icon_rect = GetCenteredAndScaledRect(
+ icon.width(), icon.height(), 0, 0, kIconWidth, kItemHeight);
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
SkBitmap badge = rb.GetImageNamed(IDR_PROFILE_SELECTED);
@@ -370,7 +361,7 @@
gfx::Size add_profile_size = add_profile_link_->GetPreferredSize();
max_width = std::max(max_width,
- add_profile_size.width() + profiles::kAvatarIconWidth + kIconMarginX);
+ add_profile_size.width() + kIconWidth + kIconMarginX);
total_height += add_profile_link_->GetPreferredSize().height();
const int kBubbleViewMaxWidth = 800;
@@ -395,8 +386,8 @@
separator_->SetBounds(0, y, width(), separator_height);
y += kSeparatorPaddingY + separator_height;
- add_profile_link_->SetBounds(profiles::kAvatarIconWidth + kIconMarginX, y,
- width(), add_profile_link_->GetPreferredSize().height());
+ add_profile_link_->SetBounds(kIconWidth + kIconMarginX, y, width(),
+ add_profile_link_->GetPreferredSize().height());
}
bool AvatarMenuBubbleView::AcceleratorPressed(
« no previous file with comments | « no previous file | chrome/browser/ui/views/avatar_menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698