Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SCORE_H_ | 5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SCORE_H_ |
| 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SCORE_H_ | 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SCORE_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class Clock; | 14 class Clock; |
| 15 } | 15 } |
| 16 | 16 |
| 17 class SiteEngagementScore { | 17 class SiteEngagementScore { |
| 18 public: | 18 public: |
| 19 // The parameters which can be varied via field trial. All "points" values | 19 // The parameters which can be varied via field trial. |
| 20 // should be appended to the end of the enum prior to MAX_VARIATION. | 20 // Any new point value that increases engagement based on direct user activity |
| 21 // should be added after POINTS_INCREMENT_FIRST and before | |
| 22 // POINTS_INCREMENT_LAST. | |
| 21 enum Variation { | 23 enum Variation { |
| 22 // The maximum number of points that can be accrued in one day. | 24 // The maximum number of points that can be accrued in one day. |
| 23 MAX_POINTS_PER_DAY = 0, | 25 MAX_POINTS_PER_DAY = 0, |
| 24 | 26 |
| 25 // The period over which site engagement decays. | 27 // The period over which site engagement decays. |
| 26 DECAY_PERIOD_IN_DAYS, | 28 DECAY_PERIOD_IN_DAYS, |
| 27 | 29 |
| 28 // The number of points to decay per period. | 30 // The number of points to decay per period. |
| 29 DECAY_POINTS, | 31 DECAY_POINTS, |
| 30 | 32 |
| 31 // The number of points given for navigations. | 33 // The number of points given for navigations. |
| 32 NAVIGATION_POINTS, | 34 NAVIGATION_POINTS, |
| 35 POINTS_INCREMENT_FIRST = NAVIGATION_POINTS, | |
|
benwells
2016/06/01 01:44:45
Is it just me, or will it be awkward now to add mo
dominickn
2016/06/01 02:54:13
Acknowledged. I'll remove this.
| |
| 33 | 36 |
| 34 // The number of points given for user input. | 37 // The number of points given for user input. |
| 35 USER_INPUT_POINTS, | 38 USER_INPUT_POINTS, |
| 36 | 39 |
| 37 // The number of points given for media playing. Initially calibrated such | 40 // The number of points given for media playing. Initially calibrated such |
| 38 // that at least 30 minutes of foreground media would be required to allow a | 41 // that at least 30 minutes of foreground media would be required to allow a |
| 39 // site to reach the daily engagement maximum. | 42 // site to reach the daily engagement maximum. |
| 40 VISIBLE_MEDIA_POINTS, | 43 VISIBLE_MEDIA_POINTS, |
| 41 HIDDEN_MEDIA_POINTS, | 44 HIDDEN_MEDIA_POINTS, |
| 42 | 45 |
| 46 // Any new points value that increases engagement directly based on user | |
| 47 // input should be inserted above this, and update this enum value | |
| 48 // appropriately. | |
| 49 POINTS_INCREMENT_LAST = HIDDEN_MEDIA_POINTS, | |
| 50 | |
| 43 // The number of points added to engagement when a site is launched from | 51 // The number of points added to engagement when a site is launched from |
| 44 // homescreen or added as a bookmark app. This bonus will apply for ten days | 52 // homescreen or added as a bookmark app. This bonus will apply for ten days |
| 45 // following a launch; each new launch resets the ten days. | 53 // following a launch; each new launch resets the ten days. |
| 46 WEB_APP_INSTALLED_POINTS, | 54 WEB_APP_INSTALLED_POINTS, |
| 47 | 55 |
| 48 // The number of points given for the first engagement event of the day for | 56 // The number of points given for the first engagement event of the day for |
| 49 // each site. | 57 // each site. |
| 50 FIRST_DAILY_ENGAGEMENT, | 58 FIRST_DAILY_ENGAGEMENT, |
| 51 | 59 |
| 52 // The number of points that the engagement service must accumulate to be | 60 // The number of points that the engagement service must accumulate to be |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 69 static double GetDecayPoints(); | 77 static double GetDecayPoints(); |
| 70 static double GetNavigationPoints(); | 78 static double GetNavigationPoints(); |
| 71 static double GetUserInputPoints(); | 79 static double GetUserInputPoints(); |
| 72 static double GetVisibleMediaPoints(); | 80 static double GetVisibleMediaPoints(); |
| 73 static double GetHiddenMediaPoints(); | 81 static double GetHiddenMediaPoints(); |
| 74 static double GetWebAppInstalledPoints(); | 82 static double GetWebAppInstalledPoints(); |
| 75 static double GetFirstDailyEngagementPoints(); | 83 static double GetFirstDailyEngagementPoints(); |
| 76 static double GetBootstrapPoints(); | 84 static double GetBootstrapPoints(); |
| 77 static double GetMediumEngagementBoundary(); | 85 static double GetMediumEngagementBoundary(); |
| 78 static double GetHighEngagementBoundary(); | 86 static double GetHighEngagementBoundary(); |
| 87 static double GetMinimumEngagementIncrement(); | |
| 79 | 88 |
| 80 // Update the default engagement settings via variations. | 89 // Update the default engagement settings via variations. |
| 81 static void UpdateFromVariations(const char* param_name); | 90 static void UpdateFromVariations(const char* param_name); |
| 82 | 91 |
| 83 // The SiteEngagementScore does not take ownership of |clock|. It is the | 92 // The SiteEngagementScore does not take ownership of |clock|. It is the |
| 84 // responsibility of the caller to make sure |clock| outlives this | 93 // responsibility of the caller to make sure |clock| outlives this |
| 85 // SiteEngagementScore. | 94 // SiteEngagementScore. |
| 86 SiteEngagementScore(base::Clock* clock, | 95 SiteEngagementScore(base::Clock* clock, |
| 87 const base::DictionaryValue& score_dict); | 96 const base::DictionaryValue& score_dict); |
| 88 ~SiteEngagementScore(); | 97 ~SiteEngagementScore(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 base::Time last_engagement_time_; | 177 base::Time last_engagement_time_; |
| 169 | 178 |
| 170 // The last time the site with this score was launched from an installed | 179 // The last time the site with this score was launched from an installed |
| 171 // shortcut. | 180 // shortcut. |
| 172 base::Time last_shortcut_launch_time_; | 181 base::Time last_shortcut_launch_time_; |
| 173 | 182 |
| 174 DISALLOW_COPY_AND_ASSIGN(SiteEngagementScore); | 183 DISALLOW_COPY_AND_ASSIGN(SiteEngagementScore); |
| 175 }; | 184 }; |
| 176 | 185 |
| 177 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SCORE_H_ | 186 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SCORE_H_ |
| OLD | NEW |