Index: chrome/browser/ui/views/avatar_label.cc |
diff --git a/chrome/browser/ui/views/avatar_label.cc b/chrome/browser/ui/views/avatar_label.cc |
index 11a7056be368f783fa056a205d32a6221fcc1b3d..2a3b56839a2598bf42fc4a3a59a2241e364b7a1b 100644 |
--- a/chrome/browser/ui/views/avatar_label.cc |
+++ b/chrome/browser/ui/views/avatar_label.cc |
@@ -9,6 +9,7 @@ |
#include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
#include "chrome/browser/ui/views/frame/browser_view.h" |
#include "grit/generated_resources.h" |
+#include "grit/theme_resources.h" |
#include "ui/base/events/event.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/resource/resource_bundle.h" |
@@ -27,32 +28,26 @@ class AvatarLabelBorder: public views::TextButtonBorder { |
virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE; |
private: |
- scoped_ptr<views::Painter> hot_painter_; |
scoped_ptr<views::Painter> painter_; |
DISALLOW_COPY_AND_ASSIGN(AvatarLabelBorder); |
}; |
AvatarLabelBorder::AvatarLabelBorder(ui::ThemeProvider* theme_provider) { |
- const int kHorizontalInset = 10; |
- const int kVerticalInset = 2; |
- SetInsets(gfx::Insets( |
- kVerticalInset, kHorizontalInset, kVerticalInset, kHorizontalInset)); |
- SkColor color = theme_provider->GetColor( |
- ThemeProperties::COLOR_MANAGED_USER_LABEL_BACKGROUND); |
- SkColor color2 = color_utils::BlendTowardOppositeLuminance(color, 0x20); |
- painter_.reset(views::Painter::CreateVerticalGradient(color, color2)); |
- hot_painter_.reset(views::Painter::CreateVerticalGradient(color2, color)); |
+ const int kHorizontalInsetRight = 10; |
+ const int kHorizontalInsetLeft = 43; |
+ const int kVerticalInsetTop = 2; |
+ const int kVerticalInsetBottom = 3; |
+ SetInsets(gfx::Insets(kVerticalInsetTop, |
+ kHorizontalInsetLeft, |
+ kVerticalInsetBottom, |
+ kHorizontalInsetRight)); |
+ const int kImages[] = IMAGE_GRID(IDR_MANAGED_USER_LABEL); |
+ painter_.reset(views::Painter::CreateImageGridPainter(kImages)); |
} |
void AvatarLabelBorder::Paint(const views::View& view, gfx::Canvas* canvas) { |
- const views::TextButton* button = |
- static_cast<const views::TextButton*>(&view); |
- if (button->state() == views::TextButton::STATE_HOVERED || |
- button->state() == views::TextButton::STATE_PRESSED) |
- hot_painter_->Paint(canvas, view.size()); |
- else |
- painter_->Paint(canvas, view.size()); |
+ painter_->Paint(canvas, view.size()); |
} |
} // namespace |
@@ -63,8 +58,13 @@ AvatarLabel::AvatarLabel(BrowserView* browser_view, |
l10n_util::GetStringUTF16(IDS_MANAGED_USER_AVATAR_LABEL)), |
browser_view_(browser_view), |
theme_provider_(theme_provider) { |
- SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( |
- ui::ResourceBundle::SmallFont)); |
+ gfx::Font font = ui::ResourceBundle::GetSharedInstance().GetFont( |
+ ui::ResourceBundle::BaseFont); |
+ // We need to make sure the font size is 13, otherwise the top of the label |
+ // will not align with the top of the tab. |
+ if (font.GetFontSize() != 13) |
sky
2013/07/03 23:17:31
Can't you instead align to the top so you don't ha
Adrian Kuegel
2013/07/05 14:22:23
In our specification we have two requirements: the
|
+ font = font.DeriveFont(13 - font.GetFontSize()); |
+ SetFont(font); |
ClearMaxTextSize(); |
set_border(new AvatarLabelBorder(theme_provider)); |
UpdateLabelStyle(); |