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

Unified Diff: components/renderer_context_menu/context_menu_content_type.cc

Issue 431943003: [DevTools] Whitelist default context menu options for DevTools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/renderer_context_menu/context_menu_content_type.cc
diff --git a/components/renderer_context_menu/context_menu_content_type.cc b/components/renderer_context_menu/context_menu_content_type.cc
index 4b5d4b943f7280a3eb9361c9358b8e81264fad20..a187d1feb18c919634721a4a5cf94ad09486587c 100644
--- a/components/renderer_context_menu/context_menu_content_type.cc
+++ b/components/renderer_context_menu/context_menu_content_type.cc
@@ -74,6 +74,17 @@ bool ContextMenuContentType::SupportsGroup(int group) {
// adding the normal ones after the custom ones.
}
+ if (IsDevToolsURL(params_.page_url)) {
+ // DevTools mostly provides custom context menu and uses
+ // only the following default options.
+ if (group != ITEM_GROUP_CUSTOM &&
+ group != ITEM_GROUP_EDITABLE &&
+ group != ITEM_GROUP_COPY &&
+ group != ITEM_GROUP_DEVELOPER) {
+ return false;
+ }
+ }
+
return SupportsGroupInternal(group);
}
@@ -94,7 +105,6 @@ bool ContextMenuContentType::SupportsGroupInternal(int group) {
DCHECK(params_.frame_url.is_empty());
return is_candidate && !params_.page_url.is_empty() &&
- !IsDevToolsURL(params_.page_url) &&
!IsInternalResourcesURL(params_.page_url);
}
@@ -102,7 +112,6 @@ bool ContextMenuContentType::SupportsGroupInternal(int group) {
bool page_group_supported = SupportsGroupInternal(ITEM_GROUP_PAGE);
return page_group_supported && !params_.frame_url.is_empty() &&
- !IsDevToolsURL(params_.frame_url) &&
!IsInternalResourcesURL(params_.page_url);
}
@@ -145,13 +154,12 @@ bool ContextMenuContentType::SupportsGroupInternal(int group) {
return has_selection;
case ITEM_GROUP_PRINT: {
- bool enable = has_selection && !IsDevToolsURL(params_.page_url);
// Image menu items also imply print items.
- return enable || SupportsGroupInternal(ITEM_GROUP_MEDIA_IMAGE);
+ return has_selection || SupportsGroupInternal(ITEM_GROUP_MEDIA_IMAGE);
}
case ITEM_GROUP_ALL_EXTENSION:
- return !IsDevToolsURL(params_.page_url);
+ return true;
case ITEM_GROUP_CURRENT_EXTENSION:
return false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698