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

Side by Side Diff: chrome/browser/engagement/site_engagement_score.cc

Issue 1986033002: Implement an observer interface for the site engagement service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@site-engagement-refactor
Patch Set: Squash race condition in unit test which leads to a leak Created 4 years, 7 months 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 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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698