59dd17f2cf
* chore: bump chromium in DEPS to 102.0.4975.0 * chore: bump chromium in DEPS to 102.0.4977.0 * chore: update patches * Remove parameter of OnGpuProcessCrashed() https://chromium-review.googlesource.com/c/chromium/src/+/3543396 * hid: Add exclusionFilters option to requestDevice https://chromium-review.googlesource.com/c/chromium/src/+/3478175 * chore: bump chromium in DEPS to 102.0.4979.0 * chore: bump chromium in DEPS to 102.0.4981.0 * chore: update patches * Deny notification/push permission for documents in non-standard StoragePartitions https://chromium-review.googlesource.com/c/chromium/src/+/3257305 * Improve FrameTreeNode tracking in URLLoaderNetworkContext https://chromium-review.googlesource.com/c/chromium/src/+/3341866 * fixup! Remove parameter of OnGpuProcessCrashed() * chore: fix lint * Reland "Use gfx::Insets[F]::TLBR() and gfx::Insets[F]::VH() in the rest of Chrome" https://chromium-review.googlesource.com/c/chromium/src/+/3554236 * chore: bump chromium in DEPS to 102.0.4983.0 * Ensure EyeDropperView does not access a destroyed window https://chromium-review.googlesource.com/c/chromium/src/+/3561542 * ci: don't delete dawn .git directory 83901: Adds a generated file with the dawn git hash encoded at build time. | https://dawn-review.googlesource.com/c/dawn/+/83901 * ci: update Windows toolchain 3550827: New toolchain for Windows 10 20348 SDK | https://chromium-review.googlesource.com/c/chromium/src/+/3550827 * chore: bump chromium in DEPS to 102.0.4985.0 * chore: update patches * chore: bump chromium in DEPS to 102.0.4987.0 * chore: update patches * 3563432: codehealth: remove uses of DictionaryValue in cbui/webui https://chromium-review.googlesource.com/c/chromium/src/+/3563432 * chore: update patches after rebase * Use gfx::Insets[F]::TLBR() and gfx::Insets[F]::VH() in the rest of Chrome https://chromium-review.googlesource.com/c/chromium/src/+/3554236 * 3565724: Preserve "proper method names" as-is in error.stack. https://chromium-review.googlesource.com/c/v8/v8/+/3565724 * chore: bump chromium in DEPS to 102.0.4989.0 * chore: update patches * fixup ci: don't delete dawn .git directory for Windows * 3560843: Remove multi-parameter version of gfx::Rect[F]::Inset() https://chromium-review.googlesource.com/c/chromium/src/+/3560843 * 3572711: Remove unused IDS_PDF_TOOLTIP_ROTATE_CW resource. https://chromium-review.googlesource.com/c/chromium/src/+/3572711 * 3572926: Reland "[Sysroot] Switch to Debian Bullseye stable" https://chromium-review.googlesource.com/c/chromium/src/+/3572926 * build: fixup sysroots with electron specific dependencies * fixup Remove multi-parameter version of gfx::Rect[F]::Inset() * fixup 3565724: Preserve "proper method names" as-is in error.stack. * fixup Remove multi-parameter version of gfx::Rect[F]::Inset() * test: add spec for navigator.hid.requestDevice({ exclusionFilters: [...] } * fixup 3565724: Preserve "proper method names" as-is in error.stack. * ci: use python3 to get the windows toolchain profile 3525960: Explicitly run everything with python3 | https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3525960 * chore: add diagnostic logging * fix: try calling process.crash() * chore: remove logging Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
90 lines
4.5 KiB
Diff
90 lines
4.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jeremy Apthorp <nornagon@nornagon.net>
|
|
Date: Wed, 28 Aug 2019 12:21:25 -0700
|
|
Subject: expose SetUserAgent on NetworkContext
|
|
|
|
Applying
|
|
https://chromium-review.googlesource.com/c/chromium/src/+/1585083 before
|
|
it's merged. There may end up being a better way of doing this, or the
|
|
patch may be merged upstream, at which point this patch should be
|
|
removed.
|
|
|
|
diff --git a/net/url_request/static_http_user_agent_settings.h b/net/url_request/static_http_user_agent_settings.h
|
|
index 14c71cc69388da46f62d9835e2a06fef0870da02..9481ea08401ae29ae9c1d960491b05b364257cc8 100644
|
|
--- a/net/url_request/static_http_user_agent_settings.h
|
|
+++ b/net/url_request/static_http_user_agent_settings.h
|
|
@@ -30,13 +30,17 @@ class NET_EXPORT StaticHttpUserAgentSettings : public HttpUserAgentSettings {
|
|
accept_language_ = new_accept_language;
|
|
}
|
|
|
|
+ void set_user_agent(const std::string& new_user_agent) {
|
|
+ user_agent_ = new_user_agent;
|
|
+ }
|
|
+
|
|
// HttpUserAgentSettings implementation
|
|
std::string GetAcceptLanguage() const override;
|
|
std::string GetUserAgent() const override;
|
|
|
|
private:
|
|
std::string accept_language_;
|
|
- const std::string user_agent_;
|
|
+ std::string user_agent_;
|
|
};
|
|
|
|
} // namespace net
|
|
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
|
|
index 98268925da14d61256f8dee3aa899f17ce7acaf6..1abdc204e278383818dc073f96c90e91ec1f3fb9 100644
|
|
--- a/services/network/network_context.cc
|
|
+++ b/services/network/network_context.cc
|
|
@@ -1404,6 +1404,13 @@ void NetworkContext::SetNetworkConditions(
|
|
std::move(network_conditions));
|
|
}
|
|
|
|
+void NetworkContext::SetUserAgent(const std::string& new_user_agent) {
|
|
+ // This may only be called on NetworkContexts created with a constructor that
|
|
+ // calls ApplyContextParamsToBuilder.
|
|
+ DCHECK(user_agent_settings_);
|
|
+ user_agent_settings_->set_user_agent(new_user_agent);
|
|
+}
|
|
+
|
|
void NetworkContext::SetAcceptLanguage(const std::string& new_accept_language) {
|
|
// This may only be called on NetworkContexts created with the constructor
|
|
// that calls MakeURLRequestContext().
|
|
diff --git a/services/network/network_context.h b/services/network/network_context.h
|
|
index 58671094857cdfe5d853c8a284d51bc1b8a09660..7af71839aa1bc970370a91cd35f3cbefe06e67e5 100644
|
|
--- a/services/network/network_context.h
|
|
+++ b/services/network/network_context.h
|
|
@@ -302,6 +302,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
|
|
void CloseIdleConnections(CloseIdleConnectionsCallback callback) override;
|
|
void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id,
|
|
mojom::NetworkConditionsPtr conditions) override;
|
|
+ void SetUserAgent(const std::string& new_user_agent) override;
|
|
void SetAcceptLanguage(const std::string& new_accept_language) override;
|
|
void SetEnableReferrers(bool enable_referrers) override;
|
|
#if BUILDFLAG(IS_CHROMEOS)
|
|
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
|
|
index b52e5a2230e96d55d7886bde331a505c58dd093a..757dd77b06cba44e832e86e729e44b1e9a427c49 100644
|
|
--- a/services/network/public/mojom/network_context.mojom
|
|
+++ b/services/network/public/mojom/network_context.mojom
|
|
@@ -1087,6 +1087,9 @@ interface NetworkContext {
|
|
SetNetworkConditions(mojo_base.mojom.UnguessableToken throttling_profile_id,
|
|
NetworkConditions? conditions);
|
|
|
|
+ // Updates the user agent to be used for requests.
|
|
+ SetUserAgent(string new_user_agent);
|
|
+
|
|
// Updates the Accept-Language header to be used for requests.
|
|
SetAcceptLanguage(string new_accept_language);
|
|
|
|
diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h
|
|
index d143a82b1fd021bb03b760b91e87c7714f5395b9..3c18369ff3ab80430e21caac03373605dad64a88 100644
|
|
--- a/services/network/test/test_network_context.h
|
|
+++ b/services/network/test/test_network_context.h
|
|
@@ -136,6 +136,7 @@ class TestNetworkContext : public mojom::NetworkContext {
|
|
void CloseIdleConnections(CloseIdleConnectionsCallback callback) override {}
|
|
void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id,
|
|
mojom::NetworkConditionsPtr conditions) override {}
|
|
+ void SetUserAgent(const std::string& new_user_agent) override {}
|
|
void SetAcceptLanguage(const std::string& new_accept_language) override {}
|
|
void SetEnableReferrers(bool enable_referrers) override {}
|
|
#if BUILDFLAG(IS_CHROMEOS)
|