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

Unified Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 2867008: Show extension icons next to their top-level context menu items.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/render_view_context_menu.cc
===================================================================
--- chrome/browser/tab_contents/render_view_context_menu.cc (revision 50770)
+++ chrome/browser/tab_contents/render_view_context_menu.cc (working copy)
@@ -41,6 +41,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "gfx/favicon_size.h"
#include "grit/generated_resources.h"
#include "net/base/escape.h"
#include "net/url_request/url_request.h"
@@ -195,6 +196,7 @@
menu_model_.AddSubMenu(menu_id, title, submenu);
RecursivelyAppendExtensionItems(submenu_items, submenu, index);
}
+ SetExtensionIcon(extension_id);
}
void RenderViewContextMenu::RecursivelyAppendExtensionItems(
@@ -253,6 +255,20 @@
}
}
+void RenderViewContextMenu::SetExtensionIcon(const std::string& extension_id) {
+ ExtensionsService* service = profile_->GetExtensionsService();
+ ExtensionMenuManager* menu_manager = service->menu_manager();
+
+ int index = menu_model_.GetItemCount() - 1;
+ DCHECK(index >= 0);
+
+ const SkBitmap& icon = menu_manager->GetIconForExtension(extension_id);
+ DCHECK(icon.width() == kFavIconSize);
+ DCHECK(icon.height() == kFavIconSize);
+
+ menu_model_.SetIcon(index, icon);
+}
+
void RenderViewContextMenu::AppendAllExtensionItems() {
extension_item_map_.clear();
ExtensionsService* service = profile_->GetExtensionsService();
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698