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

Unified Diff: chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc

Issue 2973006: Use the extension icon for extension omnibox results instead of the generic (Closed)
Patch Set: fixed mac Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
index 17d243cd0706c54322cbaf4bd28e710a6bf132dc..45a10bf3b7c8fd68211bedf3770c35adbf066b04 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -153,7 +153,7 @@ class AutocompleteResultView : public views::View {
ResultViewState GetState() const;
- SkBitmap* GetIcon() const;
+ const SkBitmap* GetIcon() const;
// Draws the specified |text| into the canvas, using highlighting provided by
// |classifications|. If |force_dim| is true, ACMatchClassification::DIM is
@@ -339,7 +339,11 @@ ResultViewState AutocompleteResultView::GetState() const {
return model_->IsHoveredIndex(model_index_) ? HOVERED : NORMAL;
}
-SkBitmap* AutocompleteResultView::GetIcon() const {
+const SkBitmap* AutocompleteResultView::GetIcon() const {
+ const SkBitmap* bitmap = model_->GetSpecialIcon(model_index_);
+ if (bitmap)
+ return bitmap;
+
int icon = match_.starred ?
IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match_.type);
if (model_->IsSelectedIndex(model_index_)) {
@@ -740,6 +744,13 @@ bool AutocompletePopupContentsView::IsHoveredIndex(size_t index) const {
return HasMatchAt(index) ? index == model_->hovered_line() : false;
}
+const SkBitmap* AutocompletePopupContentsView::GetSpecialIcon(
+ size_t index) const {
+ if (!HasMatchAt(index))
+ return NULL;
+ return model_->GetSpecialIconForMatch(GetMatchAtIndex(index));
+}
+
////////////////////////////////////////////////////////////////////////////////
// AutocompletePopupContentsView, AnimationDelegate implementation:

Powered by Google App Engine
This is Rietveld 408576698