mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* chore: bump chromium in DEPS to 85.0.4182.1 * chore: bump chromium in DEPS to 85.0.4183.2 * chore: bump chromium in DEPS to 85.0.4183.4 * chore: bump chromium in DEPS to 85.0.4183.5 * update patches * chore: bump chromium in DEPS to 85.0.4183.6 * chore: bump chromium in DEPS to 85.0.4183.7 * update patches * chore: bump chromium in DEPS to 85.0.4183.8 * remove chromeos-only TtsControllerDelegate Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2255314 (cherry picked from commitf975f84a3c) * rename GetHighContrastColorScheme -> GetPlatformHighContrastColorScheme Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2250224 (cherry picked from commit014b487258) * add max_xcode_version build var Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2264867 (cherry picked from commit2c3b94f497) * add empty floc blocklist to BrowserProcessImpl Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2240873 (cherry picked from commit3cdaae146d) * Move zygote from //services/service_manager back to //content https://chromium-review.googlesource.com/c/chromium/src/+/2252466 (cherry picked from commite0d6dbcf1e) * Reland "[base] Stop including check.h, notreached.h, etc. in logging.h" https://chromium-review.googlesource.com/c/chromium/src/+/2264297 (cherry picked from commit1407040133) * Update mas private api patch * Reland "Reland "New toolchain for Windows 10 19041 SDK"" https://chromium-review.googlesource.com/c/chromium/src/+/2255527 (cherry picked from commit8101d956f5) * [XProto] Remove usage of Shape extension https://chromium-review.googlesource.com/c/chromium/src/+/2262113 (cherry picked from commit72b6f11958) * chore: bump chromium in DEPS to 85.0.4183.9 * chore: bump chromium in DEPS to 85.0.4183.10 * chore: bump chromium in DEPS to 85.0.4183.11 * chore: bump chromium in DEPS to 85.0.4183.12 * chore: bump chromium in DEPS to 85.0.4183.13 * update patches * fixup! add empty floc blocklist to BrowserProcessImpl (cherry picked from commit07b0b65c1d) * fixup! Reland "[base] Stop including check.h, notreached.h, etc. in logging.h" (cherry picked from commitf91c1ab162) * Check for GDI exhaustion if window creation fails https://chromium-review.googlesource.com/c/chromium/src/+/2244124 (cherry picked from commit3d45d7b78c) * chore: bump chromium in DEPS to 85.0.4183.14 * Fixup lint issue * update patches * fix: include missing header file * chore: bump chromium in DEPS to 85.0.4183.19 * update patches * refactor: match upstream print preview handling (#24452) (cherry picked from commit004e29ad33) * use PrintHostMsg_DidPreviewPage_Params https://chromium-review.googlesource.com/c/chromium/src/+/2257124 Co-authored-by: Andy Locascio <andy@slack-corp.com> Co-authored-by: Electron Bot <anonymous@electronjs.org> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
91 lines
4.5 KiB
Diff
91 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 0ccfe130f00ec3b6c75cd8ee04d5a2777e1fd00c..653829457d58bf92057cc36aa8a289703d8b0577 100644
|
|
--- a/net/url_request/static_http_user_agent_settings.h
|
|
+++ b/net/url_request/static_http_user_agent_settings.h
|
|
@@ -26,13 +26,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_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(StaticHttpUserAgentSettings);
|
|
};
|
|
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
|
|
index 170ba3cf6176e8423b6009a0ac0299bf1e411158..14f8cb99631232cc225026c345e95df2b548bcff 100644
|
|
--- a/services/network/network_context.cc
|
|
+++ b/services/network/network_context.cc
|
|
@@ -1035,6 +1035,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 391a02c108debdd5e5572b4a666d30dc68ece76b..0d9c4cce09db485b5e750921eed703c75ffdf15a 100644
|
|
--- a/services/network/network_context.h
|
|
+++ b/services/network/network_context.h
|
|
@@ -242,6 +242,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 defined(OS_CHROMEOS)
|
|
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
|
|
index 577c2b431ae8026b34fa1d881b0b29db478dc213..6d15b6b5ff7b36b85f6b8200b76a32b285f0e675 100644
|
|
--- a/services/network/public/mojom/network_context.mojom
|
|
+++ b/services/network/public/mojom/network_context.mojom
|
|
@@ -1050,6 +1050,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 ef97b4cef0aa4d67926cf42c8ae20e9b90e73531..65831a37e753a9255507a905f80f727f4214441e 100644
|
|
--- a/services/network/test/test_network_context.h
|
|
+++ b/services/network/test/test_network_context.h
|
|
@@ -105,6 +105,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 defined(OS_CHROMEOS)
|