Index: sync/internal_api/http_bridge.cc |
diff --git a/sync/internal_api/http_bridge.cc b/sync/internal_api/http_bridge.cc |
index 04e339ce6a5ad2e81318203e7b5ece435ebe4735..6da0dd31e8538eac57c68e9f9202afe09ca9015b 100644 |
--- a/sync/internal_api/http_bridge.cc |
+++ b/sync/internal_api/http_bridge.cc |
@@ -161,8 +161,11 @@ HttpBridgeFactory::~HttpBridgeFactory() { |
cancelation_signal_->UnregisterHandler(this); |
} |
-void HttpBridgeFactory::Init(const std::string& user_agent) { |
+void HttpBridgeFactory::Init( |
+ const std::string& user_agent, |
+ const BindToTrackerCallback& bind_to_tracker_callback) { |
user_agent_ = user_agent; |
+ bind_to_tracker_callback_ = bind_to_tracker_callback; |
} |
HttpPostProviderInterface* HttpBridgeFactory::Create() { |
@@ -174,8 +177,9 @@ HttpPostProviderInterface* HttpBridgeFactory::Create() { |
// we've been asked to shut down. |
CHECK(request_context_getter_.get()); |
- scoped_refptr<HttpBridge> http = new HttpBridge( |
- user_agent_, request_context_getter_, network_time_update_callback_); |
+ scoped_refptr<HttpBridge> http = |
+ new HttpBridge(user_agent_, request_context_getter_, |
+ network_time_update_callback_, bind_to_tracker_callback_); |
http->AddRef(); |
return http.get(); |
} |
@@ -204,14 +208,15 @@ HttpBridge::URLFetchState::~URLFetchState() {} |
HttpBridge::HttpBridge( |
const std::string& user_agent, |
const scoped_refptr<net::URLRequestContextGetter>& context_getter, |
- const NetworkTimeUpdateCallback& network_time_update_callback) |
+ const NetworkTimeUpdateCallback& network_time_update_callback, |
+ const BindToTrackerCallback& bind_to_tracker_callback) |
: created_on_loop_(base::MessageLoop::current()), |
user_agent_(user_agent), |
http_post_completed_(false, false), |
request_context_getter_(context_getter), |
network_task_runner_(request_context_getter_->GetNetworkTaskRunner()), |
- network_time_update_callback_(network_time_update_callback) { |
-} |
+ network_time_update_callback_(network_time_update_callback), |
+ bind_to_tracker_callback_(bind_to_tracker_callback) {} |
HttpBridge::~HttpBridge() { |
} |
@@ -313,6 +318,8 @@ void HttpBridge::MakeAsynchronousPost() { |
fetch_state_.url_poster = |
net::URLFetcher::Create(url_for_request_, net::URLFetcher::POST, this) |
.release(); |
+ if (!bind_to_tracker_callback_.is_null()) |
+ bind_to_tracker_callback_.Run(fetch_state_.url_poster); |
fetch_state_.url_poster->SetRequestContext(request_context_getter_.get()); |
fetch_state_.url_poster->SetExtraRequestHeaders(extra_headers_); |