OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gtk/omnibox/omnibox_popup_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_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 #include <string> | 10 #include <string> |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 495 |
496 const gfx::Image* OmniboxPopupViewGtk::IconForMatch( | 496 const gfx::Image* OmniboxPopupViewGtk::IconForMatch( |
497 const AutocompleteMatch& match, | 497 const AutocompleteMatch& match, |
498 bool selected, | 498 bool selected, |
499 bool is_selected_keyword) { | 499 bool is_selected_keyword) { |
500 const SkBitmap* bitmap = model_->GetIconIfExtensionMatch(match); | 500 const SkBitmap* bitmap = model_->GetIconIfExtensionMatch(match); |
501 if (bitmap) { | 501 if (bitmap) { |
502 if (!ContainsKey(images_, bitmap)) { | 502 if (!ContainsKey(images_, bitmap)) { |
503 // gfx::Image wants ownership of bitmaps given to it, and we might as | 503 // gfx::Image wants ownership of bitmaps given to it, and we might as |
504 // well make the bitmap copy a format that will be used. | 504 // well make the bitmap copy a format that will be used. |
505 images_[bitmap] = new gfx::Image(gfx::GdkPixbufFromSkBitmap(bitmap)); | 505 images_[bitmap] = new gfx::Image(gfx::GdkPixbufFromSkBitmap(*bitmap)); |
506 } | 506 } |
507 return images_[bitmap]; | 507 return images_[bitmap]; |
508 } | 508 } |
509 | 509 |
510 int icon; | 510 int icon; |
511 if (is_selected_keyword) | 511 if (is_selected_keyword) |
512 icon = IDR_OMNIBOX_TTS; | 512 icon = IDR_OMNIBOX_TTS; |
513 else if (match.starred) | 513 else if (match.starred) |
514 icon = IDR_OMNIBOX_STAR; | 514 icon = IDR_OMNIBOX_STAR; |
515 else | 515 else |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 DrawFullImage(cr, widget, | 741 DrawFullImage(cr, widget, |
742 theme_service_->GetImageNamed( | 742 theme_service_->GetImageNamed( |
743 is_selected ? IDR_OMNIBOX_TTS_DARK : IDR_OMNIBOX_TTS), | 743 is_selected ? IDR_OMNIBOX_TTS_DARK : IDR_OMNIBOX_TTS), |
744 icon_start_x, line_rect.y() + kIconTopPadding); | 744 icon_start_x, line_rect.y() + kIconTopPadding); |
745 } | 745 } |
746 } | 746 } |
747 | 747 |
748 cairo_destroy(cr); | 748 cairo_destroy(cr); |
749 return TRUE; | 749 return TRUE; |
750 } | 750 } |
OLD | NEW |