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

Side by Side Diff: chrome/browser/engagement/site_engagement_metrics.h

Issue 1427913002: Implement media playing engagement detection for the site engagement service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@user-input-event
Patch Set: Addressing nits Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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_TOUCH_GESTURE,
24 ENGAGEMENT_WHEEL, 24 ENGAGEMENT_WHEEL,
25 ENGAGEMENT_MEDIA_HIDDEN,
26 ENGAGEMENT_MEDIA_VISIBLE,
25 ENGAGEMENT_LAST, 27 ENGAGEMENT_LAST,
26 }; 28 };
27 29
28 static void RecordTotalSiteEngagement(double total_engagement); 30 static void RecordTotalSiteEngagement(double total_engagement);
29 static void RecordTotalOriginsEngaged(int total_origins); 31 static void RecordTotalOriginsEngaged(int total_origins);
30 static void RecordMeanEngagement(double mean_engagement); 32 static void RecordMeanEngagement(double mean_engagement);
31 static void RecordMedianEngagement(double median_engagement); 33 static void RecordMedianEngagement(double median_engagement);
32 static void RecordEngagementScores(std::map<GURL, double> score_map); 34 static void RecordEngagementScores(std::map<GURL, double> score_map);
33 static void RecordOriginsWithMaxEngagement(int total_origins); 35 static void RecordOriginsWithMaxEngagement(int total_origins);
34 static void RecordOriginsWithMaxDailyEngagement(int total_origins); 36 static void RecordOriginsWithMaxDailyEngagement(int total_origins);
35 static void RecordPercentOriginsWithMaxEngagement(double percentage); 37 static void RecordPercentOriginsWithMaxEngagement(double percentage);
36 static void RecordEngagement(EngagementType type); 38 static void RecordEngagement(EngagementType type);
37 39
38 private: 40 private:
39 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, CheckHistograms); 41 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, CheckHistograms);
40 FRIEND_TEST_ALL_PREFIXES(SiteEngagementHelperTest, 42 FRIEND_TEST_ALL_PREFIXES(SiteEngagementHelperTest,
41 MixedInputEngagementAccumulation); 43 MixedInputEngagementAccumulation);
42 static const char kTotalEngagementHistogram[]; 44 static const char kTotalEngagementHistogram[];
43 static const char kTotalOriginsHistogram[]; 45 static const char kTotalOriginsHistogram[];
44 static const char kMeanEngagementHistogram[]; 46 static const char kMeanEngagementHistogram[];
45 static const char kMedianEngagementHistogram[]; 47 static const char kMedianEngagementHistogram[];
46 static const char kEngagementScoreHistogram[]; 48 static const char kEngagementScoreHistogram[];
47 static const char kOriginsWithMaxEngagementHistogram[]; 49 static const char kOriginsWithMaxEngagementHistogram[];
48 static const char kOriginsWithMaxDailyEngagementHistogram[]; 50 static const char kOriginsWithMaxDailyEngagementHistogram[];
49 static const char kPercentOriginsWithMaxEngagementHistogram[]; 51 static const char kPercentOriginsWithMaxEngagementHistogram[];
50 static const char kEngagementTypeHistogram[]; 52 static const char kEngagementTypeHistogram[];
51 }; 53 };
52 54
53 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_ 55 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_
OLDNEW
« no previous file with comments | « chrome/browser/engagement/site_engagement_helper_unittest.cc ('k') | chrome/browser/engagement/site_engagement_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698