From dc5c49ea7f8f1d9c4538a41979cedb59c85a517b Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Sun, 22 Jul 2018 02:51:28 +1000 Subject: [PATCH] SetUserAgentOverride now takes a 2nd override_for_new_tabs argument refs: https://chromium-review.googlesource.com/c/chromium/src/+/846713 --- atom/browser/api/atom_api_web_contents.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 3057b80a131d..0728e5ba9c60 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -315,7 +315,8 @@ WebContents::WebContents(v8::Isolate* isolate, : content::WebContentsObserver(web_contents), type_(type) { const mate::Dictionary options = mate::Dictionary::CreateEmpty(isolate); if (type == REMOTE) { - web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent()); + web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent(), + false); Init(isolate); AttachAsUserData(web_contents); InitZoomController(web_contents, options); @@ -456,7 +457,8 @@ void WebContents::InitWithSessionAndOptions(v8::Isolate* isolate, // Initialize zoom controller. InitZoomController(web_contents, options); - web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent()); + web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent(), + false); if (IsGuest()) { NativeWindow* owner_window = nullptr; @@ -1126,7 +1128,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) { std::string user_agent; if (options.Get("userAgent", &user_agent)) - web_contents()->SetUserAgentOverride(user_agent); + web_contents()->SetUserAgentOverride(user_agent, false); std::string extra_headers; if (options.Get("extraHeaders", &extra_headers)) @@ -1236,7 +1238,7 @@ bool WebContents::IsCrashed() const { void WebContents::SetUserAgent(const std::string& user_agent, mate::Arguments* args) { - web_contents()->SetUserAgentOverride(user_agent); + web_contents()->SetUserAgentOverride(user_agent, false); } std::string WebContents::GetUserAgent() {