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

Unified Diff: sync/internal_api/http_bridge.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: sync/internal_api/http_bridge.cc
diff --git a/sync/internal_api/http_bridge.cc b/sync/internal_api/http_bridge.cc
index 96e1a588872a3de2accd17fe11f54b5d0d4e7729..ed99188bd73cdd1869dd32e851a5d7e4a4a17fd9 100644
--- a/sync/internal_api/http_bridge.cc
+++ b/sync/internal_api/http_bridge.cc
@@ -15,6 +15,7 @@
#include "net/http/http_network_layer.h"
#include "net/http/http_response_headers.h"
#include "net/proxy/proxy_service.h"
+#include "net/url_request/const_http_user_agent_settings.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_status.h"
@@ -81,9 +82,8 @@ HttpBridge::RequestContext::RequestContext(
network_task_runner,
const std::string& user_agent)
: baseline_context_(baseline_context),
- network_task_runner_(network_task_runner),
- user_agent_(user_agent) {
- DCHECK(!user_agent_.empty());
+ network_task_runner_(network_task_runner) {
+ DCHECK(!user_agent.empty());
// Create empty, in-memory cookie store.
set_cookie_store(new net::CookieMonster(NULL, NULL));
@@ -109,8 +109,10 @@ HttpBridge::RequestContext::RequestContext(
// should be tied to whatever the sync servers expect (if anything). These
// fields should probably just be settable by sync backend; though we should
// figure out if we need to give the user explicit control over policies etc.
- set_accept_language(baseline_context->accept_language());
- set_accept_charset(baseline_context->accept_charset());
+ const_http_user_agent_settings_.reset(new net::ConstHttpUserAgentSettings(
+ baseline_context->accept_language(), baseline_context->accept_charset(),
+ user_agent));
+ set_http_user_agent_settings(const_http_user_agent_settings_.get());
set_net_log(baseline_context->net_log());
}
@@ -120,11 +122,6 @@ HttpBridge::RequestContext::~RequestContext() {
delete http_transaction_factory();
}
-const std::string& HttpBridge::RequestContext::GetUserAgent(
- const GURL& url) const {
- return user_agent_;
-}
-
HttpBridge::URLFetchState::URLFetchState() : url_poster(NULL),
aborted(false),
request_completed(false),

Powered by Google App Engine
This is Rietveld 408576698