OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_ | 5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_ |
6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_ | 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 // Helper class managing the UMA histograms for the Site Engagement Service. | 13 // Helper class managing the UMA histograms for the Site Engagement Service. |
14 class SiteEngagementMetrics { | 14 class SiteEngagementMetrics { |
15 public: | 15 public: |
16 // This is used to back a UMA histogram, so it should be treated as | 16 // This is used to back a UMA histogram, so it should be treated as |
17 // append-only. Any new values should be inserted immediately prior to | 17 // append-only. Any new values should be inserted immediately prior to |
18 // ENGAGEMENT_LAST. | 18 // ENGAGEMENT_LAST. |
19 enum EngagementType { | 19 enum EngagementType { |
20 ENGAGEMENT_NAVIGATION, | 20 ENGAGEMENT_NAVIGATION, |
21 ENGAGEMENT_KEYPRESS, | 21 ENGAGEMENT_KEYPRESS, |
22 ENGAGEMENT_MOUSE, | 22 ENGAGEMENT_MOUSE, |
| 23 ENGAGEMENT_TOUCH_GESTURE, |
23 ENGAGEMENT_LAST, | 24 ENGAGEMENT_LAST, |
24 }; | 25 }; |
25 | 26 |
26 static void RecordTotalSiteEngagement(double total_engagement); | 27 static void RecordTotalSiteEngagement(double total_engagement); |
27 static void RecordTotalOriginsEngaged(int total_origins); | 28 static void RecordTotalOriginsEngaged(int total_origins); |
28 static void RecordMeanEngagement(double mean_engagement); | 29 static void RecordMeanEngagement(double mean_engagement); |
29 static void RecordMedianEngagement(double median_engagement); | 30 static void RecordMedianEngagement(double median_engagement); |
30 static void RecordEngagementScores(std::map<GURL, double> score_map); | 31 static void RecordEngagementScores(std::map<GURL, double> score_map); |
31 static void RecordOriginsWithMaxEngagement(int total_origins); | 32 static void RecordOriginsWithMaxEngagement(int total_origins); |
32 static void RecordOriginsWithMaxDailyEngagement(int total_origins); | 33 static void RecordOriginsWithMaxDailyEngagement(int total_origins); |
33 static void RecordPercentOriginsWithMaxEngagement(double percentage); | 34 static void RecordPercentOriginsWithMaxEngagement(double percentage); |
34 static void RecordEngagement(EngagementType type); | 35 static void RecordEngagement(EngagementType type); |
35 | 36 |
36 private: | 37 private: |
37 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, CheckHistograms); | 38 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, CheckHistograms); |
38 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceBrowserTest, | 39 FRIEND_TEST_ALL_PREFIXES(SiteEngagementHelperTest, |
39 MixedInputEngagementAccumulation); | 40 MixedInputEngagementAccumulation); |
40 static const char kTotalEngagementHistogram[]; | 41 static const char kTotalEngagementHistogram[]; |
41 static const char kTotalOriginsHistogram[]; | 42 static const char kTotalOriginsHistogram[]; |
42 static const char kMeanEngagementHistogram[]; | 43 static const char kMeanEngagementHistogram[]; |
43 static const char kMedianEngagementHistogram[]; | 44 static const char kMedianEngagementHistogram[]; |
44 static const char kEngagementScoreHistogram[]; | 45 static const char kEngagementScoreHistogram[]; |
45 static const char kOriginsWithMaxEngagementHistogram[]; | 46 static const char kOriginsWithMaxEngagementHistogram[]; |
46 static const char kOriginsWithMaxDailyEngagementHistogram[]; | 47 static const char kOriginsWithMaxDailyEngagementHistogram[]; |
47 static const char kPercentOriginsWithMaxEngagementHistogram[]; | 48 static const char kPercentOriginsWithMaxEngagementHistogram[]; |
48 static const char kEngagementTypeHistogram[]; | 49 static const char kEngagementTypeHistogram[]; |
49 }; | 50 }; |
50 | 51 |
51 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_ | 52 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_ |
OLD | NEW |