| 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 #include "chrome/browser/engagement/site_engagement_score.h" | 5 #include "chrome/browser/engagement/site_engagement_score.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 // static | 65 // static |
| 66 SiteEngagementScore::ParamValues& SiteEngagementScore::GetParamValues() { | 66 SiteEngagementScore::ParamValues& SiteEngagementScore::GetParamValues() { |
| 67 CR_DEFINE_STATIC_LOCAL(ParamValues, param_values, (BuildParamValues())); | 67 CR_DEFINE_STATIC_LOCAL(ParamValues, param_values, (BuildParamValues())); |
| 68 return param_values; | 68 return param_values; |
| 69 } | 69 } |
| 70 | 70 |
| 71 // static | 71 // static |
| 72 SiteEngagementScore::ParamValues SiteEngagementScore::BuildParamValues() { | 72 SiteEngagementScore::ParamValues SiteEngagementScore::BuildParamValues() { |
| 73 SiteEngagementScore::ParamValues param_values; | 73 SiteEngagementScore::ParamValues param_values; |
| 74 param_values[MAX_POINTS_PER_DAY] = {"max_points_per_day", 5}; | 74 param_values[MAX_POINTS_PER_DAY] = {"max_points_per_day", 15}; |
| 75 param_values[DECAY_PERIOD_IN_HOURS] = {"decay_period_in_hours", 7 * 24}; | 75 param_values[DECAY_PERIOD_IN_HOURS] = {"decay_period_in_hours", 2}; |
| 76 param_values[DECAY_POINTS] = {"decay_points", 5}; | 76 param_values[DECAY_POINTS] = {"decay_points", 0}; |
| 77 param_values[DECAY_PROPORTION] = {"decay_proportion", 1}; | 77 param_values[DECAY_PROPORTION] = {"decay_proportion", 0.984}; |
| 78 param_values[SCORE_CLEANUP_THRESHOLD] = {"score_cleanup_threshold", 0}; | 78 param_values[SCORE_CLEANUP_THRESHOLD] = {"score_cleanup_threshold", 0.5}; |
| 79 param_values[NAVIGATION_POINTS] = {"navigation_points", 0.5}; | 79 param_values[NAVIGATION_POINTS] = {"navigation_points", 1.5}; |
| 80 param_values[USER_INPUT_POINTS] = {"user_input_points", 0.2}; | 80 param_values[USER_INPUT_POINTS] = {"user_input_points", 0.6}; |
| 81 param_values[VISIBLE_MEDIA_POINTS] = {"visible_media_playing_points", 0.02}; | 81 param_values[VISIBLE_MEDIA_POINTS] = {"visible_media_playing_points", 0.06}; |
| 82 param_values[HIDDEN_MEDIA_POINTS] = {"hidden_media_playing_points", 0.01}; | 82 param_values[HIDDEN_MEDIA_POINTS] = {"hidden_media_playing_points", 0.01}; |
| 83 param_values[WEB_APP_INSTALLED_POINTS] = {"web_app_installed_points", 5}; | 83 param_values[WEB_APP_INSTALLED_POINTS] = {"web_app_installed_points", 5}; |
| 84 param_values[FIRST_DAILY_ENGAGEMENT] = {"first_daily_engagement_points", 0.5}; | 84 param_values[FIRST_DAILY_ENGAGEMENT] = {"first_daily_engagement_points", 1.5}; |
| 85 param_values[BOOTSTRAP_POINTS] = {"bootstrap_points", 8}; | 85 param_values[BOOTSTRAP_POINTS] = {"bootstrap_points", 24}; |
| 86 param_values[MEDIUM_ENGAGEMENT_BOUNDARY] = {"medium_engagement_boundary", 5}; | 86 param_values[MEDIUM_ENGAGEMENT_BOUNDARY] = {"medium_engagement_boundary", 15}; |
| 87 param_values[HIGH_ENGAGEMENT_BOUNDARY] = {"high_engagement_boundary", 50}; | 87 param_values[HIGH_ENGAGEMENT_BOUNDARY] = {"high_engagement_boundary", 50}; |
| 88 param_values[MAX_DECAYS_PER_SCORE] = {"max_decays_per_score", 1}; | 88 param_values[MAX_DECAYS_PER_SCORE] = {"max_decays_per_score", 4}; |
| 89 param_values[LAST_ENGAGEMENT_GRACE_PERIOD_IN_HOURS] = { | 89 param_values[LAST_ENGAGEMENT_GRACE_PERIOD_IN_HOURS] = { |
| 90 "last_engagement_grace_period_in_hours", 72}; | 90 "last_engagement_grace_period_in_hours", 1}; |
| 91 return param_values; | 91 return param_values; |
| 92 } | 92 } |
| 93 | 93 |
| 94 double SiteEngagementScore::GetMaxPointsPerDay() { | 94 double SiteEngagementScore::GetMaxPointsPerDay() { |
| 95 return GetParamValues()[MAX_POINTS_PER_DAY].second; | 95 return GetParamValues()[MAX_POINTS_PER_DAY].second; |
| 96 } | 96 } |
| 97 | 97 |
| 98 double SiteEngagementScore::GetDecayPeriodInHours() { | 98 double SiteEngagementScore::GetDecayPeriodInHours() { |
| 99 return GetParamValues()[DECAY_PERIOD_IN_HOURS].second; | 99 return GetParamValues()[DECAY_PERIOD_IN_HOURS].second; |
| 100 } | 100 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 GetParamValues()[HIGH_ENGAGEMENT_BOUNDARY].second = 50; | 363 GetParamValues()[HIGH_ENGAGEMENT_BOUNDARY].second = 50; |
| 364 GetParamValues()[MAX_DECAYS_PER_SCORE].second = 1; | 364 GetParamValues()[MAX_DECAYS_PER_SCORE].second = 1; |
| 365 GetParamValues()[LAST_ENGAGEMENT_GRACE_PERIOD_IN_HOURS].second = 72; | 365 GetParamValues()[LAST_ENGAGEMENT_GRACE_PERIOD_IN_HOURS].second = 72; |
| 366 | 366 |
| 367 // This is set to values that avoid interference with tests and are set when | 367 // This is set to values that avoid interference with tests and are set when |
| 368 // testing these features. | 368 // testing these features. |
| 369 GetParamValues()[FIRST_DAILY_ENGAGEMENT].second = 0; | 369 GetParamValues()[FIRST_DAILY_ENGAGEMENT].second = 0; |
| 370 GetParamValues()[DECAY_PROPORTION].second = 1; | 370 GetParamValues()[DECAY_PROPORTION].second = 1; |
| 371 GetParamValues()[SCORE_CLEANUP_THRESHOLD].second = 0; | 371 GetParamValues()[SCORE_CLEANUP_THRESHOLD].second = 0; |
| 372 } | 372 } |
| OLD | NEW |