feat: allow setting of global fallback user agent (#18016)

* feat: allow setting of global fallback user agent

* spec: add tests for app.set/getUserAgentFallback
This commit is contained in:
Samuel Attard 2019-05-01 16:34:42 -07:00 committed by GitHub
parent 649d7c0d9e
commit d4f5ebefe6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 63 additions and 5 deletions

View file

@ -1271,6 +1271,14 @@ void App::EnableSandbox(mate::Arguments* args) {
command_line->AppendSwitch(switches::kEnableSandbox);
}
void App::SetUserAgentFallback(const std::string& user_agent) {
AtomBrowserClient::Get()->SetUserAgent(user_agent);
}
std::string App::GetUserAgentFallback() {
return AtomBrowserClient::Get()->GetUserAgent();
}
#if defined(OS_MACOSX)
bool App::MoveToApplicationsFolder(mate::Arguments* args) {
return ui::cocoa::AtomBundleMover::Move(args);
@ -1450,6 +1458,8 @@ void App::BuildPrototype(v8::Isolate* isolate,
#if defined(OS_MACOSX)
.SetProperty("dock", &App::GetDockAPI)
#endif
.SetProperty("userAgentFallback", &App::GetUserAgentFallback,
&App::SetUserAgentFallback)
.SetMethod("enableSandbox", &App::EnableSandbox);
}