Index: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc |
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc |
index 8bf559c1a6eece3df09a3c6062f8c809270b2f32..85c2746d804881395c594152fda00e413d321012 100644 |
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc |
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc |
@@ -16,6 +16,7 @@ |
#include "chrome/browser/download/download_request_limiter.h" |
#include "chrome/browser/download/download_resource_throttle.h" |
#include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
+#include "chrome/browser/plugins/plugin_prefs.h" |
#include "chrome/browser/prefetch/prefetch.h" |
#include "chrome/browser/prerender/prerender_manager.h" |
#include "chrome/browser/prerender/prerender_manager_factory.h" |
@@ -37,6 +38,7 @@ |
#include "components/variations/net/variations_http_header_provider.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/notification_service.h" |
+#include "content/public/browser/plugin_service.h" |
#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/resource_context.h" |
@@ -207,6 +209,34 @@ void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamInfo> stream, |
extension_id, web_contents, stream.Pass(), view_id, expected_content_size, |
embedded, render_process_id, render_frame_id); |
} |
+ |
+bool IsPluginEnabledForExtension(const Extension* extension, |
+ int render_process_id, |
+ int render_view_id) { |
+ content::WebPluginInfo plugin_info; |
+ base::FilePath plugin_path = |
+ base::FilePath::FromUTF8Unsafe(extension->url().spec()); |
+ if (!content::PluginService::GetInstance()->GetPluginInfoByPath( |
+ plugin_path, &plugin_info)) { |
+ return false; |
+ } |
+ |
+ content::WebContents* web_contents = |
+ tab_util::GetWebContentsByID(render_process_id, render_view_id); |
+ if (!web_contents) |
+ return false; |
+ |
+ content::BrowserContext* browser_context = web_contents->GetBrowserContext(); |
+ if (!browser_context) |
+ return false; |
+ |
+ if (!PluginPrefs::GetForProfile(Profile::FromBrowserContext( |
Lei Zhang
2015/02/18 04:24:18
You can just return the IsPluginEnabled() result h
raymes
2015/02/18 21:24:27
Done.
|
+ browser_context))->IsPluginEnabled(plugin_info)) { |
+ return false; |
+ } |
+ |
+ return true; |
+} |
#endif // !defined(ENABLE_EXTENSIONS) |
#if !defined(OS_ANDROID) |
@@ -621,6 +651,12 @@ bool ChromeResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( |
continue; |
} |
+ if (!IsPluginEnabledForExtension(extension, |
+ info->GetChildID(), |
+ info->GetRouteID())) { |
+ continue; |
+ } |
+ |
MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension); |
if (handler && handler->CanHandleMIMEType(mime_type)) { |
StreamTargetInfo target_info; |