Index: chrome/browser/tab_contents/render_view_context_menu.cc |
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc |
index 0725e56b76bb98c3777ec8cf6355a8689618b425..b748b3edc9a8bd4a54f978861bdce3a947efc30e 100644 |
--- a/chrome/browser/tab_contents/render_view_context_menu.cc |
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc |
@@ -45,6 +45,7 @@ |
#include "chrome/browser/translate/translate_prefs.h" |
#include "chrome/browser/translate/translate_tab_helper.h" |
#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/browser_list.h" |
#include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
#include "chrome/browser/ui/tab_contents/per_tab_prefs_tab_helper.h" |
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
@@ -359,8 +360,9 @@ void RenderViewContextMenu::AppendExtensionItems( |
if (items.empty()) |
return; |
- // If this is the first extension-provided menu item, add a separator. |
- if (*index == 0) |
+ // If this is the first extension-provided menu item, and there are other |
+ // items in the menu, add a separator. |
+ if (*index == 0 && menu_model_.GetItemCount()) |
menu_model_.AddSeparator(); |
int menu_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST + (*index)++; |
@@ -510,6 +512,16 @@ void RenderViewContextMenu::InitMenu() { |
bool has_link = !params_.link_url.is_empty(); |
bool has_selection = !params_.selection_text.empty(); |
+ Browser* active_browser = BrowserList::GetLastActive(); |
benwells
2011/12/09 03:29:16
I don't really like this, but I think it should be
|
+ if (active_browser) { |
+ const Extension* platform_app = active_browser->GetPlatformApp(); |
+ if (platform_app) { |
+ int index = 0; |
+ AppendExtensionItems(platform_app->id(), &index); |
+ return; |
+ } |
+ } |
+ |
if (AppendCustomItems()) { |
// If there's a selection, don't early return when there are custom items, |
// but fall through to adding the normal ones after the custom ones. |