OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |