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 #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 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/time/clock.h" | 10 #include "base/time/clock.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 } | 112 } |
| 113 | 113 |
| 114 double SiteEngagementScore::GetMediumEngagementBoundary() { | 114 double SiteEngagementScore::GetMediumEngagementBoundary() { |
| 115 return param_values[MEDIUM_ENGAGEMENT_BOUNDARY]; | 115 return param_values[MEDIUM_ENGAGEMENT_BOUNDARY]; |
| 116 } | 116 } |
| 117 | 117 |
| 118 double SiteEngagementScore::GetHighEngagementBoundary() { | 118 double SiteEngagementScore::GetHighEngagementBoundary() { |
| 119 return param_values[HIGH_ENGAGEMENT_BOUNDARY]; | 119 return param_values[HIGH_ENGAGEMENT_BOUNDARY]; |
| 120 } | 120 } |
| 121 | 121 |
| 122 double SiteEngagementScore::GetMinimumEngagementIncrement() { | |
| 123 return GetHiddenMediaPoints(); | |
|
calamity
2016/05/19 03:28:22
This will limit the way we modify the experimental
dominickn
2016/05/19 04:36:14
Done.
| |
| 124 } | |
| 125 | |
| 122 // static | 126 // static |
| 123 void SiteEngagementScore::UpdateFromVariations(const char* param_name) { | 127 void SiteEngagementScore::UpdateFromVariations(const char* param_name) { |
| 124 double param_vals[MAX_VARIATION]; | 128 double param_vals[MAX_VARIATION]; |
| 125 | 129 |
| 126 for (int i = 0; i < MAX_VARIATION; ++i) { | 130 for (int i = 0; i < MAX_VARIATION; ++i) { |
| 127 std::string param_string = | 131 std::string param_string = |
| 128 variations::GetVariationParamValue(param_name, kVariationNames[i]); | 132 variations::GetVariationParamValue(param_name, kVariationNames[i]); |
| 129 | 133 |
| 130 // Bail out if we didn't get a param string for the key, or if we couldn't | 134 // Bail out if we didn't get a param string for the key, or if we couldn't |
| 131 // convert the param string to a double, or if we get a negative value. | 135 // convert the param string to a double, or if we get a negative value. |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 param_values[HIDDEN_MEDIA_POINTS] = 0.01; | 300 param_values[HIDDEN_MEDIA_POINTS] = 0.01; |
| 297 param_values[WEB_APP_INSTALLED_POINTS] = 5; | 301 param_values[WEB_APP_INSTALLED_POINTS] = 5; |
| 298 param_values[BOOTSTRAP_POINTS] = 8; | 302 param_values[BOOTSTRAP_POINTS] = 8; |
| 299 param_values[MEDIUM_ENGAGEMENT_BOUNDARY] = 5; | 303 param_values[MEDIUM_ENGAGEMENT_BOUNDARY] = 5; |
| 300 param_values[HIGH_ENGAGEMENT_BOUNDARY] = 50; | 304 param_values[HIGH_ENGAGEMENT_BOUNDARY] = 50; |
| 301 | 305 |
| 302 // This is set to zero to avoid interference with tests and is set when | 306 // This is set to zero to avoid interference with tests and is set when |
| 303 // testing this functionality. | 307 // testing this functionality. |
| 304 param_values[FIRST_DAILY_ENGAGEMENT] = 0; | 308 param_values[FIRST_DAILY_ENGAGEMENT] = 0; |
| 305 } | 309 } |
| OLD | NEW |