diff options
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc index 84538e0f..024d7d0 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc @@ -165,47 +165,21 @@ void SetupLayoutForMatch(PangoLayout* layout, } GdkPixbuf* IconForMatch(const AutocompleteMatch& match, bool selected) { + int icon = match.starred ? + IDR_O2_STAR : AutocompleteMatch::TypeToIcon(match.type); + if (selected) { + switch (icon) { + case IDR_O2_GLOBE: icon = IDR_O2_GLOBE_SELECTED; break; + case IDR_O2_HISTORY: icon = IDR_O2_HISTORY_SELECTED; break; + case IDR_O2_SEARCH: icon = IDR_O2_SEARCH_SELECTED; break; + case IDR_O2_MORE: icon = IDR_O2_MORE_SELECTED; break; + case IDR_O2_STAR: icon = IDR_O2_STAR_SELECTED; break; + default: NOTREACHED(); break; + } + } // TODO(deanm): These would be better as pixmaps someday. // TODO(estade): Do we want to flip these for RTL? (Windows doesn't). - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - static GdkPixbuf* o2_globe = rb.GetPixbufNamed(IDR_O2_GLOBE); - static GdkPixbuf* o2_globe_s = rb.GetPixbufNamed(IDR_O2_GLOBE_SELECTED_DARK); - static GdkPixbuf* o2_history = rb.GetPixbufNamed(IDR_O2_HISTORY); - static GdkPixbuf* o2_history_s = - rb.GetPixbufNamed(IDR_O2_HISTORY_SELECTED_DARK); - static GdkPixbuf* o2_more = rb.GetPixbufNamed(IDR_O2_MORE); - static GdkPixbuf* o2_more_s = rb.GetPixbufNamed(IDR_O2_MORE_SELECTED_DARK); - static GdkPixbuf* o2_search = rb.GetPixbufNamed(IDR_O2_SEARCH); - static GdkPixbuf* o2_search_s = - rb.GetPixbufNamed(IDR_O2_SEARCH_SELECTED_DARK); - static GdkPixbuf* o2_star = rb.GetPixbufNamed(IDR_O2_STAR); - static GdkPixbuf* o2_star_s = rb.GetPixbufNamed(IDR_O2_STAR_SELECTED_DARK); - - if (match.starred) - return selected ? o2_star_s : o2_star; - - switch (match.type) { - case AutocompleteMatch::URL_WHAT_YOU_TYPED: - case AutocompleteMatch::NAVSUGGEST: - return selected ? o2_globe_s : o2_globe; - case AutocompleteMatch::HISTORY_URL: - case AutocompleteMatch::HISTORY_TITLE: - case AutocompleteMatch::HISTORY_BODY: - case AutocompleteMatch::HISTORY_KEYWORD: - return selected ? o2_history_s : o2_history; - case AutocompleteMatch::SEARCH_WHAT_YOU_TYPED: - case AutocompleteMatch::SEARCH_HISTORY: - case AutocompleteMatch::SEARCH_SUGGEST: - case AutocompleteMatch::SEARCH_OTHER_ENGINE: - return selected ? o2_search_s : o2_search; - case AutocompleteMatch::OPEN_HISTORY_PAGE: - return selected ? o2_more_s : o2_more; - default: - NOTREACHED(); - break; - } - - return NULL; + return ResourceBundle::GetSharedInstance().GetPixbufNamed(icon); } } // namespace |