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

Unified Diff: chrome/browser/guest_view/web_view/context_menu_content_type_web_view.cc

Issue 1024153002: Hide "Inspect Element" context menu item from <webview> when <webview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@work-cmenu-disable-inspect
Patch Set: fix win8 unrechable code Created 5 years, 9 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 | components/renderer_context_menu/context_menu_content_type.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/guest_view/web_view/context_menu_content_type_web_view.cc
diff --git a/chrome/browser/guest_view/web_view/context_menu_content_type_web_view.cc b/chrome/browser/guest_view/web_view/context_menu_content_type_web_view.cc
index 3d7802292c939790bc631b9ac03b1aea9e34045f..c8f60cdbb2c5f78ec07027476e7c4785506be4c1 100644
--- a/chrome/browser/guest_view/web_view/context_menu_content_type_web_view.cc
+++ b/chrome/browser/guest_view/web_view/context_menu_content_type_web_view.cc
@@ -6,6 +6,8 @@
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/chrome_version_info.h"
+#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest.h"
@@ -33,10 +35,22 @@ bool ContextMenuContentTypeWebView::SupportsGroup(int group) {
// Show contextMenus API items.
return true;
case ITEM_GROUP_DEVELOPER:
- // TODO(lazyboy): Enable this for mac too when http://crbug.com/380405 is
- // fixed.
-#if !defined(OS_MACOSX)
{
+ if (chrome::VersionInfo::GetChannel() >=
+ chrome::VersionInfo::CHANNEL_DEV) {
+ // Hide dev tools items in guests inside WebUI if we are not running
+ // canary or tott.
+ auto web_view_guest =
+ extensions::WebViewGuest::FromWebContents(source_web_contents());
+ if (web_view_guest &&
+ web_view_guest->owner_web_contents()->GetWebUI()) {
+ return false;
+ }
+ }
+
+ // TODO(lazyboy): Enable this for mac too when http://crbug.com/380405
+ // is fixed.
+#if !defined(OS_MACOSX)
// Add dev tools for unpacked extensions.
const extensions::Extension* embedder_platform_app = GetExtension();
return !embedder_platform_app ||
@@ -44,10 +58,10 @@ bool ContextMenuContentTypeWebView::SupportsGroup(int group) {
embedder_platform_app->location()) ||
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDebugPackedApps);
- }
#else
- return ContextMenuContentType::SupportsGroup(group);
+ return ContextMenuContentType::SupportsGroup(group);
#endif
+ }
default:
return ContextMenuContentType::SupportsGroup(group);
}
« no previous file with comments | « no previous file | components/renderer_context_menu/context_menu_content_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698