|
@@ -40,6 +40,7 @@
|
|
|
#include "net/http/http_auth_handler_factory.h"
|
|
|
#include "net/http/http_auth_preferences.h"
|
|
|
#include "net/http/http_cache.h"
|
|
|
+#include "net/http/http_util.h"
|
|
|
#include "services/network/network_service.h"
|
|
|
#include "services/network/public/cpp/features.h"
|
|
|
#include "shell/browser/api/electron_api_cookies.h"
|
|
@@ -563,9 +564,16 @@ void Session::AllowNTLMCredentialsForDomains(const std::string& domains) {
|
|
|
void Session::SetUserAgent(const std::string& user_agent,
|
|
|
mate::Arguments* args) {
|
|
|
browser_context_->SetUserAgent(user_agent);
|
|
|
- content::BrowserContext::GetDefaultStoragePartition(browser_context_.get())
|
|
|
- ->GetNetworkContext()
|
|
|
- ->SetUserAgent(user_agent);
|
|
|
+ auto* network_context = content::BrowserContext::GetDefaultStoragePartition(
|
|
|
+ browser_context_.get())
|
|
|
+ ->GetNetworkContext();
|
|
|
+ network_context->SetUserAgent(user_agent);
|
|
|
+
|
|
|
+ std::string accept_lang;
|
|
|
+ if (args->GetNext(&accept_lang)) {
|
|
|
+ network_context->SetAcceptLanguage(
|
|
|
+ net::HttpUtil::GenerateAcceptLanguageHeader(accept_lang));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
std::string Session::GetUserAgent() {
|