#include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request_context.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
+#include "ui/base/l10n/l10n_util.h"
#include "atom/common/node_includes.h"
};
void SetUserAgentInIO(scoped_refptr<net::URLRequestContextGetter> getter,
+ std::string accept_lang,
std::string user_agent) {
getter->GetURLRequestContext()->set_http_user_agent_settings(
- new net::StaticHttpUserAgentSettings("en-us,en", user_agent));
+ new net::StaticHttpUserAgentSettings(
+ net::HttpUtil::GenerateAcceptLanguageHeader(accept_lang),
+ user_agent));
}
bool NotifyZoomLevelChanged(
web_contents()->SetUserAgentOverride(user_agent);
scoped_refptr<net::URLRequestContextGetter> getter =
web_contents()->GetBrowserContext()->GetRequestContext();
+
+ auto accept_lang = l10n_util::GetApplicationLocale("");
getter->GetNetworkTaskRunner()->PostTask(FROM_HERE,
- base::Bind(&SetUserAgentInIO, getter, user_agent));
+ base::Bind(&SetUserAgentInIO, getter, accept_lang, user_agent));
}
std::string WebContents::GetUserAgent() {