1diff --git chrome/browser/download/download_target_determiner.cc chrome/browser/download/download_target_determiner.cc 2index f094105ac70c..b5f4616ff821 100644 3--- chrome/browser/download/download_target_determiner.cc 4+++ chrome/browser/download/download_target_determiner.cc 5@@ -672,7 +672,7 @@ void IsHandledBySafePlugin(int render_process_id, 6 content::PluginService* plugin_service = 7 content::PluginService::GetInstance(); 8 bool plugin_found = plugin_service->GetPluginInfo( 9- render_process_id, routing_id, url, url::Origin(), mime_type, false, 10+ render_process_id, routing_id, url, true, url::Origin(), mime_type, false, 11 &is_stale, &plugin_info, &actual_mime_type); 12 if (is_stale && stale_plugin_action == RETRY_IF_STALE_PLUGIN_LIST) { 13 // The GetPlugins call causes the plugin list to be refreshed. Once that's 14diff --git chrome/browser/plugins/chrome_plugin_service_filter.cc chrome/browser/plugins/chrome_plugin_service_filter.cc 15index c2bd9b8c3131..d1283cf3d9b2 100644 16--- chrome/browser/plugins/chrome_plugin_service_filter.cc 17+++ chrome/browser/plugins/chrome_plugin_service_filter.cc 18@@ -132,6 +132,7 @@ bool ChromePluginServiceFilter::IsPluginAvailable( 19 int render_process_id, 20 int render_frame_id, 21 const GURL& plugin_content_url, 22+ bool is_main_frame, 23 const url::Origin& main_frame_origin, 24 content::WebPluginInfo* plugin) { 25 base::AutoLock auto_lock(lock_); 26diff --git chrome/browser/plugins/chrome_plugin_service_filter.h chrome/browser/plugins/chrome_plugin_service_filter.h 27index 937d3d5bc84f..ac327392dcf3 100644 28--- chrome/browser/plugins/chrome_plugin_service_filter.h 29+++ chrome/browser/plugins/chrome_plugin_service_filter.h 30@@ -64,6 +64,7 @@ class ChromePluginServiceFilter : public content::PluginServiceFilter, 31 bool IsPluginAvailable(int render_process_id, 32 int render_frame_id, 33 const GURL& plugin_content_url, 34+ bool is_main_frame, 35 const url::Origin& main_frame_origin, 36 content::WebPluginInfo* plugin) override; 37 38diff --git chrome/browser/plugins/pdf_iframe_navigation_throttle.cc chrome/browser/plugins/pdf_iframe_navigation_throttle.cc 39index d0a5a12620bd..a02e13bbd815 100644 40--- chrome/browser/plugins/pdf_iframe_navigation_throttle.cc 41+++ chrome/browser/plugins/pdf_iframe_navigation_throttle.cc 42@@ -65,7 +65,7 @@ bool IsPDFPluginEnabled(content::NavigationHandle* navigation_handle, 43 44 content::WebPluginInfo plugin_info; 45 return content::PluginService::GetInstance()->GetPluginInfo( 46- process_id, routing_id, navigation_handle->GetURL(), 47+ process_id, routing_id, navigation_handle->GetURL(), false, 48 web_contents->GetMainFrame()->GetLastCommittedOrigin(), kPDFMimeType, 49 false /* allow_wildcard */, is_stale, &plugin_info, 50 nullptr /* actual_mime_type */); 51diff --git chrome/browser/ui/views/frame/browser_root_view.cc chrome/browser/ui/views/frame/browser_root_view.cc 52index df02e848472f..955edd0b7ff1 100644 53--- chrome/browser/ui/views/frame/browser_root_view.cc 54+++ chrome/browser/ui/views/frame/browser_root_view.cc 55@@ -81,7 +81,7 @@ void OnFindURLMimeType(const GURL& url, 56 #if BUILDFLAG(ENABLE_PLUGINS) 57 content::WebPluginInfo plugin; 58 result = result || content::PluginService::GetInstance()->GetPluginInfo( 59- process_id, routing_id, url, url::Origin(), mime_type, 60+ process_id, routing_id, url, true, url::Origin(), mime_type, 61 false, nullptr, &plugin, nullptr); 62 #endif 63 64diff --git content/browser/devtools/devtools_http_handler.cc content/browser/devtools/devtools_http_handler.cc 65index 7df791af69af..6005886106e5 100644 66--- content/browser/devtools/devtools_http_handler.cc 67+++ content/browser/devtools/devtools_http_handler.cc 68@@ -574,7 +574,7 @@ void DevToolsHttpHandler::OnJsonRequest( 69 version.SetString("Protocol-Version", 70 DevToolsAgentHost::GetProtocolVersion()); 71 version.SetString("WebKit-Version", GetWebKitVersion()); 72- version.SetString("Browser", GetContentClient()->browser()->GetProduct()); 73+ version.SetString("Browser", GetContentClient()->browser()->GetChromeProduct()); 74 version.SetString("User-Agent", 75 GetContentClient()->browser()->GetUserAgent()); 76 version.SetString("V8-Version", V8_VERSION_STRING); 77diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc 78index a46dbf3c52ab..2d83757cef53 100644 79--- content/browser/loader/navigation_url_loader_impl.cc 80+++ content/browser/loader/navigation_url_loader_impl.cc 81@@ -639,6 +639,13 @@ NavigationURLLoaderImpl::PrepareForNonInterceptedRequest( 82 resource_request_->has_user_gesture, 83 resource_request_->request_initiator, &loader_factory); 84 85+ if (!handled) { 86+ handled = GetContentClient()->browser()->HandleExternalProtocol( 87+ web_contents_getter_, frame_tree_node_id_, 88+ navigation_ui_data_.get(), *resource_request_, 89+ &loader_factory); 90+ } 91+ 92 if (loader_factory) { 93 factory = base::MakeRefCounted<network::WrapperSharedURLLoaderFactory>( 94 std::move(loader_factory)); 95@@ -859,7 +866,7 @@ void NavigationURLLoaderImpl::CheckPluginAndContinueOnReceiveResponse( 96 frame_tree_node->current_frame_host()->GetProcess()->GetID(); 97 int routing_id = frame_tree_node->current_frame_host()->GetRoutingID(); 98 bool has_plugin = PluginService::GetInstance()->GetPluginInfo( 99- render_process_id, routing_id, resource_request_->url, url::Origin(), 100+ render_process_id, routing_id, resource_request_->url, true, url::Origin(), 101 head->mime_type, false /* allow_wildcard */, &stale, &plugin, nullptr); 102 103 if (stale) { 104diff --git content/browser/plugin_service_impl.cc content/browser/plugin_service_impl.cc 105index 12e48ad8e3e3..1fd51c85ad6f 100644 106--- content/browser/plugin_service_impl.cc 107+++ content/browser/plugin_service_impl.cc 108@@ -269,6 +269,7 @@ bool PluginServiceImpl::GetPluginInfoArray( 109 bool PluginServiceImpl::GetPluginInfo(int render_process_id, 110 int render_frame_id, 111 const GURL& url, 112+ bool is_main_frame, 113 const url::Origin& main_frame_origin, 114 const std::string& mime_type, 115 bool allow_wildcard, 116@@ -286,7 +287,8 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, 117 for (size_t i = 0; i < plugins.size(); ++i) { 118 if (!filter_ || 119 filter_->IsPluginAvailable(render_process_id, render_frame_id, url, 120- main_frame_origin, &plugins[i])) { 121+ is_main_frame, main_frame_origin, 122+ &plugins[i])) { 123 *info = plugins[i]; 124 if (actual_mime_type) 125 *actual_mime_type = mime_types[i]; 126diff --git content/browser/plugin_service_impl.h content/browser/plugin_service_impl.h 127index 3ce3ad55eef1..77674a722455 100644 128--- content/browser/plugin_service_impl.h 129+++ content/browser/plugin_service_impl.h 130@@ -54,6 +54,7 @@ class CONTENT_EXPORT PluginServiceImpl : public PluginService { 131 bool GetPluginInfo(int render_process_id, 132 int render_frame_id, 133 const GURL& url, 134+ bool is_main_frame, 135 const url::Origin& main_frame_origin, 136 const std::string& mime_type, 137 bool allow_wildcard, 138diff --git content/browser/renderer_host/plugin_registry_impl.cc content/browser/renderer_host/plugin_registry_impl.cc 139index a6d6188fb139..7ac57de6fd55 100644 140--- content/browser/renderer_host/plugin_registry_impl.cc 141+++ content/browser/renderer_host/plugin_registry_impl.cc 142@@ -29,6 +29,7 @@ void PluginRegistryImpl::Bind( 143 } 144 145 void PluginRegistryImpl::GetPlugins(bool refresh, 146+ bool is_main_frame, 147 const url::Origin& main_frame_origin, 148 GetPluginsCallback callback) { 149 auto* plugin_service = PluginServiceImpl::GetInstance(); 150@@ -50,10 +51,11 @@ void PluginRegistryImpl::GetPlugins(bool refresh, 151 152 plugin_service->GetPlugins(base::BindOnce( 153 &PluginRegistryImpl::GetPluginsComplete, weak_factory_.GetWeakPtr(), 154- main_frame_origin, std::move(callback))); 155+ is_main_frame, main_frame_origin, std::move(callback))); 156 } 157 158 void PluginRegistryImpl::GetPluginsComplete( 159+ bool is_main_frame, 160 const url::Origin& main_frame_origin, 161 GetPluginsCallback callback, 162 const std::vector<WebPluginInfo>& all_plugins) { 163@@ -76,6 +78,7 @@ void PluginRegistryImpl::GetPluginsComplete( 164 // TODO(crbug.com/621724): Pass an url::Origin instead of a GURL. 165 if (!filter || filter->IsPluginAvailable(render_process_id_, routing_id, 166 main_frame_origin.GetURL(), 167+ is_main_frame, 168 main_frame_origin, &plugin)) { 169 auto plugin_blink = blink::mojom::PluginInfo::New(); 170 plugin_blink->name = plugin.name; 171diff --git content/browser/renderer_host/plugin_registry_impl.h content/browser/renderer_host/plugin_registry_impl.h 172index 632ae86c6fd6..55b749ec1242 100644 173--- content/browser/renderer_host/plugin_registry_impl.h 174+++ content/browser/renderer_host/plugin_registry_impl.h 175@@ -24,11 +24,13 @@ class PluginRegistryImpl : public blink::mojom::PluginRegistry { 176 177 // blink::mojom::PluginRegistry 178 void GetPlugins(bool refresh, 179+ bool is_main_frame, 180 const url::Origin& main_frame_origin, 181 GetPluginsCallback callback) override; 182 183 private: 184- void GetPluginsComplete(const url::Origin& main_frame_origin, 185+ void GetPluginsComplete(bool is_main_frame, 186+ const url::Origin& main_frame_origin, 187 GetPluginsCallback callback, 188 const std::vector<WebPluginInfo>& all_plugins); 189 190diff --git content/browser/renderer_host/render_frame_host_impl.cc content/browser/renderer_host/render_frame_host_impl.cc 191index 7f7e6adf5712..79ea43f9ef23 100644 192--- content/browser/renderer_host/render_frame_host_impl.cc 193+++ content/browser/renderer_host/render_frame_host_impl.cc 194@@ -10739,6 +10739,7 @@ void RenderFrameHostImpl::BindHungDetectorHost( 195 } 196 197 void RenderFrameHostImpl::GetPluginInfo(const GURL& url, 198+ bool is_main_frame, 199 const url::Origin& main_frame_origin, 200 const std::string& mime_type, 201 GetPluginInfoCallback callback) { 202@@ -10746,7 +10747,8 @@ void RenderFrameHostImpl::GetPluginInfo(const GURL& url, 203 WebPluginInfo info; 204 std::string actual_mime_type; 205 bool found = PluginServiceImpl::GetInstance()->GetPluginInfo( 206- GetProcess()->GetID(), routing_id_, url, main_frame_origin, mime_type, 207+ GetProcess()->GetID(), routing_id_, url, is_main_frame, 208+ main_frame_origin, mime_type, 209 allow_wildcard, nullptr, &info, &actual_mime_type); 210 std::move(callback).Run(found, info, actual_mime_type); 211 } 212diff --git content/browser/renderer_host/render_frame_host_impl.h content/browser/renderer_host/render_frame_host_impl.h 213index d4a16dbf87ad..ee946606eb14 100644 214--- content/browser/renderer_host/render_frame_host_impl.h 215+++ content/browser/renderer_host/render_frame_host_impl.h 216@@ -2339,6 +2339,7 @@ class CONTENT_EXPORT RenderFrameHostImpl 217 int32_t plugin_child_id, 218 const base::FilePath& path) override; 219 void GetPluginInfo(const GURL& url, 220+ bool is_main_frame, 221 const url::Origin& main_frame_origin, 222 const std::string& mime_type, 223 GetPluginInfoCallback callback) override; 224diff --git content/common/pepper_plugin.mojom content/common/pepper_plugin.mojom 225index a544bfed7ed8..60aad01350c2 100644 226--- content/common/pepper_plugin.mojom 227+++ content/common/pepper_plugin.mojom 228@@ -29,6 +29,7 @@ interface PepperHost { 229 // found plugin. 230 [Sync] 231 GetPluginInfo(url.mojom.Url url, 232+ bool is_main_frame, 233 url.mojom.Origin main_frame_origin, 234 string mime_type) => 235 (bool found, 236diff --git content/public/browser/content_browser_client.cc content/public/browser/content_browser_client.cc 237index 97c47faadb92..7b732f17360b 100644 238--- content/public/browser/content_browser_client.cc 239+++ content/public/browser/content_browser_client.cc 240@@ -9,7 +9,7 @@ 241 // declarations instead of including more headers. If that is infeasible, adjust 242 // the limit. For more info, see 243 // https://chromium.googlesource.com/chromium/src/+/HEAD/docs/wmax_tokens.md 244-#pragma clang max_tokens_here 850000 245+// #pragma clang max_tokens_here 850000 246 247 #include <utility> 248 249diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h 250index aac67f9733e5..aadc1036e6af 100644 251--- content/public/browser/content_browser_client.h 252+++ content/public/browser/content_browser_client.h 253@@ -32,6 +32,7 @@ 254 #include "content/public/browser/generated_code_cache_settings.h" 255 #include "content/public/browser/mojo_binder_policy_map.h" 256 #include "content/public/browser/storage_partition_config.h" 257+#include "content/public/browser/web_contents.h" 258 #include "content/public/common/page_visibility_state.h" 259 #include "content/public/common/window_container_type.mojom-forward.h" 260 #include "device/vr/buildflags/buildflags.h" 261@@ -1763,6 +1764,14 @@ class CONTENT_EXPORT ContentBrowserClient { 262 const base::Optional<url::Origin>& initiating_origin, 263 mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory); 264 265+ // Same as above, but exposing the whole ResourceRequest object. 266+ virtual bool HandleExternalProtocol( 267+ WebContents::Getter web_contents_getter, 268+ int frame_tree_node_id, 269+ NavigationUIData* navigation_data, 270+ const network::ResourceRequest& request, 271+ mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { return false; } 272+ 273 // Creates an OverlayWindow to be used for Picture-in-Picture. This window 274 // will house the content shown when in Picture-in-Picture mode. This will 275 // return a new OverlayWindow. 276@@ -1836,6 +1845,10 @@ class CONTENT_EXPORT ContentBrowserClient { 277 // Used as part of the user agent string. 278 virtual std::string GetProduct(); 279 280+ // Returns the Chrome-specific product string. This is used for compatibility 281+ // purposes with external tools like Selenium. 282+ virtual std::string GetChromeProduct() { return GetProduct(); } 283+ 284 // Returns the user agent. Content may cache this value. 285 virtual std::string GetUserAgent(); 286 287diff --git content/public/browser/plugin_service.h content/public/browser/plugin_service.h 288index 90fb0fcfa822..d48e64b1573c 100644 289--- content/public/browser/plugin_service.h 290+++ content/public/browser/plugin_service.h 291@@ -73,6 +73,7 @@ class CONTENT_EXPORT PluginService { 292 virtual bool GetPluginInfo(int render_process_id, 293 int render_frame_id, 294 const GURL& url, 295+ bool is_main_frame, 296 const url::Origin& main_frame_origin, 297 const std::string& mime_type, 298 bool allow_wildcard, 299diff --git content/public/browser/plugin_service_filter.h content/public/browser/plugin_service_filter.h 300index 98c59005599e..69752184745d 100644 301--- content/public/browser/plugin_service_filter.h 302+++ content/public/browser/plugin_service_filter.h 303@@ -32,6 +32,7 @@ class PluginServiceFilter { 304 virtual bool IsPluginAvailable(int render_process_id, 305 int render_frame_id, 306 const GURL& url, 307+ bool is_main_frame, 308 const url::Origin& main_frame_origin, 309 WebPluginInfo* plugin) = 0; 310 311diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h 312index f84df6e58160..38e5eeef558b 100644 313--- content/public/renderer/content_renderer_client.h 314+++ content/public/renderer/content_renderer_client.h 315@@ -82,6 +82,9 @@ class CONTENT_EXPORT ContentRendererClient { 316 // binding requests from RenderProcessHost::BindReceiver(). 317 virtual void ExposeInterfacesToBrowser(mojo::BinderMap* binders) {} 318 319+ // Notifies that the RenderThread can now send sync IPC messages. 320+ virtual void RenderThreadConnected() {} 321+ 322 // Notifies that a new RenderFrame has been created. 323 virtual void RenderFrameCreated(RenderFrame* render_frame) {} 324 325@@ -298,6 +301,10 @@ class CONTENT_EXPORT ContentRendererClient { 326 // This method may invalidate the frame. 327 virtual void RunScriptsAtDocumentIdle(RenderFrame* render_frame) {} 328 329+ // Notifies that a DevTools agent has attached or detached. 330+ virtual void DevToolsAgentAttached() {} 331+ virtual void DevToolsAgentDetached() {} 332+ 333 // Allows subclasses to enable some runtime features before Blink has 334 // started. 335 virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {} 336diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc 337index 580974507f1a..86a0514c8b55 100644 338--- content/renderer/render_frame_impl.cc 339+++ content/renderer/render_frame_impl.cc 340@@ -3548,7 +3548,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( 341 WebPluginInfo info; 342 std::string mime_type; 343 bool found = false; 344- GetPepperHost()->GetPluginInfo(params.url, frame_->Top()->GetSecurityOrigin(), 345+ GetPepperHost()->GetPluginInfo(params.url, frame_->Parent() == nullptr, 346+ frame_->Top()->GetSecurityOrigin(), 347 params.mime_type.Utf8(), &found, &info, 348 &mime_type); 349 if (!found) 350diff --git content/renderer/render_thread_impl.cc content/renderer/render_thread_impl.cc 351index ed9d15a2832c..7603a77eb945 100644 352--- content/renderer/render_thread_impl.cc 353+++ content/renderer/render_thread_impl.cc 354@@ -618,6 +618,8 @@ void RenderThreadImpl::Init() { 355 GetContentClient()->renderer()->CreateURLLoaderThrottleProvider( 356 blink::URLLoaderThrottleProviderType::kFrame); 357 358+ GetContentClient()->renderer()->RenderThreadConnected(); 359+ 360 GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( 361 &RenderThreadImpl::OnRendererInterfaceReceiver, base::Unretained(this))); 362 363diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc 364index 7aec578843ce..f631601f1bb1 100644 365--- content/renderer/renderer_blink_platform_impl.cc 366+++ content/renderer/renderer_blink_platform_impl.cc 367@@ -1022,6 +1022,15 @@ SkBitmap* RendererBlinkPlatformImpl::GetSadPageBitmap() { 368 369 //------------------------------------------------------------------------------ 370 371+void RendererBlinkPlatformImpl::DevToolsAgentAttached() { 372+ GetContentClient()->renderer()->DevToolsAgentAttached(); 373+} 374+void RendererBlinkPlatformImpl::DevToolsAgentDetached() { 375+ GetContentClient()->renderer()->DevToolsAgentDetached(); 376+} 377+ 378+//------------------------------------------------------------------------------ 379+ 380 blink::mojom::CodeCacheHost& RendererBlinkPlatformImpl::GetCodeCacheHost() { 381 if (!code_cache_host_) { 382 code_cache_host_ = mojo::SharedRemote<blink::mojom::CodeCacheHost>( 383diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h 384index 7a836b82ee15..8e026751ce35 100644 385--- content/renderer/renderer_blink_platform_impl.h 386+++ content/renderer/renderer_blink_platform_impl.h 387@@ -220,6 +220,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { 388 const blink::WebString& top_url) override; 389 SkBitmap* GetSadPageBitmap() override; 390 391+ void DevToolsAgentAttached() override; 392+ void DevToolsAgentDetached() override; 393+ 394 // Tells this platform that the renderer is locked to a site (i.e., a scheme 395 // plus eTLD+1, such as https://google.com), or to a more specific origin. 396 void SetIsLockedToSite(); 397diff --git content/shell/browser/shell_plugin_service_filter.cc content/shell/browser/shell_plugin_service_filter.cc 398index c25b7d1a1843..7e007d964f1a 100644 399--- content/shell/browser/shell_plugin_service_filter.cc 400+++ content/shell/browser/shell_plugin_service_filter.cc 401@@ -17,6 +17,7 @@ bool ShellPluginServiceFilter::IsPluginAvailable( 402 int render_process_id, 403 int render_frame_id, 404 const GURL& url, 405+ bool is_main_frame, 406 const url::Origin& main_frame_origin, 407 WebPluginInfo* plugin) { 408 return plugin->name == u"Blink Test Plugin" || 409diff --git content/shell/browser/shell_plugin_service_filter.h content/shell/browser/shell_plugin_service_filter.h 410index 337b4b0653fe..107ab4c9d8a8 100644 411--- content/shell/browser/shell_plugin_service_filter.h 412+++ content/shell/browser/shell_plugin_service_filter.h 413@@ -20,6 +20,7 @@ class ShellPluginServiceFilter : public PluginServiceFilter { 414 bool IsPluginAvailable(int render_process_id, 415 int render_frame_id, 416 const GURL& url, 417+ bool is_main_frame, 418 const url::Origin& main_frame_origin, 419 WebPluginInfo* plugin) override; 420 421diff --git content/test/fake_plugin_service.cc content/test/fake_plugin_service.cc 422index f816fe5382c7..7846e2b90867 100644 423--- content/test/fake_plugin_service.cc 424+++ content/test/fake_plugin_service.cc 425@@ -28,6 +28,7 @@ bool FakePluginService::GetPluginInfoArray( 426 bool FakePluginService::GetPluginInfo(int render_process_id, 427 int render_frame_id, 428 const GURL& url, 429+ bool is_main_frame, 430 const url::Origin& main_frame_origin, 431 const std::string& mime_type, 432 bool allow_wildcard, 433diff --git content/test/fake_plugin_service.h content/test/fake_plugin_service.h 434index e5f53ee41161..b9d73ebee4ec 100644 435--- content/test/fake_plugin_service.h 436+++ content/test/fake_plugin_service.h 437@@ -29,6 +29,7 @@ class FakePluginService : public PluginService { 438 bool GetPluginInfo(int render_process_id, 439 int render_frame_id, 440 const GURL& url, 441+ bool is_main_frame, 442 const url::Origin& main_frame_origin, 443 const std::string& mime_type, 444 bool allow_wildcard, 445