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

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

Issue 2358663004: Fix foregound vs background data use measurement (Closed)
Patch Set: rebased Created 4 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
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
index 00d749c2a217db14dcb9210fc100afd8cc2ae75b..579bf1d708d82c9d6847503feb66c0099434e6d3 100644
--- a/components/data_use_measurement/core/data_use_user_data.h
+++ b/components/data_use_measurement/core/data_use_user_data.h
@@ -42,7 +42,11 @@ class DataUseUserData : public base::SupportsUserData::Data {
NTP_SNIPPETS,
};
- explicit DataUseUserData(ServiceName service_name);
+ // The state of the application. Only available on Android and on other
+ // platforms it is always FOREGROUND.
+ enum AppState { UNKNOWN, BACKGROUND, FOREGROUND };
+
+ DataUseUserData(ServiceName service_name, AppState app_state);
~DataUseUserData() override;
// Helper function to create DataUseUserData. The caller takes the ownership
@@ -60,12 +64,17 @@ class DataUseUserData : public base::SupportsUserData::Data {
ServiceName service_name() const { return service_name_; }
+ AppState app_state() const { return app_state_; }
+
// The key for retrieving back this type of user data.
static const void* const kUserDataKey;
private:
const ServiceName service_name_;
+ // App state when the request started.
+ const AppState app_state_;
+
DISALLOW_COPY_AND_ASSIGN(DataUseUserData);
};

Powered by Google App Engine
This is Rietveld 408576698