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

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

Issue 2216073003: Rename the app banner variations key for total site engagement score. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // Keys to use when storing BannerEvent structs. 71 // Keys to use when storing BannerEvent structs.
72 const char kBannerTimeKey[] = "time"; 72 const char kBannerTimeKey[] = "time";
73 const char kBannerEngagementKey[] = "engagement"; 73 const char kBannerEngagementKey[] = "engagement";
74 74
75 // Keys to use when querying the variations params. 75 // Keys to use when querying the variations params.
76 const char kBannerParamsKey[] = "AppBannerTriggering"; 76 const char kBannerParamsKey[] = "AppBannerTriggering";
77 const char kBannerParamsDirectKey[] = "direct"; 77 const char kBannerParamsDirectKey[] = "direct";
78 const char kBannerParamsIndirectKey[] = "indirect"; 78 const char kBannerParamsIndirectKey[] = "indirect";
79 const char kBannerParamsTotalKey[] = "total"; 79 const char kBannerParamsTotalKey[] = "total";
80 const char kBannerParamsMinutesKey[] = "minutes"; 80 const char kBannerParamsMinutesKey[] = "minutes";
81 const char kBannerParamsEngagementTotalKey[] = "site_engagement_total";
81 const char kBannerSiteEngagementParamsKey[] = "use_site_engagement"; 82 const char kBannerSiteEngagementParamsKey[] = "use_site_engagement";
82 83
83 // Engagement weight assigned to direct and indirect navigations. 84 // Engagement weight assigned to direct and indirect navigations.
84 // By default, a direct navigation is a page visit via ui::PAGE_TRANSITION_TYPED 85 // By default, a direct navigation is a page visit via ui::PAGE_TRANSITION_TYPED
85 // or ui::PAGE_TRANSITION_GENERATED. 86 // or ui::PAGE_TRANSITION_GENERATED.
86 double gDirectNavigationEngagement = kDefaultDirectNavigationEngagement; 87 double gDirectNavigationEngagement = kDefaultDirectNavigationEngagement;
87 double gIndirectNavigationEnagagement = kDefaultIndirectNavigationEngagement; 88 double gIndirectNavigationEnagagement = kDefaultIndirectNavigationEngagement;
88 89
89 // Number of minutes between visits that will trigger a could show banner event. 90 // Number of minutes between visits that will trigger a could show banner event.
90 // Defaults to the number of minutes in a day. 91 // Defaults to the number of minutes in a day.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return gDirectNavigationEngagement; 133 return gDirectNavigationEngagement;
133 } else { 134 } else {
134 return gIndirectNavigationEnagagement; 135 return gIndirectNavigationEnagagement;
135 } 136 }
136 } 137 }
137 138
138 // Queries variations for the maximum site engagement score required to trigger 139 // Queries variations for the maximum site engagement score required to trigger
139 // the banner showing. 140 // the banner showing.
140 void UpdateSiteEngagementToTrigger() { 141 void UpdateSiteEngagementToTrigger() {
141 std::string total_param = variations::GetVariationParamValue( 142 std::string total_param = variations::GetVariationParamValue(
142 kBannerParamsKey, kBannerParamsTotalKey); 143 kBannerParamsKey, kBannerParamsEngagementTotalKey);
143 144
144 if (!total_param.empty()) { 145 if (!total_param.empty()) {
145 double total_engagement = -1; 146 double total_engagement = -1;
146 147
147 if (base::StringToDouble(total_param, &total_engagement) && 148 if (base::StringToDouble(total_param, &total_engagement) &&
148 total_engagement > 0) { 149 total_engagement > 0) {
149 AppBannerSettingsHelper::SetTotalEngagementToTrigger(total_engagement); 150 AppBannerSettingsHelper::SetTotalEngagementToTrigger(total_engagement);
150 } 151 }
151 } 152 }
152 } 153 }
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 return true; 648 return true;
648 } 649 }
649 650
650 // Assume any value which is not "0" or "false" indicates that we should use 651 // Assume any value which is not "0" or "false" indicates that we should use
651 // site engagement. 652 // site engagement.
652 std::string param = variations::GetVariationParamValue( 653 std::string param = variations::GetVariationParamValue(
653 kBannerParamsKey, kBannerSiteEngagementParamsKey); 654 kBannerParamsKey, kBannerSiteEngagementParamsKey);
654 655
655 return (!param.empty() && param != "0" && param != "false"); 656 return (!param.empty() && param != "0" && param != "false");
656 } 657 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698