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..779fdaf39e31d234744ee9e5d072866bfd7934e4 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. |
@@ -40,6 +41,7 @@ class URLRequestClassifier; |
class DataUseMeasurement { |
public: |
DataUseMeasurement( |
+ DataUseAscriber* ascriber, |
std::unique_ptr<URLRequestClassifier> url_request_classifier, |
const metrics::UpdateUsagePrefCallbackType& metrics_data_use_forwarder); |
~DataUseMeasurement(); |
@@ -74,6 +76,8 @@ class DataUseMeasurement { |
// Specifies that data is received or sent, respectively. |
enum TrafficDirection { DOWNSTREAM, UPSTREAM }; |
+ enum TabState { FOREGROUND, BACKGROUND, UNKNOWN }; |
RyanSturm
2016/12/16 16:26:10
Is this enum really necessary, you treat it as boo
Raj
2016/12/16 19:59:10
Done.
|
+ |
// Returns the current application state (Foreground or Background). It always |
// returns Foreground if Chrome is not running on Android. |
DataUseUserData::AppState CurrentAppState() const; |
@@ -128,6 +132,13 @@ class DataUseMeasurement { |
bool is_connection_cellular, |
int64_t message_size) const; |
+ // A helper function used to record the app and tab state when data use |
RyanSturm
2016/12/16 16:26:11
How about "Records data use histograms split on Tr
Raj
2016/12/16 19:59:10
Done.
|
+ // happens. |
+ void RecordTabStateHistogram(TrafficDirection dir, |
+ DataUseUserData::AppState app_state, |
+ TabState tab_state, |
+ int64_t bytes); |
+ |
// Classifier for identifying if an URL request is user initiated. |
std::unique_ptr<URLRequestClassifier> url_request_classifier_; |
@@ -137,6 +148,10 @@ 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. Not owned by |
RyanSturm
2016/12/16 16:26:11
I don't think you need to say "Not owned by |this|
Raj
2016/12/16 19:59:10
Done.
|
+ // |this|. |
+ DataUseAscriber* ascriber_; |
+ |
#if defined(OS_ANDROID) |
// Application listener store the last known state of the application in this |
// field. |