diff --git chrome/browser/download/download_target_determiner.cc chrome/browser/download/download_target_determiner.cc index 47820a5..520ca4cd 100644 --- chrome/browser/download/download_target_determiner.cc +++ chrome/browser/download/download_target_determiner.cc @@ -475,8 +475,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 1783a10..b380ef8 100644 --- chrome/browser/plugins/chrome_plugin_service_filter.cc +++ chrome/browser/plugins/chrome_plugin_service_filter.cc @@ -179,6 +179,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 09b5753..11a5f32 100644 --- chrome/browser/plugins/plugin_info_message_filter.cc +++ chrome/browser/plugins/plugin_info_message_filter.cc @@ -451,8 +451,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 0ce31db0..58c4633 100644 --- chrome/browser/ui/cocoa/drag_util.mm +++ chrome/browser/ui/cocoa/drag_util.mm @@ -54,7 +54,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 c147373..2e7cb5f 100644 --- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc @@ -591,6 +591,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/navigation_handle_impl.cc content/browser/frame_host/navigation_handle_impl.cc index 8dca644..d60c069 100644 --- content/browser/frame_host/navigation_handle_impl.cc +++ content/browser/frame_host/navigation_handle_impl.cc @@ -265,12 +265,6 @@ net::Error NavigationHandleImpl::GetNetErrorCode() { } RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { - // TODO(mkwst): Change this to check against 'READY_TO_COMMIT' once - // ReadyToCommitNavigation is available whether or not PlzNavigate is - // enabled. https://crbug.com/621856 - CHECK_GE(state_, WILL_PROCESS_RESPONSE) - << "This accessor should only be called after a response has been " - "delivered for processing."; return render_frame_host_; } diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc index ccd8ee7..cc52a93 100644 --- content/browser/frame_host/render_frame_host_impl.cc +++ content/browser/frame_host/render_frame_host_impl.cc @@ -814,10 +814,8 @@ bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) #endif -#if defined(OS_ANDROID) IPC_MESSAGE_HANDLER(FrameHostMsg_NavigationHandledByEmbedder, OnNavigationHandledByEmbedder) -#endif IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow) IPC_END_MESSAGE_MAP() @@ -1229,6 +1227,7 @@ void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( if (navigation_handle_) { navigation_handle_->set_net_error_code( static_cast(params.error_code)); + navigation_handle_->set_render_frame_host(this); } frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params); @@ -2425,14 +2424,12 @@ void RenderFrameHostImpl::OnHidePopup() { } #endif -#if defined(OS_ANDROID) void RenderFrameHostImpl::OnNavigationHandledByEmbedder() { if (navigation_handle_) navigation_handle_->set_net_error_code(net::ERR_ABORTED); OnDidStopLoading(); } -#endif void RenderFrameHostImpl::OnShowCreatedWindow(int pending_widget_routing_id, WindowOpenDisposition disposition, diff --git content/browser/frame_host/render_frame_host_impl.h content/browser/frame_host/render_frame_host_impl.h index 7d13f01..9b2d494 100644 --- content/browser/frame_host/render_frame_host_impl.h +++ content/browser/frame_host/render_frame_host_impl.h @@ -783,8 +783,8 @@ class CONTENT_EXPORT RenderFrameHostImpl void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); void OnHidePopup(); #endif -#if defined(OS_ANDROID) void OnNavigationHandledByEmbedder(); +#if defined(OS_ANDROID) void ForwardGetInterfaceToRenderFrame(const std::string& interface_name, mojo::ScopedMessagePipeHandle pipe); #endif diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc index 5b8f571..958ebfb1 100644 --- content/browser/frame_host/render_frame_message_filter.cc +++ content/browser/frame_host/render_frame_message_filter.cc @@ -446,6 +446,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 @@ -467,18 +468,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. @@ -487,7 +489,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); } } @@ -499,6 +501,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, @@ -507,8 +510,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 05500b4..cd00c4c 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 BUILDFLAG(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 11adad4..283f116 100644 --- content/browser/loader/mime_sniffing_resource_handler.cc +++ content/browser/loader/mime_sniffing_resource_handler.cc @@ -519,8 +519,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 480c659..ec4d108 100644 --- content/browser/plugin_service_impl.cc +++ content/browser/plugin_service_impl.cc @@ -243,6 +243,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, @@ -259,7 +260,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 9e7a5ef..ee721d0 100644 --- content/browser/plugin_service_impl.h +++ content/browser/plugin_service_impl.h @@ -70,6 +70,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 b8be34e..db85a84 100644 --- content/common/frame_messages.h +++ content/common/frame_messages.h @@ -1277,8 +1277,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 */) @@ -1286,9 +1287,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 */, @@ -1648,9 +1650,9 @@ IPC_MESSAGE_ROUTED3(FrameHostMsg_FindMatchRects_Reply, IPC_MESSAGE_ROUTED2(FrameHostMsg_GetNearestFindResult_Reply, int /* nfr_request_id */, float /* distance */) +#endif IPC_MESSAGE_ROUTED0(FrameHostMsg_NavigationHandledByEmbedder) -#endif // Adding a new message? Stick to the sort order above: first platform // independent FrameMsg, then ifdefs for platform specific FrameMsg, then diff --git content/ppapi_plugin/ppapi_blink_platform_impl.cc content/ppapi_plugin/ppapi_blink_platform_impl.cc index 6c24359..279edb2 100644 --- content/ppapi_plugin/ppapi_blink_platform_impl.cc +++ content/ppapi_plugin/ppapi_blink_platform_impl.cc @@ -211,6 +211,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 afcf809..1c9af66 100644 --- content/ppapi_plugin/ppapi_blink_platform_impl.h +++ content/ppapi_plugin/ppapi_blink_platform_impl.h @@ -45,6 +45,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/public/renderer/content_renderer_client.cc content/public/renderer/content_renderer_client.cc index d29d85f..6c32ef2 100644 --- content/public/renderer/content_renderer_client.cc +++ content/public/renderer/content_renderer_client.cc @@ -97,7 +97,6 @@ bool ContentRendererClient::AllowPopup() { return false; } -#if defined(OS_ANDROID) bool ContentRendererClient::HandleNavigation( RenderFrame* render_frame, bool is_content_initiated, @@ -110,6 +109,7 @@ bool ContentRendererClient::HandleNavigation( return false; } +#if defined(OS_ANDROID) bool ContentRendererClient::ShouldUseMediaPlayerForURL(const GURL& url) { return false; } diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h index d544fb7..260079c 100644 --- content/public/renderer/content_renderer_client.h +++ content/public/renderer/content_renderer_client.h @@ -197,7 +197,6 @@ class CONTENT_EXPORT ContentRendererClient { // Returns true if a popup window should be allowed. virtual bool AllowPopup(); -#if defined(OS_ANDROID) // TODO(sgurun) This callback is deprecated and will be removed as soon // as android webview completes implementation of a resource throttle based // shouldoverrideurl implementation. See crbug.com/325351 @@ -213,6 +212,7 @@ class CONTENT_EXPORT ContentRendererClient { blink::WebNavigationPolicy default_policy, bool is_redirect); +#if defined(OS_ANDROID) // Indicates if the Android MediaPlayer should be used instead of Chrome's // built in media player for the given |url|. Defaults to false. virtual bool ShouldUseMediaPlayerForURL(const GURL& url); diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc index 6922b94..473d148 100644 --- content/renderer/render_frame_impl.cc +++ content/renderer/render_frame_impl.cc @@ -2795,7 +2795,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.mime_type.Utf8(), &found, &info, &mime_type)); if (!found) return NULL; @@ -5364,9 +5365,8 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( (!IsBrowserSideNavigationEnabled() || url != pending_navigation_params_->request_params.redirects[0])); -#ifdef OS_ANDROID - bool render_view_was_created_by_renderer = - render_view_->was_created_by_renderer_; + // CEF doesn't use this value, so just pass false. + bool render_view_was_created_by_renderer = false; // The handlenavigation API is deprecated and will be removed once // crbug.com/325351 is resolved. if (GetContentClient()->renderer()->HandleNavigation( @@ -5379,7 +5379,6 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( } return blink::kWebNavigationPolicyIgnore; } -#endif Referrer referrer( RenderViewImpl::GetReferrerFromRequest(frame_, info.url_request)); diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc index 4ba0c48..46f2afde 100644 --- content/renderer/renderer_blink_platform_impl.cc +++ content/renderer/renderer_blink_platform_impl.cc @@ -737,6 +737,7 @@ blink::WebMIDIAccessor* RendererBlinkPlatformImpl::CreateMIDIAccessor( void RendererBlinkPlatformImpl::GetPluginList( bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) { #if BUILDFLAG(ENABLE_PLUGINS) @@ -744,7 +745,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(WebString::FromUTF16(plugin.name), WebString::FromUTF16(plugin.desc), diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h index 19306df..a731786 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 { cc::FrameSinkId GenerateFrameSinkId() override; void GetPluginList(bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) override; blink::WebPublicSuffixList* PublicSuffixList() override;