diff --git chrome/browser/download/download_target_determiner.cc chrome/browser/download/download_target_determiner.cc index e1e662e..799e01e 100644 --- chrome/browser/download/download_target_determiner.cc +++ chrome/browser/download/download_target_determiner.cc @@ -476,8 +476,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context, content::PluginService* plugin_service = content::PluginService::GetInstance(); bool plugin_found = plugin_service->GetPluginInfo( - -1, -1, resource_context, url, url::Origin(), mime_type, false, &is_stale, - &plugin_info, &actual_mime_type); + -1, -1, resource_context, url, true, url::Origin(), mime_type, false, + &is_stale, &plugin_info, &actual_mime_type); if (is_stale && stale_plugin_action == RETRY_IF_STALE_PLUGIN_LIST) { // The GetPlugins call causes the plugin list to be refreshed. Once that's // done we can retry the GetPluginInfo call. We break out of this cycle diff --git chrome/browser/plugins/chrome_plugin_service_filter.cc chrome/browser/plugins/chrome_plugin_service_filter.cc index cdb0cc8..5903927 100644 --- chrome/browser/plugins/chrome_plugin_service_filter.cc +++ chrome/browser/plugins/chrome_plugin_service_filter.cc @@ -178,6 +178,7 @@ bool ChromePluginServiceFilter::IsPluginAvailable( int render_frame_id, const void* context, const GURL& plugin_content_url, + bool is_main_frame, const url::Origin& main_frame_origin, content::WebPluginInfo* plugin) { base::AutoLock auto_lock(lock_); diff --git chrome/browser/plugins/chrome_plugin_service_filter.h chrome/browser/plugins/chrome_plugin_service_filter.h index f8b651f..ec39f8d 100644 --- chrome/browser/plugins/chrome_plugin_service_filter.h +++ chrome/browser/plugins/chrome_plugin_service_filter.h @@ -71,6 +71,7 @@ class ChromePluginServiceFilter : public content::PluginServiceFilter, int render_frame_id, const void* context, const GURL& plugin_content_url, + bool is_main_frame, const url::Origin& main_frame_origin, content::WebPluginInfo* plugin) override; diff --git chrome/browser/plugins/plugin_info_message_filter.cc chrome/browser/plugins/plugin_info_message_filter.cc index 3e0a715..dbc75d9 100644 --- chrome/browser/plugins/plugin_info_message_filter.cc +++ chrome/browser/plugins/plugin_info_message_filter.cc @@ -446,8 +446,8 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin( for (; i < matching_plugins.size(); ++i) { if (!filter || filter->IsPluginAvailable(render_process_id_, render_frame_id, - resource_context_, url, main_frame_origin, - &matching_plugins[i])) { + resource_context_, url, true, + main_frame_origin, &matching_plugins[i])) { break; } } diff --git chrome/browser/ui/cocoa/drag_util.mm chrome/browser/ui/cocoa/drag_util.mm index 4a3e00e..aca7f98 100644 --- chrome/browser/ui/cocoa/drag_util.mm +++ chrome/browser/ui/cocoa/drag_util.mm @@ -52,7 +52,7 @@ BOOL IsSupportedFileURL(Profile* profile, const GURL& url) { return PluginService::GetInstance()->GetPluginInfo( -1, // process ID MSG_ROUTING_NONE, // routing ID - profile->GetResourceContext(), url, url::Origin(), mime_type, + profile->GetResourceContext(), url, true, url::Origin(), mime_type, allow_wildcard, NULL, &plugin, NULL); } diff --git chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc index 21c34be..5250ead 100644 --- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc @@ -575,6 +575,6 @@ void BrowserTabStripController::OnFindURLMimeTypeCompleted( content::PluginService::GetInstance()->GetPluginInfo( -1, // process ID MSG_ROUTING_NONE, // routing ID - model_->profile()->GetResourceContext(), url, url::Origin(), + model_->profile()->GetResourceContext(), url, true, url::Origin(), mime_type, false, NULL, &plugin, NULL)); } diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc index 573b5d9..5f3d68b 100644 --- content/browser/frame_host/render_frame_message_filter.cc +++ content/browser/frame_host/render_frame_message_filter.cc @@ -459,6 +459,7 @@ void RenderFrameMessageFilter::GetCookies(int render_frame_id, void RenderFrameMessageFilter::OnGetPlugins( bool refresh, + bool is_main_frame, const url::Origin& main_frame_origin, IPC::Message* reply_msg) { // Don't refresh if the specified threshold has not been passed. Note that @@ -480,18 +481,19 @@ void RenderFrameMessageFilter::OnGetPlugins( PluginServiceImpl::GetInstance()->GetPlugins( base::Bind(&RenderFrameMessageFilter::GetPluginsCallback, this, reply_msg, - main_frame_origin)); + is_main_frame, main_frame_origin)); } void RenderFrameMessageFilter::GetPluginsCallback( IPC::Message* reply_msg, + bool is_main_frame, const url::Origin& main_frame_origin, const std::vector& all_plugins) { // Filter the plugin list. PluginServiceFilter* filter = PluginServiceImpl::GetInstance()->GetFilter(); std::vector plugins; - int child_process_id = -1; + int child_process_id = render_process_id_; int routing_id = MSG_ROUTING_NONE; // In this loop, copy the WebPluginInfo (and do not use a reference) because // the filter might mutate it. @@ -500,7 +502,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( if (!filter || filter->IsPluginAvailable(child_process_id, routing_id, resource_context_, main_frame_origin.GetURL(), - main_frame_origin, &plugin)) { + is_main_frame, main_frame_origin, &plugin)) { plugins.push_back(plugin); } } @@ -512,6 +514,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( void RenderFrameMessageFilter::OnGetPluginInfo( int render_frame_id, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, const std::string& mime_type, bool* found, @@ -520,8 +523,8 @@ void RenderFrameMessageFilter::OnGetPluginInfo( bool allow_wildcard = true; *found = plugin_service_->GetPluginInfo( render_process_id_, render_frame_id, resource_context_, url, - main_frame_origin, mime_type, allow_wildcard, nullptr, info, - actual_mime_type); + is_main_frame, main_frame_origin, mime_type, allow_wildcard, nullptr, + info, actual_mime_type); } void RenderFrameMessageFilter::OnOpenChannelToPepperPlugin( diff --git content/browser/frame_host/render_frame_message_filter.h content/browser/frame_host/render_frame_message_filter.h index fa7fe99..5fe9680 100644 --- content/browser/frame_host/render_frame_message_filter.h +++ content/browser/frame_host/render_frame_message_filter.h @@ -125,13 +125,16 @@ class CONTENT_EXPORT RenderFrameMessageFilter #if defined(ENABLE_PLUGINS) void OnGetPlugins(bool refresh, + bool is_main_frame, const url::Origin& main_frame_origin, IPC::Message* reply_msg); void GetPluginsCallback(IPC::Message* reply_msg, + bool is_main_frame, const url::Origin& main_frame_origin, const std::vector& plugins); void OnGetPluginInfo(int render_frame_id, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, const std::string& mime_type, bool* found, diff --git content/browser/loader/mime_sniffing_resource_handler.cc content/browser/loader/mime_sniffing_resource_handler.cc index 3e5e414..aa8e294 100644 --- content/browser/loader/mime_sniffing_resource_handler.cc +++ content/browser/loader/mime_sniffing_resource_handler.cc @@ -432,8 +432,8 @@ bool MimeSniffingResourceHandler::CheckForPluginHandler( WebPluginInfo plugin; bool has_plugin = plugin_service_->GetPluginInfo( info->GetChildID(), info->GetRenderFrameID(), info->GetContext(), - request()->url(), url::Origin(), response_->head.mime_type, - allow_wildcard, &stale, &plugin, NULL); + request()->url(), info->IsMainFrame(), url::Origin(), + response_->head.mime_type, allow_wildcard, &stale, &plugin, NULL); if (stale) { // Refresh the plugins asynchronously. diff --git content/browser/plugin_service_impl.cc content/browser/plugin_service_impl.cc index 3eca335..72dfab6 100644 --- content/browser/plugin_service_impl.cc +++ content/browser/plugin_service_impl.cc @@ -242,6 +242,7 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, int render_frame_id, ResourceContext* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, const std::string& mime_type, bool allow_wildcard, @@ -258,7 +259,8 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, for (size_t i = 0; i < plugins.size(); ++i) { if (!filter_ || filter_->IsPluginAvailable(render_process_id, render_frame_id, context, - url, main_frame_origin, &plugins[i])) { + url, is_main_frame, main_frame_origin, + &plugins[i])) { *info = plugins[i]; if (actual_mime_type) *actual_mime_type = mime_types[i]; diff --git content/browser/plugin_service_impl.h content/browser/plugin_service_impl.h index 71bbed2..0f72497 100644 --- content/browser/plugin_service_impl.h +++ content/browser/plugin_service_impl.h @@ -69,6 +69,7 @@ class CONTENT_EXPORT PluginServiceImpl int render_frame_id, ResourceContext* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, const std::string& mime_type, bool allow_wildcard, diff --git content/common/frame_messages.h content/common/frame_messages.h index 3177bf6..9b4abe4 100644 --- content/common/frame_messages.h +++ content/common/frame_messages.h @@ -1160,8 +1160,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback, // Used to get the list of plugins. |main_frame_origin| is used to handle // exceptions for plugin content settings. -IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins, +IPC_SYNC_MESSAGE_CONTROL3_1(FrameHostMsg_GetPlugins, bool /* refresh*/, + bool /* is_main_frame */, url::Origin /* main_frame_origin */, std::vector /* plugins */) @@ -1169,9 +1170,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins, // type. If there is no matching plugin, |found| is false. // |actual_mime_type| is the actual mime type supported by the // found plugin. -IPC_SYNC_MESSAGE_CONTROL4_3(FrameHostMsg_GetPluginInfo, +IPC_SYNC_MESSAGE_CONTROL5_3(FrameHostMsg_GetPluginInfo, int /* render_frame_id */, GURL /* url */, + bool /* is_main_frame */, url::Origin /* main_frame_origin */, std::string /* mime_type */, bool /* found */, diff --git content/ppapi_plugin/ppapi_blink_platform_impl.cc content/ppapi_plugin/ppapi_blink_platform_impl.cc index c4dc0cf..4fe3e1b 100644 --- content/ppapi_plugin/ppapi_blink_platform_impl.cc +++ content/ppapi_plugin/ppapi_blink_platform_impl.cc @@ -210,6 +210,7 @@ blink::WebURLLoader* PpapiBlinkPlatformImpl::createURLLoader() { void PpapiBlinkPlatformImpl::getPluginList( bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) { NOTREACHED(); diff --git content/ppapi_plugin/ppapi_blink_platform_impl.h content/ppapi_plugin/ppapi_blink_platform_impl.h index 9c2ba25..11a0839 100644 --- content/ppapi_plugin/ppapi_blink_platform_impl.h +++ content/ppapi_plugin/ppapi_blink_platform_impl.h @@ -44,6 +44,7 @@ class PpapiBlinkPlatformImpl : public BlinkPlatformImpl { blink::WebThemeEngine* themeEngine() override; blink::WebURLLoader* createURLLoader() override; void getPluginList(bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder*) override; blink::WebData loadResource(const char* name) override; diff --git content/public/browser/plugin_service.h content/public/browser/plugin_service.h index c404ac8..9dd87e7 100644 --- content/public/browser/plugin_service.h +++ content/public/browser/plugin_service.h @@ -74,6 +74,7 @@ class PluginService { int render_frame_id, ResourceContext* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, const std::string& mime_type, bool allow_wildcard, diff --git content/public/browser/plugin_service_filter.h content/public/browser/plugin_service_filter.h index 3b610b1..7c439e0 100644 --- content/public/browser/plugin_service_filter.h +++ content/public/browser/plugin_service_filter.h @@ -33,6 +33,7 @@ class PluginServiceFilter { int render_frame_id, const void* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, WebPluginInfo* plugin) = 0; diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc index c0d7575..c723958 100644 --- content/renderer/render_frame_impl.cc +++ content/renderer/render_frame_impl.cc @@ -2729,7 +2729,8 @@ blink::WebPlugin* RenderFrameImpl::createPlugin( std::string mime_type; bool found = false; Send(new FrameHostMsg_GetPluginInfo( - routing_id_, params.url, frame->top()->getSecurityOrigin(), + routing_id_, params.url, frame->parent() == nullptr, + frame->top()->getSecurityOrigin(), params.mimeType.utf8(), &found, &info, &mime_type)); if (!found) return NULL; @@ -5120,7 +5121,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( (pending_navigation_params_ && !pending_navigation_params_->request_params.redirects.empty()); -#ifdef OS_ANDROID // The handlenavigation API is deprecated and will be removed once // crbug.com/325351 is resolved. if (GetContentClient()->renderer()->HandleNavigation( @@ -5129,7 +5129,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( is_redirect)) { return blink::WebNavigationPolicyIgnore; } -#endif Referrer referrer( RenderViewImpl::GetReferrerFromRequest(frame_, info.urlRequest)); diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc index a0cdfa0..9a9ef85 100644 --- content/renderer/renderer_blink_platform_impl.cc +++ content/renderer/renderer_blink_platform_impl.cc @@ -742,6 +742,7 @@ blink::WebMIDIAccessor* RendererBlinkPlatformImpl::createMIDIAccessor( void RendererBlinkPlatformImpl::getPluginList( bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) { #if defined(ENABLE_PLUGINS) @@ -749,7 +750,8 @@ void RendererBlinkPlatformImpl::getPluginList( if (!plugin_refresh_allowed_) refresh = false; RenderThread::Get()->Send( - new FrameHostMsg_GetPlugins(refresh, mainFrameOrigin, &plugins)); + new FrameHostMsg_GetPlugins(refresh, isMainFrame, mainFrameOrigin, + &plugins)); for (const WebPluginInfo& plugin : plugins) { builder->addPlugin( plugin.name, plugin.desc, diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h index 2783946..d5a61e5 100644 --- content/renderer/renderer_blink_platform_impl.h +++ content/renderer/renderer_blink_platform_impl.h @@ -121,6 +121,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { const blink::WebURL& url, const blink::WebURL& top_origin) override; void getPluginList(bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) override; blink::WebPublicSuffixList* publicSuffixList() override;