2019-04-24 04:50:25 +02:00
|
|
|
diff --git content/browser/devtools/devtools_http_handler.cc content/browser/devtools/devtools_http_handler.cc
|
2022-02-21 23:23:40 +01:00
|
|
|
index fc87fd9a6ffca..99c6b27018e13 100644
|
2019-04-24 04:50:25 +02:00
|
|
|
--- content/browser/devtools/devtools_http_handler.cc
|
|
|
|
+++ content/browser/devtools/devtools_http_handler.cc
|
2022-01-25 21:26:51 +01:00
|
|
|
@@ -576,7 +576,7 @@ void DevToolsHttpHandler::OnJsonRequest(
|
2019-04-24 04:50:25 +02:00
|
|
|
version.SetString("Protocol-Version",
|
|
|
|
DevToolsAgentHost::GetProtocolVersion());
|
|
|
|
version.SetString("WebKit-Version", GetWebKitVersion());
|
|
|
|
- version.SetString("Browser", GetContentClient()->browser()->GetProduct());
|
|
|
|
+ version.SetString("Browser", GetContentClient()->browser()->GetChromeProduct());
|
|
|
|
version.SetString("User-Agent",
|
|
|
|
GetContentClient()->browser()->GetUserAgent());
|
|
|
|
version.SetString("V8-Version", V8_VERSION_STRING);
|
2019-03-24 01:39:54 +01:00
|
|
|
diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc
|
2022-03-26 02:12:30 +01:00
|
|
|
index 3f06e6b8cd335..257d3f20f92d7 100644
|
2019-03-24 01:39:54 +01:00
|
|
|
--- content/browser/loader/navigation_url_loader_impl.cc
|
|
|
|
+++ content/browser/loader/navigation_url_loader_impl.cc
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -672,6 +672,17 @@ NavigationURLLoaderImpl::PrepareForNonInterceptedRequest(
|
2021-10-19 00:17:16 +02:00
|
|
|
resource_request_->has_user_gesture, initiating_origin,
|
2022-01-25 21:26:51 +01:00
|
|
|
initiator_document_.AsRenderFrameHostIfValid(), &loader_factory);
|
2019-09-04 17:13:32 +02:00
|
|
|
|
2020-07-08 19:23:29 +02:00
|
|
|
+ if (!handled) {
|
|
|
|
+ handled = GetContentClient()->browser()->HandleExternalProtocol(
|
|
|
|
+ web_contents_getter_, frame_tree_node_id_,
|
2022-03-26 02:12:30 +01:00
|
|
|
+ navigation_ui_data_.get(), request_info_->is_primary_main_frame,
|
|
|
|
+ FrameTreeNode::GloballyFindByID(frame_tree_node_id_)
|
|
|
|
+ ->IsInFencedFrameTree(),
|
|
|
|
+ request_info_->sandbox_flags,
|
2022-01-25 21:26:51 +01:00
|
|
|
+ *resource_request_, initiating_origin,
|
|
|
|
+ initiator_document_.AsRenderFrameHostIfValid(), &loader_factory);
|
2020-07-08 19:23:29 +02:00
|
|
|
+ }
|
2019-09-04 17:13:32 +02:00
|
|
|
+
|
2020-07-08 19:23:29 +02:00
|
|
|
if (loader_factory) {
|
|
|
|
factory = base::MakeRefCounted<network::WrapperSharedURLLoaderFactory>(
|
|
|
|
std::move(loader_factory));
|
2020-03-30 22:13:42 +02:00
|
|
|
diff --git content/public/browser/content_browser_client.cc content/public/browser/content_browser_client.cc
|
2022-03-26 02:12:30 +01:00
|
|
|
index 2ba5cc555c691..a092c6ba09112 100644
|
2020-03-30 22:13:42 +02:00
|
|
|
--- content/public/browser/content_browser_client.cc
|
|
|
|
+++ content/public/browser/content_browser_client.cc
|
2022-01-25 21:26:51 +01:00
|
|
|
@@ -11,7 +11,7 @@
|
2020-03-30 22:13:42 +02:00
|
|
|
// declarations instead of including more headers. If that is infeasible, adjust
|
|
|
|
// the limit. For more info, see
|
|
|
|
// https://chromium.googlesource.com/chromium/src/+/HEAD/docs/wmax_tokens.md
|
2022-03-26 02:12:30 +01:00
|
|
|
-#pragma clang max_tokens_here 880000
|
|
|
|
+// #pragma clang max_tokens_here 880000
|
2020-03-30 22:13:42 +02:00
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -892,7 +892,7 @@ ContentBrowserClient::CreateURLLoaderHandlerForServiceWorkerNavigationPreload(
|
2021-10-19 00:17:16 +02:00
|
|
|
void ContentBrowserClient::OnNetworkServiceCreated(
|
|
|
|
network::mojom::NetworkService* network_service) {}
|
|
|
|
|
|
|
|
-void ContentBrowserClient::ConfigureNetworkContextParams(
|
|
|
|
+bool ContentBrowserClient::ConfigureNetworkContextParams(
|
|
|
|
BrowserContext* context,
|
|
|
|
bool in_memory,
|
|
|
|
const base::FilePath& relative_partition_path,
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -901,6 +901,7 @@ void ContentBrowserClient::ConfigureNetworkContextParams(
|
2021-10-19 00:17:16 +02:00
|
|
|
cert_verifier_creation_params) {
|
2021-12-16 23:35:54 +01:00
|
|
|
network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
|
2021-10-19 00:17:16 +02:00
|
|
|
network_context_params->accept_language = "en-us,en";
|
|
|
|
+ return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<base::FilePath>
|
2019-04-24 04:50:25 +02:00
|
|
|
diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h
|
2022-03-26 02:12:30 +01:00
|
|
|
index 5c757ff4b622d..1286b9c26f427 100644
|
2019-04-24 04:50:25 +02:00
|
|
|
--- content/public/browser/content_browser_client.h
|
|
|
|
+++ content/public/browser/content_browser_client.h
|
2022-02-21 23:23:40 +01:00
|
|
|
@@ -34,6 +34,7 @@
|
2021-08-20 01:40:49 +02:00
|
|
|
#include "content/public/browser/login_delegate.h"
|
2021-01-28 00:13:12 +01:00
|
|
|
#include "content/public/browser/mojo_binder_policy_map.h"
|
2020-07-08 19:23:29 +02:00
|
|
|
#include "content/public/browser/storage_partition_config.h"
|
2019-11-12 17:11:44 +01:00
|
|
|
+#include "content/public/browser/web_contents.h"
|
2021-09-20 11:06:23 +02:00
|
|
|
#include "content/public/browser/web_ui_browser_interface_broker_registry.h"
|
2022-02-21 23:23:40 +01:00
|
|
|
#include "content/public/common/alternative_error_page_override_info.mojom.h"
|
2021-12-16 23:35:54 +01:00
|
|
|
#include "content/public/common/main_function_params.h"
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -1668,7 +1669,7 @@ class CONTENT_EXPORT ContentBrowserClient {
|
2021-10-19 00:17:16 +02:00
|
|
|
//
|
|
|
|
// If |relative_partition_path| is the empty string, it means this needs to
|
|
|
|
// create the default NetworkContext for the BrowserContext.
|
|
|
|
- virtual void ConfigureNetworkContextParams(
|
|
|
|
+ virtual bool ConfigureNetworkContextParams(
|
|
|
|
BrowserContext* context,
|
|
|
|
bool in_memory,
|
|
|
|
const base::FilePath& relative_partition_path,
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -1875,6 +1876,19 @@ class CONTENT_EXPORT ContentBrowserClient {
|
2022-01-25 21:26:51 +01:00
|
|
|
RenderFrameHost* initiator_document,
|
2020-02-10 18:10:17 +01:00
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory);
|
2019-04-24 04:50:25 +02:00
|
|
|
|
|
|
|
+ // Same as above, but exposing the whole ResourceRequest object.
|
|
|
|
+ virtual bool HandleExternalProtocol(
|
2019-10-01 15:55:16 +02:00
|
|
|
+ WebContents::Getter web_contents_getter,
|
2019-04-24 04:50:25 +02:00
|
|
|
+ int frame_tree_node_id,
|
|
|
|
+ NavigationUIData* navigation_data,
|
2022-03-26 02:12:30 +01:00
|
|
|
+ bool is_primary_main_frame,
|
|
|
|
+ bool is_in_fenced_frame_tree,
|
2021-10-19 00:17:16 +02:00
|
|
|
+ network::mojom::WebSandboxFlags sandbox_flags,
|
2019-04-24 04:50:25 +02:00
|
|
|
+ const network::ResourceRequest& request,
|
2022-01-25 21:26:51 +01:00
|
|
|
+ const absl::optional<url::Origin>& initiating_origin,
|
|
|
|
+ RenderFrameHost* initiator_document,
|
2020-02-10 18:10:17 +01:00
|
|
|
+ mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { return false; }
|
2019-04-24 04:50:25 +02:00
|
|
|
+
|
2022-02-21 23:23:40 +01:00
|
|
|
// Creates an OverlayWindow to be used for video or document
|
|
|
|
// Picture-in-Picture respectively. This window will house the content shown
|
|
|
|
// when in Picture-in-Picture mode. This will return a new OverlayWindow.
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -1936,6 +1950,10 @@ class CONTENT_EXPORT ContentBrowserClient {
|
2019-04-24 04:50:25 +02:00
|
|
|
// Used as part of the user agent string.
|
2019-09-04 17:13:32 +02:00
|
|
|
virtual std::string GetProduct();
|
2019-04-24 04:50:25 +02:00
|
|
|
|
|
|
|
+ // Returns the Chrome-specific product string. This is used for compatibility
|
|
|
|
+ // purposes with external tools like Selenium.
|
2019-09-04 17:13:32 +02:00
|
|
|
+ virtual std::string GetChromeProduct() { return GetProduct(); }
|
2019-04-24 04:50:25 +02:00
|
|
|
+
|
2021-12-16 23:35:54 +01:00
|
|
|
// Returns the user agent. This can also return the reduced user agent, based
|
|
|
|
// on blink::features::kUserAgentReduction. Content may cache this value.
|
2019-09-04 17:13:32 +02:00
|
|
|
virtual std::string GetUserAgent();
|
2017-04-20 21:28:17 +02:00
|
|
|
diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h
|
2022-03-26 02:12:30 +01:00
|
|
|
index eb8968c2a8610..143c3aaeda88e 100644
|
2017-04-20 21:28:17 +02:00
|
|
|
--- content/public/renderer/content_renderer_client.h
|
|
|
|
+++ content/public/renderer/content_renderer_client.h
|
2022-02-21 23:23:40 +01:00
|
|
|
@@ -88,6 +88,9 @@ class CONTENT_EXPORT ContentRendererClient {
|
2020-02-10 18:10:17 +01:00
|
|
|
// binding requests from RenderProcessHost::BindReceiver().
|
|
|
|
virtual void ExposeInterfacesToBrowser(mojo::BinderMap* binders) {}
|
2017-05-31 17:33:30 +02:00
|
|
|
|
|
|
|
+ // Notifies that the RenderThread can now send sync IPC messages.
|
|
|
|
+ virtual void RenderThreadConnected() {}
|
|
|
|
+
|
|
|
|
// Notifies that a new RenderFrame has been created.
|
|
|
|
virtual void RenderFrameCreated(RenderFrame* render_frame) {}
|
|
|
|
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -298,6 +301,10 @@ class CONTENT_EXPORT ContentRendererClient {
|
2017-12-07 22:44:24 +01:00
|
|
|
// This method may invalidate the frame.
|
|
|
|
virtual void RunScriptsAtDocumentIdle(RenderFrame* render_frame) {}
|
|
|
|
|
|
|
|
+ // Notifies that a DevTools agent has attached or detached.
|
2018-02-15 01:12:09 +01:00
|
|
|
+ virtual void DevToolsAgentAttached() {}
|
|
|
|
+ virtual void DevToolsAgentDetached() {}
|
2017-12-07 22:44:24 +01:00
|
|
|
+
|
|
|
|
// Allows subclasses to enable some runtime features before Blink has
|
|
|
|
// started.
|
|
|
|
virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {}
|
2017-05-31 17:33:30 +02:00
|
|
|
diff --git content/renderer/render_thread_impl.cc content/renderer/render_thread_impl.cc
|
2022-03-26 02:12:30 +01:00
|
|
|
index 707a469b90696..095e396218812 100644
|
2017-05-31 17:33:30 +02:00
|
|
|
--- content/renderer/render_thread_impl.cc
|
|
|
|
+++ content/renderer/render_thread_impl.cc
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -658,6 +658,8 @@ void RenderThreadImpl::Init() {
|
2020-02-10 18:10:17 +01:00
|
|
|
GetContentClient()->renderer()->CreateURLLoaderThrottleProvider(
|
2021-04-21 00:52:34 +02:00
|
|
|
blink::URLLoaderThrottleProviderType::kFrame);
|
2017-05-31 17:33:30 +02:00
|
|
|
|
|
|
|
+ GetContentClient()->renderer()->RenderThreadConnected();
|
|
|
|
+
|
2019-07-16 19:59:21 +02:00
|
|
|
GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating(
|
2020-12-02 23:31:49 +01:00
|
|
|
&RenderThreadImpl::OnRendererInterfaceReceiver, base::Unretained(this)));
|
|
|
|
|
2017-01-19 00:37:56 +01:00
|
|
|
diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc
|
2022-03-26 02:12:30 +01:00
|
|
|
index 3d551f3d74e22..b2495b1d26391 100644
|
2017-01-19 00:37:56 +01:00
|
|
|
--- content/renderer/renderer_blink_platform_impl.cc
|
|
|
|
+++ content/renderer/renderer_blink_platform_impl.cc
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -1113,6 +1113,15 @@ SkBitmap* RendererBlinkPlatformImpl::GetSadPageBitmap() {
|
2019-03-13 22:27:37 +01:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2018-02-15 01:12:09 +01:00
|
|
|
|
|
|
|
+void RendererBlinkPlatformImpl::DevToolsAgentAttached() {
|
|
|
|
+ GetContentClient()->renderer()->DevToolsAgentAttached();
|
|
|
|
+}
|
|
|
|
+void RendererBlinkPlatformImpl::DevToolsAgentDetached() {
|
|
|
|
+ GetContentClient()->renderer()->DevToolsAgentDetached();
|
|
|
|
+}
|
|
|
|
+
|
2019-09-04 17:13:32 +02:00
|
|
|
+//------------------------------------------------------------------------------
|
|
|
|
+
|
2021-10-19 00:17:16 +02:00
|
|
|
mojo::SharedRemote<blink::mojom::CodeCacheHost>
|
|
|
|
RendererBlinkPlatformImpl::GetCodeCacheHost() {
|
|
|
|
base::AutoLock lock(code_cache_host_lock_);
|
2017-01-19 00:37:56 +01:00
|
|
|
diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h
|
2022-03-26 02:12:30 +01:00
|
|
|
index 7255ac218c8fd..858a6d83e315e 100644
|
2017-01-19 00:37:56 +01:00
|
|
|
--- content/renderer/renderer_blink_platform_impl.h
|
|
|
|
+++ content/renderer/renderer_blink_platform_impl.h
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -262,6 +262,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
2021-07-23 18:40:13 +02:00
|
|
|
blink::WebVector<blink::WebContentSecurityPolicyHeader>* csp) override;
|
2021-12-16 23:35:54 +01:00
|
|
|
base::PlatformThreadId GetIOThreadId() const override;
|
2018-02-15 01:12:09 +01:00
|
|
|
|
|
|
|
+ void DevToolsAgentAttached() override;
|
|
|
|
+ void DevToolsAgentDetached() override;
|
|
|
|
+
|
2020-08-29 00:39:23 +02:00
|
|
|
// Tells this platform that the renderer is locked to a site (i.e., a scheme
|
|
|
|
// plus eTLD+1, such as https://google.com), or to a more specific origin.
|
|
|
|
void SetIsLockedToSite();
|