Index: components/metrics/metrics_data_use_measurements.h |
diff --git a/components/metrics/metrics_data_use_measurements.h b/components/metrics/metrics_data_use_measurements.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..df75ecb3c621ae09ddf3137be0197d80c7b5b0a4 |
--- /dev/null |
+++ b/components/metrics/metrics_data_use_measurements.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2014 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_METRICS_METRICS_DATA_USE_MEASUREMENT_H_ |
+#define COMPONENTS_METRICS_METRICS_DATA_USE_MEASUREMENT_H_ |
+ |
+#include "base/gtest_prod_util.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "components/prefs/pref_service.h" |
+ |
+namespace metrics { |
+ |
+class MetricsDataUseMeasurements{ |
+public: |
+ static void Initialize(PrefService* local_state); |
+ static MetricsDataUseMeasurements* GetInstance(); |
+ |
+ void UpdateMetricsUsagePrefs(const std::string& service_name, int message_size); |
Alexei Svitkine (slow)
2016/03/18 22:23:30
Suggest running "git cl format" on your CL.
gayane -on leave until 09-2017
2016/03/29 16:06:20
hmm, didn't notice it didn't apply to new files
|
+ bool CanUploadUMALog(int log_bytes); |
+ |
+ ~MetricsDataUseMeasurements(); |
+private: |
+ FRIEND_TEST_ALL_PREFIXES(MetricsDataUseMeasurementsTest, CheckUpdateUsagePref); |
+ FRIEND_TEST_ALL_PREFIXES(MetricsDataUseMeasurementsTest, CheckRemoveExpiredEntries); |
+ FRIEND_TEST_ALL_PREFIXES(MetricsDataUseMeasurementsTest, CheckTotalDataUse); |
+ FRIEND_TEST_ALL_PREFIXES(MetricsDataUseMeasurementsTest, CheckCanUploadUMALog); |
+ MetricsDataUseMeasurements(PrefService* local_state); |
+ |
+ void UpdateMetricsUsagePrefsOnUIThread(const std::string& service_name, int message_size); |
+ void SetMeasurementDateForTesting(std::string date); |
+ void RemoveExpiredEntries(); |
+ void UpdateUsagePref(const std::string& pref_name, int message_size); |
+ std::string GetCurrentMeasurementDate(); |
+ int GetUmaQouta(); |
+ double GetUmaRatio(); |
+ int TotalDataUse(std::string pref_name); |
+ void RemoveExpiredEntriesForPref(std::string pref_name); |
+ |
+ PrefService* local_state_; |
+ std::string date_for_testing_; |
+ base::WeakPtrFactory<MetricsDataUseMeasurements> self_ptr_factory_; |
Alexei Svitkine (slow)
2016/03/18 22:23:30
Nit: weak_ptr_factory_
gayane -on leave until 09-2017
2016/03/29 16:06:20
Done.
|
+}; |
+ |
+}// namespace metrics |
+#endif // COMPONENTS_METRICS_METRICS_DATA_USE_MEASUREMENT_H_ |