Commit 6240b88a authored by Dave Schuyler's avatar Dave Schuyler Committed by Commit Bot

[Omnibox] set color of icons on invalidate

This Cl updates the color of icons in invalidate (e.g. selection or theme
changes).

Bug: 821342
Change-Id: Icbd861b443ed9d0125121641f94e1ec6aeb1865c
Reviewed-on: https://chromium-review.googlesource.com/962680
Commit-Queue: Dave Schuyler <dschuyler@chromium.org>
Reviewed-by: default avatarKevin Bailey <krb@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543468}
parent 0a6d8978
...@@ -192,7 +192,6 @@ void OmniboxResultView::SetMatch(const AutocompleteMatch& match) { ...@@ -192,7 +192,6 @@ void OmniboxResultView::SetMatch(const AutocompleteMatch& match) {
animation_->Reset(); animation_->Reset();
is_hovered_ = false; is_hovered_ = false;
image_view_->SetVisible(false); // Until SetAnswerImage is called. image_view_->SetVisible(false); // Until SetAnswerImage is called.
keyword_icon_view_->SetVisible(match_.associated_keyword.get()); keyword_icon_view_->SetVisible(match_.associated_keyword.get());
if (tab_switch_button_) { if (tab_switch_button_) {
if (match.type == AutocompleteMatchType::TAB_SEARCH && if (match.type == AutocompleteMatchType::TAB_SEARCH &&
...@@ -227,6 +226,16 @@ void OmniboxResultView::Invalidate() { ...@@ -227,6 +226,16 @@ void OmniboxResultView::Invalidate() {
SetBackground(CreateBackgroundWithColor(color)); SetBackground(CreateBackgroundWithColor(color));
} }
// Recreate the icons in case the color needs to change.
// Note: if this is an extension icon or favicon then this can be done in
// SetMatch() once (rather than repeatedly, as happens here). There may
// be an optimization opportunity here.
// TODO(dschuyler): determine whether to optimize the color changes.
icon_view_->SetImage(GetIcon().ToImageSkia());
keyword_icon_view_->SetImage(gfx::CreateVectorIcon(
omnibox::kKeywordSearchIcon, GetLayoutConstant(LOCATION_BAR_ICON_SIZE),
GetVectorIconColor()));
if (match_.answer) { if (match_.answer) {
content_view_->SetText(match_.answer->first_line()); content_view_->SetText(match_.answer->first_line());
description_view_->SetText(match_.answer->second_line()); description_view_->SetText(match_.answer->second_line());
......
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