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

Unified Diff: components/data_use_measurement/core/data_use_user_data.cc

Issue 1279543002: Support needed to measure user and service traffic in Chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NewHistogram
Patch Set: Addressed comments and rebased. 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/data_use_measurement/core/data_use_user_data.h ('k') | components/suggestions.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/data_use_measurement/core/data_use_user_data.cc
diff --git a/components/data_use_measurement/core/data_use_user_data.cc b/components/data_use_measurement/core/data_use_user_data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d5870b580610caf59eb2d93a766d966d64339305
--- /dev/null
+++ b/components/data_use_measurement/core/data_use_user_data.cc
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/data_use_measurement/core/data_use_user_data.h"
+
+#include "net/url_request/url_fetcher.h"
+
+namespace data_use_measurement {
+
+DataUseUserData::DataUseUserData(ServiceName service_name)
+ : service_name_(service_name) {}
+
+DataUseUserData::~DataUseUserData() {}
+
+// static
+const void* DataUseUserData::kUserDataKey =
+ static_cast<const void*>(&DataUseUserData::kUserDataKey);
+
+// static
+base::SupportsUserData::Data* DataUseUserData::Create(
+ ServiceName service_name) {
+ return new DataUseUserData(service_name);
+}
+
+// static
+std::string DataUseUserData::GetServiceNameAsString(ServiceName service_name) {
+ switch (service_name) {
+ case SUGGESTIONS:
+ return "Suggestions";
+ case NOT_TAGGED:
+ return "NotTagged";
+ }
+ return "INVALID";
+}
+
+// static
+void DataUseUserData::AttachToFetcher(net::URLFetcher* fetcher,
+ ServiceName service_name) {
+ fetcher->SetURLRequestUserData(kUserDataKey,
+ base::Bind(&Create, service_name));
+}
+
+} // namespace data_use_measurement
« no previous file with comments | « components/data_use_measurement/core/data_use_user_data.h ('k') | components/suggestions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698