summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-25 16:49:26 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-25 16:49:26 +0000
commit28065f66296d0d012aa5b02c147f4f77ef8a771e (patch)
tree9fc2567cd9a4edaf09a322e2465b8540787c118c /chrome/browser/views
parent120e1f1b2728ae5d1d4fed21bddb3533b921fdba (diff)
downloadchromium_src-28065f66296d0d012aa5b02c147f4f77ef8a771e.zip
chromium_src-28065f66296d0d012aa5b02c147f4f77ef8a771e.tar.gz
chromium_src-28065f66296d0d012aa5b02c147f4f77ef8a771e.tar.bz2
Use the system WINDOWTEXT color for labels, instead of black. Also use the system WINDOW color for InfoBubbles, not white. Several places are made to explicitly use black labels where that's correct or respecting system colors is a non-trivial fix (bugs filed for most).
Also, apparently I didn't get all my cleanup changes in the last patch, oops. BUG=92,21027 TEST=Set theme to high-contrast black on white, check that most pieces of chrome UI have readable text Review URL: http://codereview.chromium.org/237005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27196 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/about_chrome_view.cc13
-rw-r--r--chrome/browser/views/bookmark_bubble_view.cc12
-rw-r--r--chrome/browser/views/first_run_view.cc1
-rw-r--r--chrome/browser/views/info_bubble.cc13
-rw-r--r--chrome/browser/views/info_bubble.h4
-rw-r--r--chrome/browser/views/infobars/infobars.cc4
-rw-r--r--chrome/browser/views/location_bar_view.cc2
7 files changed, 34 insertions, 15 deletions
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc
index 6b2ba40..fc18064 100644
--- a/chrome/browser/views/about_chrome_view.cc
+++ b/chrome/browser/views/about_chrome_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 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.
@@ -166,6 +166,7 @@ void AboutChromeView::Init() {
l10n_util::GetString(IDS_PRODUCT_NAME));
about_title_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont(
ResourceBundle::BaseFont).DeriveFont(18, BOLD_FONTTYPE));
+ about_title_label_->SetColor(SK_ColorBLACK);
AddChildView(about_title_label_);
// This is a text field so people can copy the version number from the dialog.
@@ -173,6 +174,7 @@ void AboutChromeView::Init() {
version_label_->SetText(current_version_);
version_label_->SetReadOnly(true);
version_label_->RemoveBorder();
+ version_label_->SetTextColor(SK_ColorBLACK);
version_label_->SetBackgroundColor(SK_ColorWHITE);
version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont(
ResourceBundle::BaseFont).DeriveFont(0, BOLD_FONTTYPE));
@@ -493,6 +495,13 @@ void AboutChromeView::DrawTextStartingFrom(gfx::Canvas* canvas,
const gfx::Rect& bounds,
const gfx::Font& font,
bool ltr_within_rtl) {
+#if defined(OS_WIN)
+ const SkColor text_color = color_utils::GetSysSkColor(COLOR_WINDOWTEXT);
+#else
+ // TODO(beng): source from theme provider.
+ const SkColor text_color = SkColor_BLACK;
+#endif
+
// Iterate through line breaking opportunities (which in English would be
// spaces and such. This tells us where to wrap.
WordIterator iter(text, WordIterator::BREAK_LINE);
@@ -537,7 +546,7 @@ void AboutChromeView::DrawTextStartingFrom(gfx::Canvas* canvas,
int y = position->height() + bounds.y();
// Draw the text on the screen (mirrored, if RTL run).
- canvas->DrawStringInt(word, font, SK_ColorBLACK, x, y, w, h, flags);
+ canvas->DrawStringInt(word, font, text_color, x, y, w, h, flags);
if (word.size() > 0 && word[word.size() - 1] == L'\x0a') {
// When we come across '\n', we move to the beginning of the next line.
diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc
index 6a48deb..c85052f 100644
--- a/chrome/browser/views/bookmark_bubble_view.cc
+++ b/chrome/browser/views/bookmark_bubble_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/bookmark_bubble_view.h"
#include "app/gfx/canvas.h"
+#include "app/gfx/color_utils.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/keyboard_codes.h"
@@ -33,9 +34,6 @@ using views::Link;
using views::NativeButton;
using views::View;
-// Color of the title.
-static const SkColor kTitleColor = SkColorSetRGB(6, 45, 117);
-
// Padding between "Title:" and the actual title.
static const int kTitlePadding = 4;
@@ -226,9 +224,15 @@ BookmarkBubbleView::BookmarkBubbleView(InfoBubbleDelegate* delegate,
}
void BookmarkBubbleView::Init() {
- if (!kCloseImage) {
+ static SkColor kTitleColor;
+ static bool initialized = false;
+ if (!initialized) {
+ kTitleColor = color_utils::GetReadableColor(SkColorSetRGB(6, 45, 117),
+ InfoBubble::kBackgroundColor);
kCloseImage = ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_INFO_BUBBLE_CLOSE);
+
+ initialized = true;
}
remove_link_ = new Link(l10n_util::GetString(
diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc
index 334213c..d29c567 100644
--- a/chrome/browser/views/first_run_view.cc
+++ b/chrome/browser/views/first_run_view.cc
@@ -56,6 +56,7 @@ void FirstRunView::SetupControls() {
default_browser_->SetChecked(true);
welcome_label_ = new Label(l10n_util::GetString(IDS_FIRSTRUN_DLG_TEXT));
+ welcome_label_->SetColor(SK_ColorBLACK);
welcome_label_->SetMultiLine(true);
welcome_label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
welcome_label_->SizeToFit(0);
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc
index 92dd6f7..40244ef 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/views/info_bubble.cc
@@ -14,18 +14,15 @@
#include "views/widget/root_view.h"
#include "views/window/window.h"
-namespace {
-
// Background color of the bubble.
#if defined(OS_WIN)
-const SkColor kBackgroundColor = color_utils::GetSysSkColor(COLOR_WINDOW);
+const SkColor InfoBubble::kBackgroundColor =
+ color_utils::GetSysSkColor(COLOR_WINDOW);
#else
// TODO(beng): source from theme provider.
-const SkColor kBackgroundColor = SK_ColorWHITE;
+const SkColor InfoBubble::kBackgroundColor = SK_ColorWHITE;
#endif
-}
-
// BorderContents -------------------------------------------------------------
// This is used to paint the border of the InfoBubble. Windows uses this via
@@ -75,7 +72,7 @@ void BorderContents::InitAndGetBounds(
// Set the border.
BubbleBorder* bubble_border = new BubbleBorder;
set_border(bubble_border);
- bubble_border->set_background_color(kBackgroundColor);
+ bubble_border->set_background_color(InfoBubble::kBackgroundColor);
// Give the contents a margin.
gfx::Size local_contents_size(contents_size);
@@ -128,7 +125,7 @@ void BorderContents::Paint(gfx::Canvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kFill_Style);
- paint.setColor(kBackgroundColor);
+ paint.setColor(InfoBubble::kBackgroundColor);
gfx::Path path;
gfx::Rect bounds(GetLocalBounds(false));
SkRect rect;
diff --git a/chrome/browser/views/info_bubble.h b/chrome/browser/views/info_bubble.h
index 2d4a0f2..fc5f671 100644
--- a/chrome/browser/views/info_bubble.h
+++ b/chrome/browser/views/info_bubble.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 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.
@@ -101,6 +101,8 @@ class InfoBubble : public views::WidgetGtk {
// Overridden from WidgetWin:
virtual void Close();
+ static const SkColor kBackgroundColor;
+
protected:
InfoBubble();
virtual ~InfoBubble() {}
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index c2fc041..be4e0ed 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -270,6 +270,7 @@ AlertInfoBar::AlertInfoBar(AlertInfoBarDelegate* delegate)
label_ = new views::Label(
delegate->GetMessageText(),
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont));
+ label_->SetColor(SK_ColorBLACK);
label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(label_);
@@ -332,6 +333,8 @@ LinkInfoBar::LinkInfoBar(LinkInfoBarDelegate* delegate)
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
label_1_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
label_2_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
+ label_1_->SetColor(SK_ColorBLACK);
+ label_2_->SetColor(SK_ColorBLACK);
label_1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
label_2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(label_1_);
@@ -342,6 +345,7 @@ LinkInfoBar::LinkInfoBar(LinkInfoBarDelegate* delegate)
link_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
link_->SetController(this);
+ link_->MakeReadableOverBackgroundColor(background()->get_color());
AddChildView(link_);
}
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index 0e3e104..e5ba8f6 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -768,6 +768,8 @@ LocationBarView::SelectedKeywordView::SelectedKeywordView(Profile* profile)
partial_label_.set_border(
views::Border::CreateEmptyBorder(kTopInset, kLeftInset, kBottomInset,
kRightInset));
+ full_label_.SetColor(SK_ColorBLACK);
+ partial_label_.SetColor(SK_ColorBLACK);
}
LocationBarView::SelectedKeywordView::~SelectedKeywordView() {