Commit eda739b3 authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Implement ShellContentBrowserClient::GetAcceptLangs().

ContentBrowserClient has had that method for a while, but it hasn't been
used.  I'm adding a use of it, so am implementing it in subclasses.

Bug: 841445
Change-Id: I9826cabdfdb2493d96583c1b7a2c0e2710ec07e8
Reviewed-on: https://chromium-review.googlesource.com/1151456Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579499}
parent e52c6d11
......@@ -37,6 +37,7 @@
#include "content/shell/browser/shell_login_dialog.h"
#include "content/shell/browser/shell_net_log.h"
#include "content/shell/browser/shell_quota_permission_context.h"
#include "content/shell/browser/shell_url_request_context_getter.h"
#include "content/shell/browser/shell_web_contents_view_delegate_creator.h"
#include "content/shell/common/shell_messages.h"
#include "content/shell/common/shell_switches.h"
......@@ -292,6 +293,10 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
}
}
std::string ShellContentBrowserClient::GetAcceptLangs(BrowserContext* context) {
return ShellURLRequestContextGetter::GetAcceptLanguages();
}
void ShellContentBrowserClient::ResourceDispatcherHostCreated() {
resource_dispatcher_host_delegate_.reset(
new ResourceDispatcherHostDelegate());
......
......@@ -49,6 +49,7 @@ class ShellContentBrowserClient : public ContentBrowserClient {
base::StringPiece name) override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
std::string GetAcceptLangs(BrowserContext* context) override;
void ResourceDispatcherHostCreated() override;
std::string GetDefaultDownloadName() override;
WebContentsViewDelegate* GetWebContentsViewDelegate(
......
......@@ -83,6 +83,10 @@ void ShellURLRequestContextGetter::NotifyContextShuttingDown() {
url_request_context_ = nullptr; // deletes it
}
std::string ShellURLRequestContextGetter::GetAcceptLanguages() {
return "en-us,en";
}
std::unique_ptr<net::NetworkDelegate>
ShellURLRequestContextGetter::CreateNetworkDelegate() {
return std::make_unique<ShellNetworkDelegate>();
......@@ -126,7 +130,7 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID());
builder.SetCookieAndChannelIdStores(std::move(cookie_store),
std::move(channel_id_service));
builder.set_accept_language("en-us,en");
builder.set_accept_language(GetAcceptLanguages());
builder.set_user_agent(GetShellUserAgent());
builder.SetCertVerifier(GetCertVerifier());
......
......@@ -6,6 +6,7 @@
#define CONTENT_SHELL_BROWSER_SHELL_URL_REQUEST_CONTEXT_GETTER_H_
#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
......@@ -47,6 +48,8 @@ class ShellURLRequestContextGetter : public net::URLRequestContextGetter {
void NotifyContextShuttingDown();
static std::string GetAcceptLanguages();
protected:
~ShellURLRequestContextGetter() override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment