summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-08-17 16:39:17 +0100
committerKristian Monsen <kristianm@google.com>2010-08-18 12:55:55 +0100
commit1166dab4e90689c7d1202e95c9cbdf761908e67f (patch)
tree7df78a2e0977e103fbba42e916f588bbd1a4e9c9
parent754f8e53eaed9e63225b665b8406c3d1072b7905 (diff)
downloadexternal_chromium-1166dab4e90689c7d1202e95c9cbdf761908e67f.zip
external_chromium-1166dab4e90689c7d1202e95c9cbdf761908e67f.tar.gz
external_chromium-1166dab4e90689c7d1202e95c9cbdf761908e67f.tar.bz2
Changing accept_language to virtual GetAcceptLanguage() for Android
This means we can make a subclass and control how it is used, making it thread safe. This change is needed for the following cl in external/webkit: https://android-git.corp.google.com/g/#change,61444 Change-Id: I14b9da50eee61e95691ab7abd1a291ecab45d7a3
-rw-r--r--net/url_request/url_request_context.h5
-rw-r--r--net/url_request/url_request_http_job.cc4
2 files changed, 9 insertions, 0 deletions
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index 0f7fd51..2d2d646 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -97,8 +97,13 @@ class URLRequestContext
// Gets the value of 'Accept-Charset' header field.
const std::string& accept_charset() const { return accept_charset_; }
+#ifdef ANDROID
+ // Gets the value of 'Accept-Language' header field.
+ virtual const std::string& GetAcceptLanguage() const { return accept_language_; }
+#else
// Gets the value of 'Accept-Language' header field.
const std::string& accept_language() const { return accept_language_; }
+#endif
// Gets the UA string to use for the given URL. Pass an invalid URL (such as
// GURL()) to get the default UA string. Subclasses should override this
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 9a03213..6b938fa 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -704,7 +704,11 @@ void URLRequestHttpJob::AddExtraHeaders() {
net::HttpRequestHeaders::kAcceptLanguage)) {
request_info_.extra_headers.SetHeader(
net::HttpRequestHeaders::kAcceptLanguage,
+#ifdef ANDROID
+ context->GetAcceptLanguage());
+#else
context->accept_language());
+#endif
}
if (!request_info_.extra_headers.HasHeader(
net::HttpRequestHeaders::kAcceptCharset)) {