254 lines
12 KiB
Diff
254 lines
12 KiB
Diff
diff --git content/browser/devtools/devtools_http_handler.cc content/browser/devtools/devtools_http_handler.cc
|
|
index b7430b7d7027f..721144dde86d8 100644
|
|
--- content/browser/devtools/devtools_http_handler.cc
|
|
+++ content/browser/devtools/devtools_http_handler.cc
|
|
@@ -589,7 +589,7 @@ void DevToolsHttpHandler::OnJsonRequest(
|
|
base::Value::Dict version;
|
|
version.Set("Protocol-Version", DevToolsAgentHost::GetProtocolVersion());
|
|
version.Set("WebKit-Version", GetWebKitVersion());
|
|
- version.Set("Browser", GetContentClient()->browser()->GetProduct());
|
|
+ version.Set("Browser", GetContentClient()->browser()->GetChromeProduct());
|
|
version.Set("User-Agent", GetContentClient()->browser()->GetUserAgent());
|
|
version.Set("V8-Version", V8_VERSION_STRING);
|
|
std::string host = info.GetHeaderValue("host");
|
|
diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc
|
|
index 5da07b9eff248..72fc63ba456c5 100644
|
|
--- content/browser/loader/navigation_url_loader_impl.cc
|
|
+++ content/browser/loader/navigation_url_loader_impl.cc
|
|
@@ -751,6 +751,22 @@ NavigationURLLoaderImpl::PrepareForNonInterceptedRequest() {
|
|
: nullptr,
|
|
&loader_factory);
|
|
|
|
+ if (!handled) {
|
|
+ handled = GetContentClient()->browser()->HandleExternalProtocol(
|
|
+ web_contents_getter_, frame_tree_node_id_,
|
|
+ navigation_ui_data_.get(), request_info_->is_primary_main_frame,
|
|
+ FrameTreeNode::GloballyFindByID(frame_tree_node_id_)
|
|
+ ->IsInFencedFrameTree(),
|
|
+ request_info_->sandbox_flags,
|
|
+ *resource_request_, initiating_origin,
|
|
+ request_info_->initiator_document_token
|
|
+ ? RenderFrameHostImpl::FromDocumentToken(
|
|
+ request_info_->initiator_process_id,
|
|
+ *request_info_->initiator_document_token)
|
|
+ : nullptr,
|
|
+ &loader_factory);
|
|
+ }
|
|
+
|
|
if (loader_factory) {
|
|
factory = base::MakeRefCounted<network::WrapperSharedURLLoaderFactory>(
|
|
std::move(loader_factory));
|
|
diff --git content/public/browser/content_browser_client.cc content/public/browser/content_browser_client.cc
|
|
index d004abc6fe3da..3aeb9ab07d2a6 100644
|
|
--- content/public/browser/content_browser_client.cc
|
|
+++ content/public/browser/content_browser_client.cc
|
|
@@ -1070,7 +1070,7 @@ ContentBrowserClient::CreateURLLoaderHandlerForServiceWorkerNavigationPreload(
|
|
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,
|
|
@@ -1079,6 +1079,7 @@ void ContentBrowserClient::ConfigureNetworkContextParams(
|
|
cert_verifier_creation_params) {
|
|
network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
|
|
network_context_params->accept_language = "en-us,en";
|
|
+ return true;
|
|
}
|
|
|
|
std::vector<base::FilePath>
|
|
diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h
|
|
index d0a5dbc454670..0814479cf64e1 100644
|
|
--- content/public/browser/content_browser_client.h
|
|
+++ content/public/browser/content_browser_client.h
|
|
@@ -43,6 +43,7 @@
|
|
#include "content/public/browser/mojo_binder_policy_map.h"
|
|
#include "content/public/browser/privacy_sandbox_invoking_api.h"
|
|
#include "content/public/browser/storage_partition_config.h"
|
|
+#include "content/public/browser/web_contents.h"
|
|
#include "content/public/common/alternative_error_page_override_info.mojom-forward.h"
|
|
#include "content/public/common/page_visibility_state.h"
|
|
#include "content/public/common/window_container_type.mojom-forward.h"
|
|
@@ -1989,7 +1990,7 @@ class CONTENT_EXPORT ContentBrowserClient {
|
|
//
|
|
// 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,
|
|
@@ -2210,6 +2211,19 @@ class CONTENT_EXPORT ContentBrowserClient {
|
|
RenderFrameHost* initiator_document,
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory);
|
|
|
|
+ // Same as above, but exposing the whole ResourceRequest object.
|
|
+ virtual bool HandleExternalProtocol(
|
|
+ WebContents::Getter web_contents_getter,
|
|
+ int frame_tree_node_id,
|
|
+ NavigationUIData* navigation_data,
|
|
+ bool is_primary_main_frame,
|
|
+ bool is_in_fenced_frame_tree,
|
|
+ network::mojom::WebSandboxFlags sandbox_flags,
|
|
+ const network::ResourceRequest& request,
|
|
+ const absl::optional<url::Origin>& initiating_origin,
|
|
+ RenderFrameHost* initiator_document,
|
|
+ mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { return false; }
|
|
+
|
|
// Creates an OverlayWindow to be used for video or Picture-in-Picture.
|
|
// This window will house the content shown when in Picture-in-Picture mode.
|
|
// This will return a new OverlayWindow.
|
|
@@ -2267,6 +2281,10 @@ class CONTENT_EXPORT ContentBrowserClient {
|
|
// Used as part of the user agent string.
|
|
virtual std::string GetProduct();
|
|
|
|
+ // Returns the Chrome-specific product string. This is used for compatibility
|
|
+ // purposes with external tools like Selenium.
|
|
+ virtual std::string GetChromeProduct() { return GetProduct(); }
|
|
+
|
|
// Returns the user agent. This can also return the reduced user agent, based
|
|
// on blink::features::kUserAgentReduction. Content may cache this value.
|
|
virtual std::string GetUserAgent();
|
|
diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h
|
|
index ff20508d76a60..03a83b28fd678 100644
|
|
--- content/public/renderer/content_renderer_client.h
|
|
+++ content/public/renderer/content_renderer_client.h
|
|
@@ -101,6 +101,9 @@ class CONTENT_EXPORT ContentRendererClient {
|
|
// binding requests from RenderProcessHost::BindReceiver().
|
|
virtual void ExposeInterfacesToBrowser(mojo::BinderMap* binders) {}
|
|
|
|
+ // 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) {}
|
|
|
|
@@ -324,6 +327,10 @@ class CONTENT_EXPORT ContentRendererClient {
|
|
// This method may invalidate the frame.
|
|
virtual void RunScriptsAtDocumentIdle(RenderFrame* render_frame) {}
|
|
|
|
+ // Notifies that a DevTools agent has attached or detached.
|
|
+ virtual void DevToolsAgentAttached() {}
|
|
+ virtual void DevToolsAgentDetached() {}
|
|
+
|
|
// Allows subclasses to enable some runtime features before Blink has
|
|
// started.
|
|
virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {}
|
|
diff --git content/renderer/render_thread_impl.cc content/renderer/render_thread_impl.cc
|
|
index b67ee7e79eea7..13ac29a392b6e 100644
|
|
--- content/renderer/render_thread_impl.cc
|
|
+++ content/renderer/render_thread_impl.cc
|
|
@@ -545,6 +545,8 @@ void RenderThreadImpl::Init() {
|
|
GetContentClient()->renderer()->CreateURLLoaderThrottleProvider(
|
|
blink::URLLoaderThrottleProviderType::kFrame);
|
|
|
|
+ GetContentClient()->renderer()->RenderThreadConnected();
|
|
+
|
|
GetAssociatedInterfaceRegistry()->AddInterface<mojom::Renderer>(
|
|
base::BindRepeating(&RenderThreadImpl::OnRendererInterfaceReceiver,
|
|
base::Unretained(this)));
|
|
diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc
|
|
index 619323f485c6a..324017a67e989 100644
|
|
--- content/renderer/renderer_blink_platform_impl.cc
|
|
+++ content/renderer/renderer_blink_platform_impl.cc
|
|
@@ -994,6 +994,15 @@ SkBitmap* RendererBlinkPlatformImpl::GetSadPageBitmap() {
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
+void RendererBlinkPlatformImpl::DevToolsAgentAttached() {
|
|
+ GetContentClient()->renderer()->DevToolsAgentAttached();
|
|
+}
|
|
+void RendererBlinkPlatformImpl::DevToolsAgentDetached() {
|
|
+ GetContentClient()->renderer()->DevToolsAgentDetached();
|
|
+}
|
|
+
|
|
+//------------------------------------------------------------------------------
|
|
+
|
|
std::unique_ptr<blink::WebV8ValueConverter>
|
|
RendererBlinkPlatformImpl::CreateWebV8ValueConverter() {
|
|
return std::make_unique<V8ValueConverterImpl>();
|
|
diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h
|
|
index ecbcf12493f77..2c529b2f07a14 100644
|
|
--- content/renderer/renderer_blink_platform_impl.h
|
|
+++ content/renderer/renderer_blink_platform_impl.h
|
|
@@ -236,6 +236,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
|
InertAndMinimumIntervalOfUserLevelMemoryPressureSignal() override;
|
|
#endif // BUILDFLAG(IS_ANDROID)
|
|
|
|
+ void DevToolsAgentAttached() override;
|
|
+ void DevToolsAgentDetached() override;
|
|
+
|
|
// 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();
|
|
diff --git content/shell/browser/shell_content_browser_client.cc content/shell/browser/shell_content_browser_client.cc
|
|
index 3e0b86f6834c5..624610b39a399 100644
|
|
--- content/shell/browser/shell_content_browser_client.cc
|
|
+++ content/shell/browser/shell_content_browser_client.cc
|
|
@@ -703,7 +703,7 @@ void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
|
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
|
|
// BUILDFLAG(IS_ANDROID)
|
|
|
|
-void ShellContentBrowserClient::ConfigureNetworkContextParams(
|
|
+bool ShellContentBrowserClient::ConfigureNetworkContextParams(
|
|
BrowserContext* context,
|
|
bool in_memory,
|
|
const base::FilePath& relative_partition_path,
|
|
@@ -712,6 +712,7 @@ void ShellContentBrowserClient::ConfigureNetworkContextParams(
|
|
cert_verifier_creation_params) {
|
|
ConfigureNetworkContextParamsForShell(context, network_context_params,
|
|
cert_verifier_creation_params);
|
|
+ return true;
|
|
}
|
|
|
|
std::vector<base::FilePath>
|
|
diff --git content/shell/browser/shell_content_browser_client.h content/shell/browser/shell_content_browser_client.h
|
|
index 83253e9feb3eb..ca0fd605ee613 100644
|
|
--- content/shell/browser/shell_content_browser_client.h
|
|
+++ content/shell/browser/shell_content_browser_client.h
|
|
@@ -140,7 +140,7 @@ class ShellContentBrowserClient : public ContentBrowserClient {
|
|
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
|
|
// BUILDFLAG(IS_ANDROID)
|
|
device::GeolocationManager* GetGeolocationManager() override;
|
|
- void ConfigureNetworkContextParams(
|
|
+ bool ConfigureNetworkContextParams(
|
|
BrowserContext* context,
|
|
bool in_memory,
|
|
const base::FilePath& relative_partition_path,
|
|
diff --git headless/lib/browser/headless_content_browser_client.cc headless/lib/browser/headless_content_browser_client.cc
|
|
index 6a118e43698a1..82df4466206d2 100644
|
|
--- headless/lib/browser/headless_content_browser_client.cc
|
|
+++ headless/lib/browser/headless_content_browser_client.cc
|
|
@@ -297,7 +297,7 @@ bool HeadlessContentBrowserClient::IsSharedStorageSelectURLAllowed(
|
|
return true;
|
|
}
|
|
|
|
-void HeadlessContentBrowserClient::ConfigureNetworkContextParams(
|
|
+bool HeadlessContentBrowserClient::ConfigureNetworkContextParams(
|
|
content::BrowserContext* context,
|
|
bool in_memory,
|
|
const base::FilePath& relative_partition_path,
|
|
@@ -307,6 +307,7 @@ void HeadlessContentBrowserClient::ConfigureNetworkContextParams(
|
|
HeadlessBrowserContextImpl::From(context)->ConfigureNetworkContextParams(
|
|
in_memory, relative_partition_path, network_context_params,
|
|
cert_verifier_creation_params);
|
|
+ return true;
|
|
}
|
|
|
|
std::string HeadlessContentBrowserClient::GetProduct() {
|
|
diff --git headless/lib/browser/headless_content_browser_client.h headless/lib/browser/headless_content_browser_client.h
|
|
index 18f90a11713b5..688549524fb17 100644
|
|
--- headless/lib/browser/headless_content_browser_client.h
|
|
+++ headless/lib/browser/headless_content_browser_client.h
|
|
@@ -80,7 +80,7 @@ class HeadlessContentBrowserClient : public content::ContentBrowserClient {
|
|
const url::Origin& top_frame_origin,
|
|
const url::Origin& accessing_origin) override;
|
|
|
|
- void ConfigureNetworkContextParams(
|
|
+ bool ConfigureNetworkContextParams(
|
|
content::BrowserContext* context,
|
|
bool in_memory,
|
|
const base::FilePath& relative_partition_path,
|