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

Unified Diff: chrome/browser/ui/views/profiles/new_avatar_button.cc

Issue 297143008: [Win] UI fixes for the new avatar button/bubble auth errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: undid auth image resizing + fixed glass button positioning Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/profiles/new_avatar_button.cc
diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.cc b/chrome/browser/ui/views/profiles/new_avatar_button.cc
index 117f703edd5f3505f2c7f86bcfde089611349b8d..c7b4b080a16039133c33a976b5ed96bc9fa98f1c 100644
--- a/chrome/browser/ui/views/profiles/new_avatar_button.cc
+++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc
@@ -30,22 +30,31 @@ namespace {
// Text padding within the button border.
const int kLeftRightInset = 7;
const int kTopBottomInset = 2;
+// The button in themed windows is slightly smaller, so it needs an extra
+// bottom inset so that the text doesn't get rendered outside the borders.
+const int kThemedWindowExtraBottomInset = 2;
+// Target size of the warning icon.
msw 2014/06/19 04:10:18 Remove these unused consts.
noms (inactive) 2014/06/19 15:10:55 Done.
+const int kAuthErrorIconWidth = 13;
+const int kAuthErrorIconHeight = 11;
scoped_ptr<views::Border> CreateBorder(const int normal_image_set[],
const int hot_image_set[],
- const int pushed_image_set[]) {
+ const int pushed_image_set[],
+ bool is_themed_window) {
scoped_ptr<views::LabelButtonBorder> border(
new views::LabelButtonBorder(views::Button::STYLE_TEXTBUTTON));
-
border->SetPainter(false, views::Button::STATE_NORMAL,
views::Painter::CreateImageGridPainter(normal_image_set));
border->SetPainter(false, views::Button::STATE_HOVERED,
views::Painter::CreateImageGridPainter(hot_image_set));
border->SetPainter(false, views::Button::STATE_PRESSED,
views::Painter::CreateImageGridPainter(pushed_image_set));
-
- border->set_insets(gfx::Insets(kTopBottomInset, kLeftRightInset,
- kTopBottomInset, kLeftRightInset));
+ int bottom_inset = is_themed_window ?
+ kTopBottomInset + kThemedWindowExtraBottomInset : kTopBottomInset;
+ int top_inset = is_themed_window ?
+ kTopBottomInset - kThemedWindowExtraBottomInset : kTopBottomInset;
+ border->set_insets(gfx::Insets(top_inset, kLeftRightInset,
msw 2014/06/19 04:10:17 Ah, I'm sorry to put you out, but can you see if t
noms (inactive) 2014/06/19 15:10:55 Patched in your CL, and your insets look good. I'v
+ bottom_inset, kLeftRightInset));
return border.PassAs<views::Border>();
}
@@ -95,7 +104,8 @@ NewAvatarButton::NewAvatarButton(
const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_HOVER);
const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_PRESSED);
- SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet));
+ SetBorder(
+ CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet, true));
set_menu_marker(
rb->GetImageNamed(IDR_AVATAR_THEMED_BUTTON_DROPARROW).ToImageSkia());
} else if (is_win8) {
@@ -103,7 +113,8 @@ NewAvatarButton::NewAvatarButton(
const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_HOVER);
const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_PRESSED);
- SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet));
+ SetBorder(
+ CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet, false));
set_menu_marker(
rb->GetImageNamed(IDR_AVATAR_METRO_BUTTON_DROPARROW).ToImageSkia());
} else {
@@ -111,7 +122,8 @@ NewAvatarButton::NewAvatarButton(
const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_GLASS_BUTTON_HOVER);
const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_GLASS_BUTTON_PRESSED);
- SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet));
+ SetBorder(
+ CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet, false));
set_menu_marker(
rb->GetImageNamed(IDR_AVATAR_GLASS_BUTTON_DROPARROW).ToImageSkia());
}
@@ -163,8 +175,8 @@ void NewAvatarButton::OnErrorChanged() {
const SigninErrorController* error =
profiles::GetSigninErrorController(browser_->profile());
if (error && error->HasError()) {
- ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
- icon = *rb->GetImageNamed(IDR_WARNING).ToImageSkia();
+ icon = *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
+ IDR_ICON_PROFILES_AVATAR_BUTTON_ERROR).ToImageSkia();
msw 2014/06/19 04:10:18 Did you mean to leave this as IDR_WARNING?
noms (inactive) 2014/06/19 15:10:55 Nope! IDR_WARNING was a placeholder while we were
}
SetImage(views::Button::STATE_NORMAL, icon);

Powered by Google App Engine
This is Rietveld 408576698