| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/autocomplete/autocomplete_popup_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 pango_layout_set_attributes(layout, attrs); // Ref taken. | 172 pango_layout_set_attributes(layout, attrs); // Ref taken. |
| 173 pango_attr_list_unref(attrs); | 173 pango_attr_list_unref(attrs); |
| 174 } | 174 } |
| 175 | 175 |
| 176 GdkPixbuf* IconForMatch(const AutocompleteMatch& match, bool selected) { | 176 GdkPixbuf* IconForMatch(const AutocompleteMatch& match, bool selected) { |
| 177 // TODO(deanm): These would be better as pixmaps someday. | 177 // TODO(deanm): These would be better as pixmaps someday. |
| 178 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 178 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 179 static GdkPixbuf* o2_globe = rb.GetPixbufNamed(IDR_O2_GLOBE); | 179 static GdkPixbuf* o2_globe = rb.GetPixbufNamed(IDR_O2_GLOBE); |
| 180 static GdkPixbuf* o2_globe_s = rb.GetPixbufNamed(IDR_O2_GLOBE_SELECTED); | 180 static GdkPixbuf* o2_globe_s = rb.GetPixbufNamed(IDR_O2_GLOBE_SELECTED_DARK); |
| 181 static GdkPixbuf* o2_history = rb.GetPixbufNamed(IDR_O2_HISTORY); | 181 static GdkPixbuf* o2_history = rb.GetPixbufNamed(IDR_O2_HISTORY); |
| 182 static GdkPixbuf* o2_history_s = rb.GetPixbufNamed(IDR_O2_HISTORY_SELECTED); | 182 static GdkPixbuf* o2_history_s = |
| 183 rb.GetPixbufNamed(IDR_O2_HISTORY_SELECTED_DARK); |
| 183 static GdkPixbuf* o2_more = rb.GetPixbufNamed(IDR_O2_MORE); | 184 static GdkPixbuf* o2_more = rb.GetPixbufNamed(IDR_O2_MORE); |
| 184 static GdkPixbuf* o2_more_s = rb.GetPixbufNamed(IDR_O2_MORE_SELECTED); | 185 static GdkPixbuf* o2_more_s = rb.GetPixbufNamed(IDR_O2_MORE_SELECTED_DARK); |
| 185 static GdkPixbuf* o2_search = rb.GetPixbufNamed(IDR_O2_SEARCH); | 186 static GdkPixbuf* o2_search = rb.GetPixbufNamed(IDR_O2_SEARCH); |
| 186 static GdkPixbuf* o2_search_s = rb.GetPixbufNamed(IDR_O2_SEARCH_SELECTED); | 187 static GdkPixbuf* o2_search_s = |
| 188 rb.GetPixbufNamed(IDR_O2_SEARCH_SELECTED_DARK); |
| 187 static GdkPixbuf* o2_star = rb.GetPixbufNamed(IDR_O2_STAR); | 189 static GdkPixbuf* o2_star = rb.GetPixbufNamed(IDR_O2_STAR); |
| 188 static GdkPixbuf* o2_star_s = rb.GetPixbufNamed(IDR_O2_STAR_SELECTED); | 190 static GdkPixbuf* o2_star_s = rb.GetPixbufNamed(IDR_O2_STAR_SELECTED_DARK); |
| 189 | 191 |
| 190 if (match.starred) | 192 if (match.starred) |
| 191 return selected ? o2_star_s : o2_star; | 193 return selected ? o2_star_s : o2_star; |
| 192 | 194 |
| 193 switch (match.type) { | 195 switch (match.type) { |
| 194 case AutocompleteMatch::URL_WHAT_YOU_TYPED: | 196 case AutocompleteMatch::URL_WHAT_YOU_TYPED: |
| 195 case AutocompleteMatch::NAVSUGGEST: | 197 case AutocompleteMatch::NAVSUGGEST: |
| 196 return selected ? o2_globe_s : o2_globe; | 198 return selected ? o2_globe_s : o2_globe; |
| 197 case AutocompleteMatch::HISTORY_URL: | 199 case AutocompleteMatch::HISTORY_URL: |
| 198 case AutocompleteMatch::HISTORY_TITLE: | 200 case AutocompleteMatch::HISTORY_TITLE: |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 gdk_draw_layout(drawable, gc, | 473 gdk_draw_layout(drawable, gc, |
| 472 kIconAreaWidth + actual_content_width, content_y, | 474 kIconAreaWidth + actual_content_width, content_y, |
| 473 layout_); | 475 layout_); |
| 474 } | 476 } |
| 475 } | 477 } |
| 476 | 478 |
| 477 g_object_unref(gc); | 479 g_object_unref(gc); |
| 478 | 480 |
| 479 return TRUE; | 481 return TRUE; |
| 480 } | 482 } |
| OLD | NEW |