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

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

Issue 1388293002: Notify WebContentsObservers of user interactions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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_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_
OLDNEW
« no previous file with comments | « chrome/browser/engagement/site_engagement_helper_unittest.cc ('k') | chrome/browser/engagement/site_engagement_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698