SetUserAgentOverride now takes a 2nd override_for_new_tabs argument
refs: https://chromium-review.googlesource.com/c/chromium/src/+/846713
This commit is contained in:
parent
b381e852b1
commit
dc5c49ea7f
1 changed files with 6 additions and 4 deletions
|
@ -315,7 +315,8 @@ WebContents::WebContents(v8::Isolate* isolate,
|
||||||
: content::WebContentsObserver(web_contents), type_(type) {
|
: content::WebContentsObserver(web_contents), type_(type) {
|
||||||
const mate::Dictionary options = mate::Dictionary::CreateEmpty(isolate);
|
const mate::Dictionary options = mate::Dictionary::CreateEmpty(isolate);
|
||||||
if (type == REMOTE) {
|
if (type == REMOTE) {
|
||||||
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent());
|
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent(),
|
||||||
|
false);
|
||||||
Init(isolate);
|
Init(isolate);
|
||||||
AttachAsUserData(web_contents);
|
AttachAsUserData(web_contents);
|
||||||
InitZoomController(web_contents, options);
|
InitZoomController(web_contents, options);
|
||||||
|
@ -456,7 +457,8 @@ void WebContents::InitWithSessionAndOptions(v8::Isolate* isolate,
|
||||||
// Initialize zoom controller.
|
// Initialize zoom controller.
|
||||||
InitZoomController(web_contents, options);
|
InitZoomController(web_contents, options);
|
||||||
|
|
||||||
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent());
|
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent(),
|
||||||
|
false);
|
||||||
|
|
||||||
if (IsGuest()) {
|
if (IsGuest()) {
|
||||||
NativeWindow* owner_window = nullptr;
|
NativeWindow* owner_window = nullptr;
|
||||||
|
@ -1126,7 +1128,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
||||||
|
|
||||||
std::string user_agent;
|
std::string user_agent;
|
||||||
if (options.Get("userAgent", &user_agent))
|
if (options.Get("userAgent", &user_agent))
|
||||||
web_contents()->SetUserAgentOverride(user_agent);
|
web_contents()->SetUserAgentOverride(user_agent, false);
|
||||||
|
|
||||||
std::string extra_headers;
|
std::string extra_headers;
|
||||||
if (options.Get("extraHeaders", &extra_headers))
|
if (options.Get("extraHeaders", &extra_headers))
|
||||||
|
@ -1236,7 +1238,7 @@ bool WebContents::IsCrashed() const {
|
||||||
|
|
||||||
void WebContents::SetUserAgent(const std::string& user_agent,
|
void WebContents::SetUserAgent(const std::string& user_agent,
|
||||||
mate::Arguments* args) {
|
mate::Arguments* args) {
|
||||||
web_contents()->SetUserAgentOverride(user_agent);
|
web_contents()->SetUserAgentOverride(user_agent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string WebContents::GetUserAgent() {
|
std::string WebContents::GetUserAgent() {
|
||||||
|
|
Loading…
Reference in a new issue