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

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: fix avatar buttons + redo the bubble warning icon 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 cd056578565a259cfa6975e3d3d3849dd20d31bd..fbd8ff0e55367fbeff7f82d284c18974fbfc95bb 100644
--- a/chrome/browser/ui/views/profiles/new_avatar_button.cc
+++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc
@@ -18,6 +18,7 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/font_list.h"
+#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/text_elider.h"
#include "ui/views/border.h"
#include "ui/views/painter.h"
@@ -26,14 +27,20 @@ namespace {
// Text padding within the button border.
const int kInset = 10;
+const int kTopInset = 7;
+const int kBottomInset = 3;
+// Target size of the warning icon.
+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::TextButtonDefaultBorder> border(
new views::TextButtonDefaultBorder());
-
- border->SetInsets(gfx::Insets(kInset, kInset, kInset, kInset));
+ int bottom_inset = is_themed_window ? kBottomInset + kInset : kInset;
+ border->SetInsets(gfx::Insets(kTopInset, kInset, bottom_inset, kInset));
border->set_normal_painter(
views::Painter::CreateImageGridPainter(normal_image_set));
border->set_hot_painter(
@@ -85,7 +92,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) {
@@ -93,7 +101,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 {
@@ -101,7 +110,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());
}
@@ -133,7 +143,7 @@ NewAvatarButton::~NewAvatarButton() {
void NewAvatarButton::OnPaintText(gfx::Canvas* canvas, PaintButtonMode mode) {
// Get text bounds, and then adjust for the top and RTL languages.
gfx::Rect rect = GetTextBounds();
- rect.Offset(0, -rect.y());
msw 2014/06/09 21:42:40 Sorry, but this will be changing with Elliot's <ht
noms (inactive) 2014/06/18 18:07:24 Done.
+
if (rect.width() > 0)
rect.set_x(GetMirroredXForRect(rect));
@@ -170,7 +180,10 @@ void NewAvatarButton::OnErrorChanged() {
profiles::GetSigninErrorController(browser_->profile());
if (error && error->HasError()) {
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
- icon = *rb->GetImageNamed(IDR_WARNING).ToImageSkia();
+ icon = gfx::ImageSkiaOperations::CreateResizedImage(
+ *rb->GetImageNamed(IDR_ICON_PROFILES_ACCOUNT_AUTH_ERROR).ToImageSkia(),
+ skia::ImageOperations::RESIZE_BEST,
+ gfx::Size(kAuthErrorIconWidth, kAuthErrorIconHeight));
}
SetIcon(icon);

Powered by Google App Engine
This is Rietveld 408576698