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

Side by Side Diff: chrome/browser/banners/app_banner_settings_helper.cc

Issue 2344793002: Allow app banners to trigger on 0 engagement. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « chrome/browser/banners/app_banner_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/banners/app_banner_settings_helper.h" 5 #include "chrome/browser/banners/app_banner_settings_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // Queries variations for the maximum site engagement score required to trigger 140 // Queries variations for the maximum site engagement score required to trigger
141 // the banner showing. 141 // the banner showing.
142 void UpdateSiteEngagementToTrigger() { 142 void UpdateSiteEngagementToTrigger() {
143 std::string total_param = variations::GetVariationParamValue( 143 std::string total_param = variations::GetVariationParamValue(
144 kBannerParamsKey, kBannerParamsEngagementTotalKey); 144 kBannerParamsKey, kBannerParamsEngagementTotalKey);
145 145
146 if (!total_param.empty()) { 146 if (!total_param.empty()) {
147 double total_engagement = -1; 147 double total_engagement = -1;
148 148
149 if (base::StringToDouble(total_param, &total_engagement) && 149 if (base::StringToDouble(total_param, &total_engagement) &&
150 total_engagement > 0) { 150 total_engagement >= 0) {
151 AppBannerSettingsHelper::SetTotalEngagementToTrigger(total_engagement); 151 AppBannerSettingsHelper::SetTotalEngagementToTrigger(total_engagement);
152 } 152 }
153 } 153 }
154 } 154 }
155 155
156 // Queries variations for updates to the default engagement values assigned 156 // Queries variations for updates to the default engagement values assigned
157 // to direct and indirect navigations. 157 // to direct and indirect navigations.
158 void UpdateEngagementWeights() { 158 void UpdateEngagementWeights() {
159 std::string direct_param = variations::GetVariationParamValue( 159 std::string direct_param = variations::GetVariationParamValue(
160 kBannerParamsKey, kBannerParamsDirectKey); 160 kBannerParamsKey, kBannerParamsDirectKey);
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 return true; 649 return true;
650 } 650 }
651 651
652 // Assume any value which is not "0" or "false" indicates that we should use 652 // Assume any value which is not "0" or "false" indicates that we should use
653 // site engagement. 653 // site engagement.
654 std::string param = variations::GetVariationParamValue( 654 std::string param = variations::GetVariationParamValue(
655 kBannerParamsKey, kBannerSiteEngagementParamsKey); 655 kBannerParamsKey, kBannerSiteEngagementParamsKey);
656 656
657 return (!param.empty() && param != "0" && param != "false"); 657 return (!param.empty() && param != "0" && param != "false");
658 } 658 }
OLDNEW
« no previous file with comments | « chrome/browser/banners/app_banner_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698