• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git content/browser/devtools/devtools_http_handler.cc content/browser/devtools/devtools_http_handler.cc
2index ec6be2ff24d23..159ed7776c0aa 100644
3--- content/browser/devtools/devtools_http_handler.cc
4+++ content/browser/devtools/devtools_http_handler.cc
5@@ -576,7 +576,7 @@ void DevToolsHttpHandler::OnJsonRequest(
6     version.SetString("Protocol-Version",
7                       DevToolsAgentHost::GetProtocolVersion());
8     version.SetString("WebKit-Version", GetWebKitVersion());
9-    version.SetString("Browser", GetContentClient()->browser()->GetProduct());
10+    version.SetString("Browser", GetContentClient()->browser()->GetChromeProduct());
11     version.SetString("User-Agent",
12                       GetContentClient()->browser()->GetUserAgent());
13     version.SetString("V8-Version", V8_VERSION_STRING);
14diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc
15index b5c2dc992fb19..868661c86c39a 100644
16--- content/browser/loader/navigation_url_loader_impl.cc
17+++ content/browser/loader/navigation_url_loader_impl.cc
18@@ -665,6 +665,14 @@ NavigationURLLoaderImpl::PrepareForNonInterceptedRequest(
19           resource_request_->has_user_gesture, initiating_origin,
20           initiator_document_.AsRenderFrameHostIfValid(), &loader_factory);
21
22+      if (!handled) {
23+        handled = GetContentClient()->browser()->HandleExternalProtocol(
24+            web_contents_getter_, frame_tree_node_id_,
25+            navigation_ui_data_.get(), request_info_->sandbox_flags,
26+            *resource_request_, initiating_origin,
27+            initiator_document_.AsRenderFrameHostIfValid(), &loader_factory);
28+      }
29+
30       if (loader_factory) {
31         factory = base::MakeRefCounted<network::WrapperSharedURLLoaderFactory>(
32             std::move(loader_factory));
33diff --git content/public/browser/content_browser_client.cc content/public/browser/content_browser_client.cc
34index 2579cf2ce325d..03b60ce3b17cb 100644
35--- content/public/browser/content_browser_client.cc
36+++ content/public/browser/content_browser_client.cc
37@@ -11,7 +11,7 @@
38 // declarations instead of including more headers. If that is infeasible, adjust
39 // the limit. For more info, see
40 // https://chromium.googlesource.com/chromium/src/+/HEAD/docs/wmax_tokens.md
41-#pragma clang max_tokens_here 850000
42+// #pragma clang max_tokens_here 850000
43
44 #include <utility>
45
46@@ -877,7 +877,7 @@ ContentBrowserClient::CreateURLLoaderHandlerForServiceWorkerNavigationPreload(
47 void ContentBrowserClient::OnNetworkServiceCreated(
48     network::mojom::NetworkService* network_service) {}
49
50-void ContentBrowserClient::ConfigureNetworkContextParams(
51+bool ContentBrowserClient::ConfigureNetworkContextParams(
52     BrowserContext* context,
53     bool in_memory,
54     const base::FilePath& relative_partition_path,
55@@ -886,6 +886,7 @@ void ContentBrowserClient::ConfigureNetworkContextParams(
56         cert_verifier_creation_params) {
57   network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
58   network_context_params->accept_language = "en-us,en";
59+  return true;
60 }
61
62 std::vector<base::FilePath>
63diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h
64index 7d3fafd564118..789bfd693888f 100644
65--- content/public/browser/content_browser_client.h
66+++ content/public/browser/content_browser_client.h
67@@ -33,6 +33,7 @@
68 #include "content/public/browser/login_delegate.h"
69 #include "content/public/browser/mojo_binder_policy_map.h"
70 #include "content/public/browser/storage_partition_config.h"
71+#include "content/public/browser/web_contents.h"
72 #include "content/public/browser/web_ui_browser_interface_broker_registry.h"
73 #include "content/public/common/main_function_params.h"
74 #include "content/public/common/page_visibility_state.h"
75@@ -1634,7 +1635,7 @@ class CONTENT_EXPORT ContentBrowserClient {
76   //
77   // If |relative_partition_path| is the empty string, it means this needs to
78   // create the default NetworkContext for the BrowserContext.
79-  virtual void ConfigureNetworkContextParams(
80+  virtual bool ConfigureNetworkContextParams(
81       BrowserContext* context,
82       bool in_memory,
83       const base::FilePath& relative_partition_path,
84@@ -1823,6 +1824,17 @@ class CONTENT_EXPORT ContentBrowserClient {
85       RenderFrameHost* initiator_document,
86       mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory);
87
88+  // Same as above, but exposing the whole ResourceRequest object.
89+  virtual bool HandleExternalProtocol(
90+      WebContents::Getter web_contents_getter,
91+      int frame_tree_node_id,
92+      NavigationUIData* navigation_data,
93+      network::mojom::WebSandboxFlags sandbox_flags,
94+      const network::ResourceRequest& request,
95+      const absl::optional<url::Origin>& initiating_origin,
96+      RenderFrameHost* initiator_document,
97+      mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { return false; }
98+
99   // Creates an OverlayWindow to be used for Picture-in-Picture. This window
100   // will house the content shown when in Picture-in-Picture mode. This will
101   // return a new OverlayWindow.
102@@ -1879,6 +1891,10 @@ class CONTENT_EXPORT ContentBrowserClient {
103   // Used as part of the user agent string.
104   virtual std::string GetProduct();
105
106+  // Returns the Chrome-specific product string. This is used for compatibility
107+  // purposes with external tools like Selenium.
108+  virtual std::string GetChromeProduct() { return GetProduct(); }
109+
110   // Returns the user agent. This can also return the reduced user agent, based
111   // on blink::features::kUserAgentReduction. Content may cache this value.
112   virtual std::string GetUserAgent();
113diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h
114index b914cb91a2b49..2f84201ba4d1e 100644
115--- content/public/renderer/content_renderer_client.h
116+++ content/public/renderer/content_renderer_client.h
117@@ -87,6 +87,9 @@ class CONTENT_EXPORT ContentRendererClient {
118   // binding requests from RenderProcessHost::BindReceiver().
119   virtual void ExposeInterfacesToBrowser(mojo::BinderMap* binders) {}
120
121+  // Notifies that the RenderThread can now send sync IPC messages.
122+  virtual void RenderThreadConnected() {}
123+
124   // Notifies that a new RenderFrame has been created.
125   virtual void RenderFrameCreated(RenderFrame* render_frame) {}
126
127@@ -298,6 +301,10 @@ class CONTENT_EXPORT ContentRendererClient {
128   // This method may invalidate the frame.
129   virtual void RunScriptsAtDocumentIdle(RenderFrame* render_frame) {}
130
131+  // Notifies that a DevTools agent has attached or detached.
132+  virtual void DevToolsAgentAttached() {}
133+  virtual void DevToolsAgentDetached() {}
134+
135   // Allows subclasses to enable some runtime features before Blink has
136   // started.
137   virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {}
138diff --git content/renderer/render_thread_impl.cc content/renderer/render_thread_impl.cc
139index f6574e15fc0d3..380b80337da71 100644
140--- content/renderer/render_thread_impl.cc
141+++ content/renderer/render_thread_impl.cc
142@@ -656,6 +656,8 @@ void RenderThreadImpl::Init() {
143       GetContentClient()->renderer()->CreateURLLoaderThrottleProvider(
144           blink::URLLoaderThrottleProviderType::kFrame);
145
146+  GetContentClient()->renderer()->RenderThreadConnected();
147+
148   GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating(
149       &RenderThreadImpl::OnRendererInterfaceReceiver, base::Unretained(this)));
150
151diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc
152index b4e37bbdd3a80..1d16b769a6329 100644
153--- content/renderer/renderer_blink_platform_impl.cc
154+++ content/renderer/renderer_blink_platform_impl.cc
155@@ -1082,6 +1082,15 @@ SkBitmap* RendererBlinkPlatformImpl::GetSadPageBitmap() {
156
157 //------------------------------------------------------------------------------
158
159+void RendererBlinkPlatformImpl::DevToolsAgentAttached() {
160+  GetContentClient()->renderer()->DevToolsAgentAttached();
161+}
162+void RendererBlinkPlatformImpl::DevToolsAgentDetached() {
163+  GetContentClient()->renderer()->DevToolsAgentDetached();
164+}
165+
166+//------------------------------------------------------------------------------
167+
168 mojo::SharedRemote<blink::mojom::CodeCacheHost>
169 RendererBlinkPlatformImpl::GetCodeCacheHost() {
170   base::AutoLock lock(code_cache_host_lock_);
171diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h
172index 2191ab72dcacc..d902eb707cc99 100644
173--- content/renderer/renderer_blink_platform_impl.h
174+++ content/renderer/renderer_blink_platform_impl.h
175@@ -260,6 +260,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
176       blink::WebVector<blink::WebContentSecurityPolicyHeader>* csp) override;
177   base::PlatformThreadId GetIOThreadId() const override;
178
179+  void DevToolsAgentAttached() override;
180+  void DevToolsAgentDetached() override;
181+
182   // Tells this platform that the renderer is locked to a site (i.e., a scheme
183   // plus eTLD+1, such as https://google.com), or to a more specific origin.
184   void SetIsLockedToSite();
185