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

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

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: Adding sclittle to OWNERs and little fix in ChromeNetworkDelegate test. Created 5 years, 4 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: components/data_use_measurement/core/data_use_user_data.h
diff --git a/components/data_use_measurement/core/data_use_user_data.h b/components/data_use_measurement/core/data_use_user_data.h
new file mode 100644
index 0000000000000000000000000000000000000000..c010f94c4e780f5f3c034de31024a55f92c91bc1
--- /dev/null
+++ b/components/data_use_measurement/core/data_use_user_data.h
@@ -0,0 +1,40 @@
+// 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.
+
+#ifndef COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_USER_DATA_H_
+#define COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_USER_DATA_H_
+
+#include "base/supports_user_data.h"
+
+namespace data_use_measurement {
+
+// Used to annotate URLRequests with the service name if the URLRequest is used
+// by a service.
+class DataUseUserData : public base::SupportsUserData::Data {
+ public:
+ // This enum should be synced with DataUseServices enum in histograms.xml.
+ // Please keep them synced after any updates.
+ enum ServiceType {
+ SUGGESTIONS,
+ };
+ explicit DataUseUserData(ServiceType service_type);
+ ~DataUseUserData() override;
+
+ ServiceType service_type() const { return service_type_; }
+
+ static const void* kUserDataKey;
Alexei Svitkine (slow) 2015/08/31 17:26:31 Add a comment about what this is.
amohammadkhan 2015/09/01 04:52:49 Done.
+
+ private:
+ ServiceType service_type_;
+};
Alexei Svitkine (slow) 2015/08/31 17:26:31 DISALLOW_COPY_AND_ASSIGN()
amohammadkhan 2015/09/01 04:52:49 Done.
+
+// Helper function to create DataUseUserData. The caller takes the ownership of
+// the returned object.
+base::SupportsUserData::Data* CreateDataUseUserData(
+ DataUseUserData::ServiceType service);
+
+const char* GetServiceName(DataUseUserData::ServiceType service);
+
+} // data_use_measurement namespace
+#endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_USER_DATA_H_

Powered by Google App Engine
This is Rietveld 408576698