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

Unified Diff: chrome/browser/cocoa/location_bar/location_bar_view_mac.mm

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/cocoa/location_bar/location_bar_view_mac.mm
diff --git a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm
index b31ce913e67e34d06035e730b9e723b41be1df8f..4fac6cfa0e9e732e33ebf8c53ee3e454aa418641 100644
--- a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm
@@ -393,6 +393,18 @@ NSImage* LocationBarViewMac::GetTabButtonImage() {
return tab_button_image_;
}
+NSImage* LocationBarViewMac::GetKeywordImage(const std::wstring& keyword) {
+ const TemplateURL* template_url =
+ profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword);
+ if (template_url && template_url->IsExtensionKeyword()) {
+ const SkBitmap& bitmap = profile_->GetExtensionsService()->
+ GetOmniboxIcon(template_url->GetExtensionId());
+ return gfx::SkBitmapToNSImage(bitmap);
+ }
+
+ return AutocompleteEditViewMac::ImageForResource(IDR_OMNIBOX_SEARCH);
+}
+
void LocationBarViewMac::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
@@ -880,8 +892,8 @@ void LocationBarViewMac::Layout() {
// Switch from location icon to keyword mode.
location_icon_decoration_->SetVisible(false);
selected_keyword_decoration_->SetVisible(true);
-
selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword);
+ selected_keyword_decoration_->SetImage(GetKeywordImage(keyword));
// TODO(shess): This goes away once the hints are decorations.
[cell clearHint];

Powered by Google App Engine
This is Rietveld 408576698