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

Unified Diff: chrome/browser/ui/views/location_bar/keyword_hint_view.cc

Issue 8221027: Make views::Label and views::Link auto-color themselves to be readable over their background colo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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/location_bar/keyword_hint_view.cc
===================================================================
--- chrome/browser/ui/views/location_bar/keyword_hint_view.cc (revision 104959)
+++ chrome/browser/ui/views/location_bar/keyword_hint_view.cc (working copy)
@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
+#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -27,10 +28,8 @@
static const SkBitmap* kTabButtonBitmap = NULL;
KeywordHintView::KeywordHintView(Profile* profile) : profile_(profile) {
- leading_label_ = new views::Label();
- trailing_label_ = new views::Label();
- AddChildView(leading_label_);
- AddChildView(trailing_label_);
+ leading_label_ = CreateLabel();
+ trailing_label_ = CreateLabel();
if (!kTabButtonBitmap) {
kTabButtonBitmap = ResourceBundle::GetSharedInstance().
@@ -46,11 +45,6 @@
trailing_label_->SetFont(font);
}
-void KeywordHintView::SetColor(const SkColor& color) {
- leading_label_->SetColor(color);
- trailing_label_->SetColor(color);
-}
-
void KeywordHintView::SetKeyword(const string16& keyword) {
keyword_ = keyword;
if (keyword_.empty())
@@ -134,3 +128,13 @@
trailing_label_->SetBounds(x, 0, pref.width(), height());
}
}
+
+views::Label* KeywordHintView::CreateLabel() {
+ views::Label* label = new views::Label();
+ label->SetBackgroundColor(LocationBarView::GetColor(ToolbarModel::NONE,
+ LocationBarView::BACKGROUND));
+ label->SetEnabledColor(LocationBarView::GetColor(ToolbarModel::NONE,
+ LocationBarView::DEEMPHASIZED_TEXT));
+ AddChildView(label);
+ return label;
+}
« no previous file with comments | « chrome/browser/ui/views/location_bar/keyword_hint_view.h ('k') | chrome/browser/ui/views/location_bar/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698