Commit 2d684526 authored by derat@chromium.org's avatar derat@chromium.org

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
parent e0b2c312
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -527,19 +527,15 @@ void BrowserView::ExecuteStatusAreaCommand( ...@@ -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 { StatusAreaButton::TextStyle BrowserView::GetStatusAreaTextStyle() const {
ThemeService* theme_service = ThemeService* theme_service =
ThemeServiceFactory::GetForProfile(browser()->profile()); ThemeServiceFactory::GetForProfile(browser()->profile());
if (!theme_service->UsingDefaultTheme()) if (!theme_service->UsingDefaultTheme())
return StatusAreaButton::WHITE_HALOED; return StatusAreaButton::WHITE_HALOED_BOLD;
return IsOffTheRecord() ? return IsOffTheRecord() ?
StatusAreaButton::WHITE_PLAIN : StatusAreaButton::GRAY_EMBOSSED; StatusAreaButton::WHITE_PLAIN_BOLD : StatusAreaButton::GRAY_EMBOSSED_BOLD;
} }
void BrowserView::ButtonVisibilityChanged(views::View* button_view) { void BrowserView::ButtonVisibilityChanged(views::View* button_view) {
......
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -92,7 +92,6 @@ class BrowserView : public ::BrowserView, ...@@ -92,7 +92,6 @@ class BrowserView : public ::BrowserView,
const views::View* button_view, int command_id) const OVERRIDE; const views::View* button_view, int command_id) const OVERRIDE;
virtual void ExecuteStatusAreaCommand( virtual void ExecuteStatusAreaCommand(
const views::View* button_view, int command_id) OVERRIDE; 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 StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
......
...@@ -269,12 +269,8 @@ void WebUILoginView::ExecuteStatusAreaCommand( ...@@ -269,12 +269,8 @@ void WebUILoginView::ExecuteStatusAreaCommand(
} }
} }
gfx::Font WebUILoginView::GetStatusAreaFont(const gfx::Font& font) const {
return font;
}
StatusAreaButton::TextStyle WebUILoginView::GetStatusAreaTextStyle() const { StatusAreaButton::TextStyle WebUILoginView::GetStatusAreaTextStyle() const {
return StatusAreaButton::GRAY_PLAIN; return StatusAreaButton::GRAY_PLAIN_LIGHT;
} }
void WebUILoginView::ButtonVisibilityChanged(views::View* button_view) { void WebUILoginView::ButtonVisibilityChanged(views::View* button_view) {
......
...@@ -87,7 +87,6 @@ class WebUILoginView : public views::WidgetDelegateView, ...@@ -87,7 +87,6 @@ class WebUILoginView : public views::WidgetDelegateView,
const views::View* button_view, int command_id) const OVERRIDE; const views::View* button_view, int command_id) const OVERRIDE;
virtual void ExecuteStatusAreaCommand( virtual void ExecuteStatusAreaCommand(
const views::View* button_view, int command_id) OVERRIDE; 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 StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
......
...@@ -15,7 +15,7 @@ namespace { ...@@ -15,7 +15,7 @@ namespace {
// Colors for different text styles. // Colors for different text styles.
const SkColor kWhitePlainTextColor = 0x99ffffff; const SkColor kWhitePlainTextColor = 0x99ffffff;
const SkColor kGrayPlainTextColor = 0x99666666; const SkColor kGrayPlainTextColor = 0xff666666;
const SkColor kWhiteHaloedTextColor = 0xb3ffffff; const SkColor kWhiteHaloedTextColor = 0xb3ffffff;
const SkColor kWhiteHaloedHaloColor = 0xb3000000; const SkColor kWhiteHaloedHaloColor = 0xb3000000;
const SkColor kGrayEmbossedTextColor = 0xff4c4c4c; const SkColor kGrayEmbossedTextColor = 0xff4c4c4c;
...@@ -39,11 +39,10 @@ StatusAreaButton::StatusAreaButton(Delegate* button_delegate, ...@@ -39,11 +39,10 @@ StatusAreaButton::StatusAreaButton(Delegate* button_delegate,
delegate_(button_delegate) { delegate_(button_delegate) {
set_border(NULL); set_border(NULL);
gfx::Font font = light_font_ =
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont).
font = font.DeriveFont(kFontSizeDelta); DeriveFont(kFontSizeDelta);
font = delegate_->GetStatusAreaFont(font); bold_font_ = light_font_.DeriveFont(0, gfx::Font::BOLD);
SetFont(font);
SetShowMultipleIconStates(false); SetShowMultipleIconStates(false);
set_alignment(TextButton::ALIGN_CENTER); set_alignment(TextButton::ALIGN_CENTER);
...@@ -136,17 +135,21 @@ void StatusAreaButton::SetMenuActive(bool active) { ...@@ -136,17 +135,21 @@ void StatusAreaButton::SetMenuActive(bool active) {
void StatusAreaButton::UpdateTextStyle() { void StatusAreaButton::UpdateTextStyle() {
ClearEmbellishing(); ClearEmbellishing();
switch (delegate_->GetStatusAreaTextStyle()) { switch (delegate_->GetStatusAreaTextStyle()) {
case WHITE_PLAIN: case WHITE_PLAIN_BOLD:
SetFont(bold_font_);
SetEnabledColor(kWhitePlainTextColor); SetEnabledColor(kWhitePlainTextColor);
break; break;
case GRAY_PLAIN: case GRAY_PLAIN_LIGHT:
SetFont(light_font_);
SetEnabledColor(kGrayPlainTextColor); SetEnabledColor(kGrayPlainTextColor);
break; break;
case WHITE_HALOED: case WHITE_HALOED_BOLD:
SetFont(bold_font_);
SetEnabledColor(kWhiteHaloedTextColor); SetEnabledColor(kWhiteHaloedTextColor);
SetTextHaloColor(kWhiteHaloedHaloColor); SetTextHaloColor(kWhiteHaloedHaloColor);
break; break;
case GRAY_EMBOSSED: case GRAY_EMBOSSED_BOLD:
SetFont(bold_font_);
SetEnabledColor(kGrayEmbossedTextColor); SetEnabledColor(kGrayEmbossedTextColor);
SetTextShadowColors(kGrayEmbossedShadowColor, kGrayEmbossedShadowColor); SetTextShadowColors(kGrayEmbossedShadowColor, kGrayEmbossedShadowColor);
SetTextShadowOffset(0, 1); SetTextShadowOffset(0, 1);
......
...@@ -8,23 +8,20 @@ ...@@ -8,23 +8,20 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/string16.h" #include "base/string16.h"
#include "ui/gfx/font.h"
#include "ui/views/controls/button/menu_button.h" #include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/menu/view_menu_delegate.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. // 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. // Shows current button state by drawing a border around the current icon.
class StatusAreaButton : public views::MenuButton { class StatusAreaButton : public views::MenuButton {
public: public:
// Different text styles for different types of backgrounds. // Different text styles for different types of backgrounds.
enum TextStyle { enum TextStyle {
WHITE_PLAIN, WHITE_PLAIN_BOLD,
GRAY_PLAIN, GRAY_PLAIN_LIGHT,
WHITE_HALOED, WHITE_HALOED_BOLD,
GRAY_EMBOSSED GRAY_EMBOSSED_BOLD
}; };
class Delegate { class Delegate {
...@@ -43,9 +40,8 @@ class StatusAreaButton : public views::MenuButton { ...@@ -43,9 +40,8 @@ class StatusAreaButton : public views::MenuButton {
virtual void ExecuteStatusAreaCommand( virtual void ExecuteStatusAreaCommand(
const views::View* button_view, int command_id) = 0; const views::View* button_view, int command_id) = 0;
// Return the button font. |font| is set to the default button font. // Get the style that should currently be used in rendering the button's
virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const = 0; // text.
virtual TextStyle GetStatusAreaTextStyle() const = 0; virtual TextStyle GetStatusAreaTextStyle() const = 0;
// Handle visibility changes (e.g. resize the status area). // Handle visibility changes (e.g. resize the status area).
...@@ -106,6 +102,10 @@ class StatusAreaButton : public views::MenuButton { ...@@ -106,6 +102,10 @@ class StatusAreaButton : public views::MenuButton {
private: private:
Delegate* delegate_; Delegate* delegate_;
// Fonts used to render the button's text.
gfx::Font light_font_;
gfx::Font bold_font_;
DISALLOW_COPY_AND_ASSIGN(StatusAreaButton); DISALLOW_COPY_AND_ASSIGN(StatusAreaButton);
}; };
......
...@@ -184,36 +184,32 @@ void StatusAreaHostAura::ExecuteStatusAreaCommand( ...@@ -184,36 +184,32 @@ void StatusAreaHostAura::ExecuteStatusAreaCommand(
#endif #endif
} }
gfx::Font StatusAreaHostAura::GetStatusAreaFont(const gfx::Font& font) const {
return font.DeriveFont(0, gfx::Font::BOLD);
}
StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const { StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
if (!chromeos::UserManager::Get()->user_is_logged_in()) if (!chromeos::UserManager::Get()->user_is_logged_in())
return StatusAreaButton::GRAY_PLAIN; return StatusAreaButton::GRAY_PLAIN_LIGHT;
const chromeos::ScreenLocker* locker = const chromeos::ScreenLocker* locker =
chromeos::ScreenLocker::default_screen_locker(); chromeos::ScreenLocker::default_screen_locker();
if (locker && locker->locked()) if (locker && locker->locked())
return StatusAreaButton::GRAY_PLAIN; return StatusAreaButton::GRAY_PLAIN_LIGHT;
#endif #endif
if (ash::Shell::GetInstance()->IsWindowModeCompact()) { if (ash::Shell::GetInstance()->IsWindowModeCompact()) {
Browser* browser = BrowserList::GetLastActive(); Browser* browser = BrowserList::GetLastActive();
if (!browser) if (!browser)
return StatusAreaButton::WHITE_HALOED; return StatusAreaButton::WHITE_HALOED_BOLD;
ThemeService* theme_service = ThemeService* theme_service =
ThemeServiceFactory::GetForProfile(browser->profile()); ThemeServiceFactory::GetForProfile(browser->profile());
if (!theme_service->UsingDefaultTheme()) if (!theme_service->UsingDefaultTheme())
return StatusAreaButton::WHITE_HALOED; return StatusAreaButton::WHITE_HALOED_BOLD;
return browser->profile()->IsOffTheRecord() ? return browser->profile()->IsOffTheRecord() ?
StatusAreaButton::WHITE_PLAIN : StatusAreaButton::WHITE_PLAIN_BOLD :
StatusAreaButton::GRAY_EMBOSSED; StatusAreaButton::GRAY_EMBOSSED_BOLD;
} else { } else {
return StatusAreaButton::WHITE_HALOED; return StatusAreaButton::WHITE_HALOED_BOLD;
} }
} }
......
...@@ -45,7 +45,6 @@ class StatusAreaHostAura : public StatusAreaButton::Delegate, ...@@ -45,7 +45,6 @@ class StatusAreaHostAura : public StatusAreaButton::Delegate,
const views::View* button_view, int command_id) const OVERRIDE; const views::View* button_view, int command_id) const OVERRIDE;
virtual void ExecuteStatusAreaCommand( virtual void ExecuteStatusAreaCommand(
const views::View* button_view, int command_id) OVERRIDE; 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 StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE;
virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE;
......
...@@ -31,7 +31,7 @@ IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) { ...@@ -31,7 +31,7 @@ IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
ASSERT_FALSE(chromeos::UserManager::Get()->user_is_logged_in()); 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. // ProfileManager expects a profile dir to be set on Chrome OS.
CommandLine::ForCurrentProcess()->AppendSwitchNative( CommandLine::ForCurrentProcess()->AppendSwitchNative(
...@@ -41,15 +41,19 @@ IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) { ...@@ -41,15 +41,19 @@ IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) {
#endif #endif
if (ash::Shell::GetInstance()->IsWindowModeCompact()) { if (ash::Shell::GetInstance()->IsWindowModeCompact()) {
EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED, host->GetStatusAreaTextStyle()); EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED_BOLD,
host->GetStatusAreaTextStyle());
Browser* incognito_browser = CreateIncognitoBrowser(); Browser* incognito_browser = CreateIncognitoBrowser();
EXPECT_EQ(StatusAreaButton::WHITE_PLAIN, host->GetStatusAreaTextStyle()); EXPECT_EQ(StatusAreaButton::WHITE_PLAIN_BOLD,
host->GetStatusAreaTextStyle());
incognito_browser->CloseWindow(); incognito_browser->CloseWindow();
EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED, host->GetStatusAreaTextStyle()); EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED_BOLD,
host->GetStatusAreaTextStyle());
} else { } else {
EXPECT_EQ(StatusAreaButton::WHITE_HALOED, host->GetStatusAreaTextStyle()); EXPECT_EQ(StatusAreaButton::WHITE_HALOED_BOLD,
host->GetStatusAreaTextStyle());
} }
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -64,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) { ...@@ -64,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) {
if (!tester->IsLocked()) if (!tester->IsLocked())
lock_state_observer.Wait(); lock_state_observer.Wait();
ASSERT_TRUE(tester->IsLocked()); ASSERT_TRUE(tester->IsLocked());
EXPECT_EQ(StatusAreaButton::GRAY_PLAIN, host->GetStatusAreaTextStyle()); EXPECT_EQ(StatusAreaButton::GRAY_PLAIN_LIGHT, host->GetStatusAreaTextStyle());
chromeos::ScreenLocker::Hide(); chromeos::ScreenLocker::Hide();
ui_test_utils::RunAllPendingInMessageLoop(); ui_test_utils::RunAllPendingInMessageLoop();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment