diff options
Diffstat (limited to 'content')
6 files changed, 45 insertions, 1 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc index 28ab5b1..703a4f9 100644 --- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc +++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/command_line.h" #include "base/memory/singleton.h" #include "base/run_loop.h" #include "base/test/test_timeouts.h" @@ -16,6 +17,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/render_view_host_observer.h" +#include "content/public/common/content_switches.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "content/shell/shell.h" @@ -217,6 +219,11 @@ class BrowserPluginHostTest : public ContentBrowserTest { ContentBrowserTest::TearDown(); } + virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + // Enable browser plugin in content_shell for running test. + command_line->AppendSwitch(switches::kEnableBrowserPluginForAllViewTypes); + } + static void SimulateTabKeyPress(WebContents* web_contents) { SimulateKeyPress(web_contents, ui::VKEY_TAB, @@ -285,9 +292,9 @@ class BrowserPluginHostTest : public ContentBrowserTest { TestBrowserPluginGuest* test_guest() const { return test_guest_; } private: - DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostTest); TestBrowserPluginEmbedder* test_embedder_; TestBrowserPluginGuest* test_guest_; + DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostTest); }; // This test loads a guest that has infinite loop, therefore it hangs the guest diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 67c2033..e2c2241 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -795,6 +795,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( switches::kDisableWebSockets, switches::kDomAutomationController, switches::kEnableAccessibilityLogging, + switches::kEnableBrowserPluginForAllViewTypes, switches::kEnableBrowserPluginOldImplementation, switches::kEnableDCHECK, switches::kEnableEncryptedMedia, diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index d82c9b2..c70c2f3 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -247,6 +247,10 @@ const char kEnableAcceleratedFilters[] = "enable-accelerated-filters"; // Turns on extremely verbose logging of accessibility events. const char kEnableAccessibilityLogging[] = "enable-accessibility-logging"; +// Enables browser plugin for all types of pages. +const char kEnableBrowserPluginForAllViewTypes[] = + "enable-browser-plugin-for-all-view-types"; + // Enables old implementation path for browser plugin instead of current one. const char kEnableBrowserPluginOldImplementation[] = "enable-browser-plugin-old-implementation"; diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 265a164..fe46833 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -91,6 +91,7 @@ CONTENT_EXPORT extern const char kEnableAcceleratedPainting[]; CONTENT_EXPORT extern const char kEnableAcceleratedFilters[]; extern const char kEnableAcceleratedPlugins[]; extern const char kEnableAccessibilityLogging[]; +CONTENT_EXPORT extern const char kEnableBrowserPluginForAllViewTypes[]; extern const char kEnableBrowserPluginOldImplementation[]; CONTENT_EXPORT extern const char kEnableCompositingForFixedPosition[]; extern const char kEnableCssShaders[]; diff --git a/content/shell/shell_content_renderer_client.cc b/content/shell/shell_content_renderer_client.cc index 63c7069..a17fbe0 100644 --- a/content/shell/shell_content_renderer_client.cc +++ b/content/shell/shell_content_renderer_client.cc @@ -5,9 +5,13 @@ #include "content/shell/shell_content_renderer_client.h" #include "base/command_line.h" +#include "content/public/common/content_constants.h" +#include "content/public/common/content_switches.h" #include "content/shell/shell_render_process_observer.h" #include "content/shell/shell_switches.h" #include "content/shell/webkit_test_runner.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" #include "v8/include/v8.h" namespace content { @@ -29,4 +33,19 @@ void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { new WebKitTestRunner(render_view); } +bool ShellContentRendererClient::OverrideCreatePlugin( + RenderView* render_view, + WebKit::WebFrame* frame, + const WebKit::WebPluginParams& params, + WebKit::WebPlugin** plugin) { + std::string mime_type = params.mimeType.utf8(); + if (mime_type == content::kBrowserPluginMimeType) { + // Allow browser plugin in content_shell only if it is forced by flag. + // Returning true here disables the plugin. + return !CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableBrowserPluginForAllViewTypes); + } + return false; +} + } // namespace content diff --git a/content/shell/shell_content_renderer_client.h b/content/shell/shell_content_renderer_client.h index dee1c41..1dff8e2 100644 --- a/content/shell/shell_content_renderer_client.h +++ b/content/shell/shell_content_renderer_client.h @@ -9,8 +9,15 @@ #include "base/memory/scoped_ptr.h" #include "content/public/renderer/content_renderer_client.h" +namespace WebKit { +class WebFrame; +class WebPlugin; +struct WebPluginParams; +} + namespace content { +class RenderView; class ShellRenderProcessObserver; class ShellContentRendererClient : public ContentRendererClient { @@ -19,6 +26,11 @@ class ShellContentRendererClient : public ContentRendererClient { virtual ~ShellContentRendererClient(); virtual void RenderThreadStarted() OVERRIDE; virtual void RenderViewCreated(RenderView* render_view) OVERRIDE; + virtual bool OverrideCreatePlugin( + RenderView* render_view, + WebKit::WebFrame* frame, + const WebKit::WebPluginParams& params, + WebKit::WebPlugin** plugin) OVERRIDE; private: scoped_ptr<ShellRenderProcessObserver> shell_observer_; |