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

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

Issue 6799020: Add support for a "frame" context option to chrome.contextMenus.create/update. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update docs. Created 9 years, 8 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/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 a1c9618943b1f33097660651d4229b8a33955fb9..fff23a73a994fb98c8add346b2cfb835042cee75 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -200,11 +200,13 @@ static bool ExtensionContextMatch(const ContextMenuParams& params,
ExtensionMenuItem::ContextList contexts) {
bool has_link = !params.link_url.is_empty();
bool has_selection = !params.selection_text.empty();
+ bool in_frame = !params.frame_url.is_empty();
if (contexts.Contains(ExtensionMenuItem::ALL) ||
(has_selection && contexts.Contains(ExtensionMenuItem::SELECTION)) ||
(has_link && contexts.Contains(ExtensionMenuItem::LINK)) ||
- (params.is_editable && contexts.Contains(ExtensionMenuItem::EDITABLE))) {
+ (params.is_editable && contexts.Contains(ExtensionMenuItem::EDITABLE)) ||
+ (in_frame && contexts.Contains(ExtensionMenuItem::FRAME))) {
return true;
}
@@ -223,7 +225,8 @@ static bool ExtensionContextMatch(const ContextMenuParams& params,
}
// PAGE is the least specific context, so we only examine that if none of the
- // other contexts apply.
+ // other contexts apply (except for FRAME, which is included in PAGE for
+ // backwards compatibility).
if (!has_link && !has_selection && !params.is_editable &&
params.media_type == WebContextMenuData::MediaTypeNone &&
contexts.Contains(ExtensionMenuItem::PAGE))

Powered by Google App Engine
This is Rietveld 408576698