Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(756)

Unified Diff: net/url_request/url_request_context.cc

Issue 10918279: Provide mutable members of UrlRequestContext via pure-virtual interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address erikwright's second round of comments. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_context.cc
diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc
index b9ee75f329d5c26bdccc9d181aab656d0b9f2b07..8c06e05cc3ef4e34226b8809aa1ece085d0ac151 100644
--- a/net/url_request/url_request_context.cc
+++ b/net/url_request/url_request_context.cc
@@ -12,6 +12,7 @@
#include "net/cookies/cookie_store.h"
#include "net/ftp/ftp_transaction_factory.h"
#include "net/http/http_transaction_factory.h"
+#include "net/url_request/http_user_agent_settings.h"
#include "net/url_request/url_request.h"
namespace net {
@@ -34,6 +35,7 @@ URLRequestContext::URLRequestContext()
ftp_transaction_factory_(NULL),
job_factory_(NULL),
throttler_manager_(NULL),
+ http_user_agent_settings_(NULL),
url_requests_(new std::set<const URLRequest*>) {
}
@@ -56,8 +58,7 @@ void URLRequestContext::CopyFrom(const URLRequestContext* other) {
set_cookie_store(other->cookie_store_);
set_transport_security_state(other->transport_security_state_);
// FTPAuthCache is unique per context.
- set_accept_language(other->accept_language_);
- set_accept_charset(other->accept_charset_);
+ set_http_user_agent_settings(other->http_user_agent_settings_);
set_referrer_charset(other->referrer_charset_);
set_http_transaction_factory(other->http_transaction_factory_);
set_ftp_transaction_factory(other->ftp_transaction_factory_);
@@ -85,8 +86,19 @@ void URLRequestContext::set_cookie_store(CookieStore* cookie_store) {
cookie_store_ = cookie_store;
}
+const std::string& URLRequestContext::accept_charset() const {
+ return http_user_agent_settings_ ?
+ http_user_agent_settings_->GetAcceptCharset() : EmptyString();
+}
+
+const std::string& URLRequestContext::accept_language() const {
+ return http_user_agent_settings_ ?
+ http_user_agent_settings_->GetAcceptLanguage() : EmptyString();
+}
+
const std::string& URLRequestContext::GetUserAgent(const GURL& url) const {
- return EmptyString();
+ return http_user_agent_settings_ ?
+ http_user_agent_settings_->GetUserAgent(url) : EmptyString();
}
void URLRequestContext::AssertNoURLRequests() const {

Powered by Google App Engine
This is Rietveld 408576698