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

Unified Diff: sync/internal_api/http_bridge.cc

Issue 1330443002: Report data usage UMA for Chrome services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NewArchServices
Patch Set: Fix calling Init function in sync_client.cc Created 5 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
« no previous file with comments | « components/variations/service/variations_service.cc ('k') | sync/internal_api/http_bridge_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_);
« no previous file with comments | « components/variations/service/variations_service.cc ('k') | sync/internal_api/http_bridge_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698