summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorpauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-07 15:08:43 +0000
committerpauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-07 15:08:43 +0000
commitee4c30d8c5fca53a990da472de17314de366341b (patch)
treebc52b41397e143b46d0673991a13052edb1c9c66 /webkit
parent91d4f2541624923604d54fdf280483a08a393464 (diff)
downloadchromium_src-ee4c30d8c5fca53a990da472de17314de366341b.zip
chromium_src-ee4c30d8c5fca53a990da472de17314de366341b.tar.gz
chromium_src-ee4c30d8c5fca53a990da472de17314de366341b.tar.bz2
Provide mutable members of UrlRequestContext via pure-virtual interface. Create a pure-virtual interface called HttpUserAgentSettings that provides access to the Accept-Language, Accept-Charset, and User-Agent HTTP headers. Each UrlRequestContext should have a HttpUserAgentSettings implementation attached via set_http_user_agent_settings().
BUG=146596 Review URL: https://chromiumcodereview.appspot.com/10918279 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166425 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/tools/test_shell/test_shell_request_context.cc31
-rw-r--r--webkit/tools/test_shell/test_shell_request_context.h2
2 files changed, 23 insertions, 10 deletions
diff --git a/webkit/tools/test_shell/test_shell_request_context.cc b/webkit/tools/test_shell/test_shell_request_context.cc
index 0ab9839..d15ea12 100644
--- a/webkit/tools/test_shell/test_shell_request_context.cc
+++ b/webkit/tools/test_shell/test_shell_request_context.cc
@@ -23,6 +23,7 @@
#include "net/proxy/proxy_config_service.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/proxy/proxy_service.h"
+#include "net/url_request/http_user_agent_settings.h"
#include "net/url_request/url_request_job_factory_impl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h"
@@ -34,6 +35,27 @@
#include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
#include "webkit/user_agent/user_agent.h"
+class TestShellHttpUserAgentSettings : public net::HttpUserAgentSettings {
+ public:
+ TestShellHttpUserAgentSettings() {}
+ virtual ~TestShellHttpUserAgentSettings() {}
+
+ // hard-code A-L and A-C for test shells
+ virtual std::string GetAcceptLanguage() const OVERRIDE {
+ return "en-us,en";
+ }
+ virtual std::string GetAcceptCharset() const OVERRIDE {
+ return "iso-8859-1,*,utf-8";
+ }
+
+ virtual std::string GetUserAgent(const GURL& url) const OVERRIDE {
+ return webkit_glue::GetUserAgent(url);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestShellHttpUserAgentSettings);
+};
+
TestShellRequestContext::TestShellRequestContext()
: ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) {
Init(FilePath(), net::HttpCache::NORMAL, false);
@@ -56,9 +78,7 @@ void TestShellRequestContext::Init(
new net::DefaultServerBoundCertStore(NULL),
base::WorkerPool::GetTaskRunner(true)));
- // hard-code A-L and A-C for test shells
- set_accept_language("en-us,en");
- set_accept_charset("iso-8859-1,*,utf-8");
+ storage_.set_http_user_agent_settings(new TestShellHttpUserAgentSettings);
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Use no proxy to avoid ProxyConfigServiceLinux.
@@ -132,8 +152,3 @@ void TestShellRequestContext::Init(
TestShellRequestContext::~TestShellRequestContext() {
}
-
-const std::string& TestShellRequestContext::GetUserAgent(
- const GURL& url) const {
- return webkit_glue::GetUserAgent(url);
-}
diff --git a/webkit/tools/test_shell/test_shell_request_context.h b/webkit/tools/test_shell/test_shell_request_context.h
index 946248f..27ef6fe 100644
--- a/webkit/tools/test_shell/test_shell_request_context.h
+++ b/webkit/tools/test_shell/test_shell_request_context.h
@@ -34,8 +34,6 @@ class TestShellRequestContext : public net::URLRequestContext {
virtual ~TestShellRequestContext();
- virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE;
-
webkit_blob::BlobStorageController* blob_storage_controller() const {
return blob_storage_controller_.get();
}