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

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

Issue 668773002: [Win] The new profiles UI: now at an immersive mode near you (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix generic avatar centering Created 6 years, 2 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 03b3fd6af1e1e3aa0703185b789b02d37d00f74f..e02afc362a9653c53faed6236d72b99b2d00f4bd 100644
--- a/chrome/browser/ui/views/profiles/new_avatar_button.cc
+++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc
@@ -53,8 +53,6 @@ NewAvatarButton::NewAvatarButton(views::ButtonListener* listener,
SetTextColor(views::Button::STATE_NORMAL, SK_ColorWHITE);
SetTextColor(views::Button::STATE_HOVERED, SK_ColorWHITE);
SetTextColor(views::Button::STATE_PRESSED, SK_ColorWHITE);
- SetTextShadows(gfx::ShadowValues(10,
- gfx::ShadowValue(gfx::Point(), 1.0f, SK_ColorDKGRAY)));
SetTextSubpixelRenderingEnabled(false);
SetHorizontalAlignment(gfx::ALIGN_CENTER);
@@ -74,7 +72,8 @@ NewAvatarButton::NewAvatarButton(views::ButtonListener* listener,
generic_avatar_ =
*rb->GetImageNamed(IDR_AVATAR_THEMED_BUTTON_AVATAR).ToImageSkia();
#if defined(OS_WIN)
- } else if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
+ } else if (base::win::GetVersion() >= base::win::VERSION_WIN8 ||
+ browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) {
const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_NORMAL);
const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_HOVER);
const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_PRESSED);
@@ -185,6 +184,12 @@ void NewAvatarButton::UpdateAvatarButtonAndRelayoutParent() {
SetText(use_generic_button ? base::string16() :
profiles::GetAvatarButtonTextForProfile(browser_->profile()));
+
+ // If the button has no text, clear the text shadows to make sure the
+ // image is centered correctly.
+ SetTextShadows(use_generic_button ? gfx::ShadowValues() : gfx::ShadowValues(
+ 10, gfx::ShadowValue(gfx::Point(), 1.0f, SK_ColorDKGRAY)));
+
// We want the button to resize if the new text is shorter.
SetMinSize(gfx::Size());

Powered by Google App Engine
This is Rietveld 408576698