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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #if defined(TOOLKIT_USES_GTK) 7 #if defined(TOOLKIT_USES_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 location_entry_view_ = location_entry_->AddToView(this); 210 location_entry_view_ = location_entry_->AddToView(this);
211 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); 211 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE);
212 212
213 selected_keyword_view_ = new SelectedKeywordView( 213 selected_keyword_view_ = new SelectedKeywordView(
214 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, 214 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER,
215 GetColor(ToolbarModel::NONE, TEXT), profile); 215 GetColor(ToolbarModel::NONE, TEXT), profile);
216 AddChildView(selected_keyword_view_); 216 AddChildView(selected_keyword_view_);
217 selected_keyword_view_->SetFont(font_); 217 selected_keyword_view_->SetFont(font_);
218 selected_keyword_view_->SetVisible(false); 218 selected_keyword_view_->SetVisible(false);
219 219
220 SkColor dimmed_text = GetColor(ToolbarModel::NONE, DEEMPHASIZED_TEXT);
221
222 keyword_hint_view_ = new KeywordHintView(profile); 220 keyword_hint_view_ = new KeywordHintView(profile);
223 AddChildView(keyword_hint_view_); 221 AddChildView(keyword_hint_view_);
224 keyword_hint_view_->SetVisible(false); 222 keyword_hint_view_->SetVisible(false);
225 keyword_hint_view_->SetFont(font_); 223 keyword_hint_view_->SetFont(font_);
226 keyword_hint_view_->SetColor(dimmed_text);
227 224
228 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 225 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
229 ContentSettingImageView* content_blocked_view = 226 ContentSettingImageView* content_blocked_view =
230 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); 227 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this);
231 content_setting_views_.push_back(content_blocked_view); 228 content_setting_views_.push_back(content_blocked_view);
232 AddChildView(content_blocked_view); 229 AddChildView(content_blocked_view);
233 content_blocked_view->SetVisible(false); 230 content_blocked_view->SetVisible(false);
234 } 231 }
235 232
236 // The star is not visible in popups and in the app launcher. 233 // The star is not visible in popups and in the app launcher.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 return origin; 421 return origin;
425 } 422 }
426 423
427 #if defined(OS_WIN) 424 #if defined(OS_WIN)
428 void LocationBarView::SetInstantSuggestion(const string16& text, 425 void LocationBarView::SetInstantSuggestion(const string16& text,
429 bool animate_to_complete) { 426 bool animate_to_complete) {
430 // Don't show the suggested text if inline autocomplete is prevented. 427 // Don't show the suggested text if inline autocomplete is prevented.
431 if (!text.empty()) { 428 if (!text.empty()) {
432 if (!suggested_text_view_) { 429 if (!suggested_text_view_) {
433 suggested_text_view_ = new SuggestedTextView(location_entry_->model()); 430 suggested_text_view_ = new SuggestedTextView(location_entry_->model());
434 suggested_text_view_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
435 suggested_text_view_->SetColor(
436 GetColor(ToolbarModel::NONE,
437 LocationBarView::DEEMPHASIZED_TEXT));
438 suggested_text_view_->SetText(text); 431 suggested_text_view_->SetText(text);
439 if (views::Widget::IsPureViews()) 432 if (views::Widget::IsPureViews())
440 NOTIMPLEMENTED(); 433 NOTIMPLEMENTED();
441 #if !defined(USE_AURA) 434 #if !defined(USE_AURA)
442 else 435 else
443 suggested_text_view_->SetFont(GetOmniboxViewWin()->GetFont()); 436 suggested_text_view_->SetFont(GetOmniboxViewWin()->GetFont());
444 #endif 437 #endif
445 AddChildView(suggested_text_view_); 438 AddChildView(suggested_text_view_);
446 } else if (suggested_text_view_->GetText() != text) { 439 } else if (suggested_text_view_->GetText() != text) {
447 suggested_text_view_->SetText(text); 440 suggested_text_view_->SetText(text);
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 !suggested_text_view_->GetText().empty(); 1266 !suggested_text_view_->GetText().empty();
1274 } 1267 }
1275 1268
1276 #if !defined(USE_AURA) 1269 #if !defined(USE_AURA)
1277 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { 1270 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() {
1278 CHECK(!views::Widget::IsPureViews()); 1271 CHECK(!views::Widget::IsPureViews());
1279 return static_cast<OmniboxViewWin*>(location_entry_.get()); 1272 return static_cast<OmniboxViewWin*>(location_entry_.get());
1280 } 1273 }
1281 #endif 1274 #endif
1282 #endif 1275 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/keyword_hint_view.cc ('k') | chrome/browser/ui/views/location_bar/suggested_text_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698