summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-07 10:22:06 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-07 10:22:06 +0000
commit2d684526d641419370ff793bf88caff2b00451db (patch)
tree4a900b7470a7d917822a9d4e1857ec421a1b3e5e
parente0b2c31216364d21931a0dde84cffe5cdfbe9bef (diff)
downloadchromium_src-2d684526d641419370ff793bf88caff2b00451db.zip
chromium_src-2d684526d641419370ff793bf88caff2b00451db.tar.gz
chromium_src-2d684526d641419370ff793bf88caff2b00451db.tar.bz2
chromeos/aura: Make login screen status area font non-bold.
This removes StatusAreaButton::Delegate's GetStatusAreaFont() method and updates the text styles returned by GetStatusAreaTextStyle() to include the font weight. I'm also removing the translucency from the light gray text style so it'll match the header text on the WebUI login page. BUG=111364 TEST=manual Review URL: http://codereview.chromium.org/9307099 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120756 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc10
-rw-r--r--chrome/browser/chromeos/frame/browser_view.h3
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.cc6
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.h1
-rw-r--r--chrome/browser/chromeos/status/status_area_button.cc23
-rw-r--r--chrome/browser/chromeos/status/status_area_button.h22
-rw-r--r--chrome/browser/ui/views/aura/status_area_host_aura.cc18
-rw-r--r--chrome/browser/ui/views/aura/status_area_host_aura.h1
-rw-r--r--chrome/browser/ui/views/aura/status_area_host_aura_browsertest.cc16
9 files changed, 46 insertions, 54 deletions
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index ca97e16..db3516e 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -527,19 +527,15 @@ void BrowserView::ExecuteStatusAreaCommand(
}
}
-gfx::Font BrowserView::GetStatusAreaFont(const gfx::Font& font) const {
- return font.DeriveFont(0, gfx::Font::BOLD);
-}
-
StatusAreaButton::TextStyle BrowserView::GetStatusAreaTextStyle() const {
ThemeService* theme_service =
ThemeServiceFactory::GetForProfile(browser()->profile());
if (!theme_service->UsingDefaultTheme())
- return StatusAreaButton::WHITE_HALOED;
+ return StatusAreaButton::WHITE_HALOED_BOLD;
return IsOffTheRecord() ?
- StatusAreaButton::WHITE_PLAIN : StatusAreaButton::GRAY_EMBOSSED;
+ StatusAreaButton::WHITE_PLAIN_BOLD : StatusAreaButton::GRAY_EMBOSSED_BOLD;
}
void BrowserView::ButtonVisibilityChanged(views::View* button_view) {
diff --git a/chrome/browser/chromeos/frame/browser_view.h b/chrome/browser/chromeos/frame/browser_view.h
index 215dc6d..8cea500 100644
--- a/chrome/browser/chromeos/frame/browser_view.h
+++ b/chrome/browser/chromeos/frame/browser_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -92,7 +92,6 @@ class BrowserView : public ::BrowserView,
const views::View* button_view, int command_id) const OVERRIDE;
virtual void ExecuteStatusAreaCommand(
const views::View* button_view, int command_id) OVERRIDE;
- virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const OVERRIDE;
virtual StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
diff --git a/chrome/browser/chromeos/login/webui_login_view.cc b/chrome/browser/chromeos/login/webui_login_view.cc
index 766ca79..9ba5558 100644
--- a/chrome/browser/chromeos/login/webui_login_view.cc
+++ b/chrome/browser/chromeos/login/webui_login_view.cc
@@ -269,12 +269,8 @@ void WebUILoginView::ExecuteStatusAreaCommand(
}
}
-gfx::Font WebUILoginView::GetStatusAreaFont(const gfx::Font& font) const {
- return font;
-}
-
StatusAreaButton::TextStyle WebUILoginView::GetStatusAreaTextStyle() const {
- return StatusAreaButton::GRAY_PLAIN;
+ return StatusAreaButton::GRAY_PLAIN_LIGHT;
}
void WebUILoginView::ButtonVisibilityChanged(views::View* button_view) {
diff --git a/chrome/browser/chromeos/login/webui_login_view.h b/chrome/browser/chromeos/login/webui_login_view.h
index aa7fe58..9740dcd 100644
--- a/chrome/browser/chromeos/login/webui_login_view.h
+++ b/chrome/browser/chromeos/login/webui_login_view.h
@@ -87,7 +87,6 @@ class WebUILoginView : public views::WidgetDelegateView,
const views::View* button_view, int command_id) const OVERRIDE;
virtual void ExecuteStatusAreaCommand(
const views::View* button_view, int command_id) OVERRIDE;
- virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const OVERRIDE;
virtual StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
diff --git a/chrome/browser/chromeos/status/status_area_button.cc b/chrome/browser/chromeos/status/status_area_button.cc
index 50b3e85..e0b9084 100644
--- a/chrome/browser/chromeos/status/status_area_button.cc
+++ b/chrome/browser/chromeos/status/status_area_button.cc
@@ -15,7 +15,7 @@ namespace {
// Colors for different text styles.
const SkColor kWhitePlainTextColor = 0x99ffffff;
-const SkColor kGrayPlainTextColor = 0x99666666;
+const SkColor kGrayPlainTextColor = 0xff666666;
const SkColor kWhiteHaloedTextColor = 0xb3ffffff;
const SkColor kWhiteHaloedHaloColor = 0xb3000000;
const SkColor kGrayEmbossedTextColor = 0xff4c4c4c;
@@ -39,11 +39,10 @@ StatusAreaButton::StatusAreaButton(Delegate* button_delegate,
delegate_(button_delegate) {
set_border(NULL);
- gfx::Font font =
- ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
- font = font.DeriveFont(kFontSizeDelta);
- font = delegate_->GetStatusAreaFont(font);
- SetFont(font);
+ light_font_ =
+ ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont).
+ DeriveFont(kFontSizeDelta);
+ bold_font_ = light_font_.DeriveFont(0, gfx::Font::BOLD);
SetShowMultipleIconStates(false);
set_alignment(TextButton::ALIGN_CENTER);
@@ -136,17 +135,21 @@ void StatusAreaButton::SetMenuActive(bool active) {
void StatusAreaButton::UpdateTextStyle() {
ClearEmbellishing();
switch (delegate_->GetStatusAreaTextStyle()) {
- case WHITE_PLAIN:
+ case WHITE_PLAIN_BOLD:
+ SetFont(bold_font_);
SetEnabledColor(kWhitePlainTextColor);
break;
- case GRAY_PLAIN:
+ case GRAY_PLAIN_LIGHT:
+ SetFont(light_font_);
SetEnabledColor(kGrayPlainTextColor);
break;
- case WHITE_HALOED:
+ case WHITE_HALOED_BOLD:
+ SetFont(bold_font_);
SetEnabledColor(kWhiteHaloedTextColor);
SetTextHaloColor(kWhiteHaloedHaloColor);
break;
- case GRAY_EMBOSSED:
+ case GRAY_EMBOSSED_BOLD:
+ SetFont(bold_font_);
SetEnabledColor(kGrayEmbossedTextColor);
SetTextShadowColors(kGrayEmbossedShadowColor, kGrayEmbossedShadowColor);
SetTextShadowOffset(0, 1);
diff --git a/chrome/browser/chromeos/status/status_area_button.h b/chrome/browser/chromeos/status/status_area_button.h
index f250bba..9f2f4d8 100644
--- a/chrome/browser/chromeos/status/status_area_button.h
+++ b/chrome/browser/chromeos/status/status_area_button.h
@@ -8,23 +8,20 @@
#include "base/compiler_specific.h"
#include "base/string16.h"
+#include "ui/gfx/font.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/menu/view_menu_delegate.h"
-namespace gfx {
-class Font;
-}
-
// Button to be used to represent status and allow menus to be popped up.
// Shows current button state by drawing a border around the current icon.
class StatusAreaButton : public views::MenuButton {
public:
// Different text styles for different types of backgrounds.
enum TextStyle {
- WHITE_PLAIN,
- GRAY_PLAIN,
- WHITE_HALOED,
- GRAY_EMBOSSED
+ WHITE_PLAIN_BOLD,
+ GRAY_PLAIN_LIGHT,
+ WHITE_HALOED_BOLD,
+ GRAY_EMBOSSED_BOLD
};
class Delegate {
@@ -43,9 +40,8 @@ class StatusAreaButton : public views::MenuButton {
virtual void ExecuteStatusAreaCommand(
const views::View* button_view, int command_id) = 0;
- // Return the button font. |font| is set to the default button font.
- virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const = 0;
-
+ // Get the style that should currently be used in rendering the button's
+ // text.
virtual TextStyle GetStatusAreaTextStyle() const = 0;
// Handle visibility changes (e.g. resize the status area).
@@ -106,6 +102,10 @@ class StatusAreaButton : public views::MenuButton {
private:
Delegate* delegate_;
+ // Fonts used to render the button's text.
+ gfx::Font light_font_;
+ gfx::Font bold_font_;
+
DISALLOW_COPY_AND_ASSIGN(StatusAreaButton);
};
diff --git a/chrome/browser/ui/views/aura/status_area_host_aura.cc b/chrome/browser/ui/views/aura/status_area_host_aura.cc
index c9c247d..b9e3982 100644
--- a/chrome/browser/ui/views/aura/status_area_host_aura.cc
+++ b/chrome/browser/ui/views/aura/status_area_host_aura.cc
@@ -184,36 +184,32 @@ void StatusAreaHostAura::ExecuteStatusAreaCommand(
#endif
}
-gfx::Font StatusAreaHostAura::GetStatusAreaFont(const gfx::Font& font) const {
- return font.DeriveFont(0, gfx::Font::BOLD);
-}
-
StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const {
#if defined(OS_CHROMEOS)
if (!chromeos::UserManager::Get()->user_is_logged_in())
- return StatusAreaButton::GRAY_PLAIN;
+ return StatusAreaButton::GRAY_PLAIN_LIGHT;
const chromeos::ScreenLocker* locker =
chromeos::ScreenLocker::default_screen_locker();
if (locker && locker->locked())
- return StatusAreaButton::GRAY_PLAIN;
+ return StatusAreaButton::GRAY_PLAIN_LIGHT;
#endif
if (ash::Shell::GetInstance()->IsWindowModeCompact()) {
Browser* browser = BrowserList::GetLastActive();
if (!browser)
- return StatusAreaButton::WHITE_HALOED;
+ return StatusAreaButton::WHITE_HALOED_BOLD;
ThemeService* theme_service =
ThemeServiceFactory::GetForProfile(browser->profile());
if (!theme_service->UsingDefaultTheme())
- return StatusAreaButton::WHITE_HALOED;
+ return StatusAreaButton::WHITE_HALOED_BOLD;
return browser->profile()->IsOffTheRecord() ?
- StatusAreaButton::WHITE_PLAIN :
- StatusAreaButton::GRAY_EMBOSSED;
+ StatusAreaButton::WHITE_PLAIN_BOLD :
+ StatusAreaButton::GRAY_EMBOSSED_BOLD;
} else {
- return StatusAreaButton::WHITE_HALOED;
+ return StatusAreaButton::WHITE_HALOED_BOLD;
}
}
diff --git a/chrome/browser/ui/views/aura/status_area_host_aura.h b/chrome/browser/ui/views/aura/status_area_host_aura.h
index 0a8db32..3228601 100644
--- a/chrome/browser/ui/views/aura/status_area_host_aura.h
+++ b/chrome/browser/ui/views/aura/status_area_host_aura.h
@@ -45,7 +45,6 @@ class StatusAreaHostAura : public StatusAreaButton::Delegate,
const views::View* button_view, int command_id) const OVERRIDE;
virtual void ExecuteStatusAreaCommand(
const views::View* button_view, int command_id) OVERRIDE;
- virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const OVERRIDE;
virtual StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
diff --git a/chrome/browser/ui/views/aura/status_area_host_aura_browsertest.cc b/chrome/browser/ui/views/aura/status_area_host_aura_browsertest.cc
index e3a2c8e..30f7d7d 100644
--- a/chrome/browser/ui/views/aura/status_area_host_aura_browsertest.cc
+++ b/chrome/browser/ui/views/aura/status_area_host_aura_browsertest.cc
@@ -31,7 +31,7 @@ IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) {
#if defined(OS_CHROMEOS)
ASSERT_FALSE(chromeos::UserManager::Get()->user_is_logged_in());
- EXPECT_EQ(StatusAreaButton::GRAY_PLAIN, host->GetStatusAreaTextStyle());
+ EXPECT_EQ(StatusAreaButton::GRAY_PLAIN_LIGHT, host->GetStatusAreaTextStyle());
// ProfileManager expects a profile dir to be set on Chrome OS.
CommandLine::ForCurrentProcess()->AppendSwitchNative(
@@ -41,15 +41,19 @@ IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) {
#endif
if (ash::Shell::GetInstance()->IsWindowModeCompact()) {
- EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED, host->GetStatusAreaTextStyle());
+ EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED_BOLD,
+ host->GetStatusAreaTextStyle());
Browser* incognito_browser = CreateIncognitoBrowser();
- EXPECT_EQ(StatusAreaButton::WHITE_PLAIN, host->GetStatusAreaTextStyle());
+ EXPECT_EQ(StatusAreaButton::WHITE_PLAIN_BOLD,
+ host->GetStatusAreaTextStyle());
incognito_browser->CloseWindow();
- EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED, host->GetStatusAreaTextStyle());
+ EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED_BOLD,
+ host->GetStatusAreaTextStyle());
} else {
- EXPECT_EQ(StatusAreaButton::WHITE_HALOED, host->GetStatusAreaTextStyle());
+ EXPECT_EQ(StatusAreaButton::WHITE_HALOED_BOLD,
+ host->GetStatusAreaTextStyle());
}
#if defined(OS_CHROMEOS)
@@ -64,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) {
if (!tester->IsLocked())
lock_state_observer.Wait();
ASSERT_TRUE(tester->IsLocked());
- EXPECT_EQ(StatusAreaButton::GRAY_PLAIN, host->GetStatusAreaTextStyle());
+ EXPECT_EQ(StatusAreaButton::GRAY_PLAIN_LIGHT, host->GetStatusAreaTextStyle());
chromeos::ScreenLocker::Hide();
ui_test_utils::RunAllPendingInMessageLoop();