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: components/data_use_measurement/core/data_use_measurement.h

Issue 2583703002: Record the tab state during data use (Closed)
Patch Set: minor fix Created 4 years 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_measurement.h
diff --git a/components/data_use_measurement/core/data_use_measurement.h b/components/data_use_measurement/core/data_use_measurement.h
index 1422ea5bd22bc45ab96f1426460635fc40112f06..ffd64f71cef36ed29172c5ac84e82fa5440878d6 100644
--- a/components/data_use_measurement/core/data_use_measurement.h
+++ b/components/data_use_measurement/core/data_use_measurement.h
@@ -29,6 +29,7 @@ class URLRequest;
namespace data_use_measurement {
+class DataUseAscriber;
class URLRequestClassifier;
// Records the data use of user traffic and various services in UMA histograms.
@@ -41,7 +42,8 @@ class DataUseMeasurement {
public:
DataUseMeasurement(
std::unique_ptr<URLRequestClassifier> url_request_classifier,
- const metrics::UpdateUsagePrefCallbackType& metrics_data_use_forwarder);
+ const metrics::UpdateUsagePrefCallbackType& metrics_data_use_forwarder,
+ DataUseAscriber* ascriber);
~DataUseMeasurement();
// Called before a request is sent.
@@ -115,9 +117,9 @@ class DataUseMeasurement {
// Reports the message size of the service requests.
void ReportServicesMessageSizeUMA(const net::URLRequest& request);
- // A helper function used to record data use of services. It gets the size of
- // exchanged message, its direction (which is upstream or downstream) and
- // reports to two histogram groups. DataUse.MessageSize.ServiceName and
+ // Records data use histograms of services. It gets the size of exchanged
+ // message, its direction (which is upstream or downstream) and reports to two
+ // histogram groups. DataUse.MessageSize.ServiceName and
// DataUse.Services.{Dimensions}. In the second one, services are buckets.
// |app_state| indicates the app state which can be foreground, background, or
// unknown.
@@ -128,6 +130,13 @@ class DataUseMeasurement {
bool is_connection_cellular,
int64_t message_size) const;
+ // Records data use histograms split on TrafficDirection, AppState and
+ // TabState.
+ void RecordTabStateHistogram(TrafficDirection dir,
+ DataUseUserData::AppState app_state,
+ bool is_tab_visible,
+ int64_t bytes);
+
// Classifier for identifying if an URL request is user initiated.
std::unique_ptr<URLRequestClassifier> url_request_classifier_;
@@ -137,6 +146,9 @@ class DataUseMeasurement {
// class to support registering arbitrary observers. crbug.com/601185
metrics::UpdateUsagePrefCallbackType metrics_data_use_forwarder_;
+ // DataUseAscriber used to get the attributes of data use.
+ DataUseAscriber* ascriber_;
+
#if defined(OS_ANDROID)
// Application listener store the last known state of the application in this
// field.

Powered by Google App Engine
This is Rietveld 408576698