1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509
|
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/search/ntp_features.h"
#include <string>
#include <vector>
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/time/time.h"
#include "build/build_config.h"
namespace {
const char kMobilePromoQRCodeURL[] =
"https://apps.apple.com/app/apple-store/"
"id535886823?pt=9008&ct=desktop-chr-ntp&mt=8";
} // namespace
namespace ntp_features {
// If enabled, shows a confirm dialog before removing search suggestions from
// the New Tab page real search box ("realbox").
BASE_FEATURE(kConfirmSuggestionRemovals,
"ConfirmNtpSuggestionRemovals",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, shows an extension card within the Customize Chrome Side
// Panel for access to the Chrome Web Store extensions.
BASE_FEATURE(kCustomizeChromeSidePanelExtensionsCard,
"CustomizeChromeSidePanelExtensionsCard",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, shows wallpaper search within the Customize Chrome Side Panel.
// This is a kill switch. Keep indefinitely.
BASE_FEATURE(kCustomizeChromeWallpaperSearch,
"CustomizeChromeWallpaperSearch",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, shows entry point on Customize Chrome Side Panel's Appearance
// page for Wallpaper Search.";
BASE_FEATURE(kCustomizeChromeWallpaperSearchButton,
"CustomizeChromeWallpaperSearchButton",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, shows inspiration card in Customize Chrome Side Panel Wallpaper
// Search.
BASE_FEATURE(kCustomizeChromeWallpaperSearchInspirationCard,
"CustomizeChromeWallpaperSearchInspirationCard",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, NTP "realbox" will be themed for CR23. Includes realbox
// matching omnibox theme and increased realbox shadow.
BASE_FEATURE(kRealboxCr23Theming,
"NtpRealboxCr23Theming",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, the NTP "realbox" will have same border/drop shadow in hover
// state as searchbox.
BASE_FEATURE(kRealboxMatchSearchboxTheme,
"NtpRealboxMatchSearchboxTheme",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, the real search box ("realbox") on the New Tab page will show a
// Google (g) icon instead of the typical magnifying glass (aka loupe).
BASE_FEATURE(kRealboxUseGoogleGIcon,
"NtpRealboxUseGoogleGIcon",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, alpha NTP backgrounds will show in Customize Chrome.
// This is a development switch. Keep indefinitely.
BASE_FEATURE(kNtpAlphaBackgroundCollections,
"NtpAlphaBackgroundCollections",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, NTP background image links will be checked for HTTP status
// errors."
BASE_FEATURE(kNtpBackgroundImageErrorDetection,
"NtpBackgroundImageErrorDetection",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, calendar module will be shown.
BASE_FEATURE(kNtpCalendarModule,
"NtpCalendarModule",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, chrome cart module will be shown.
BASE_FEATURE(kNtpChromeCartModule,
"NtpChromeCartModule",
base::FEATURE_ENABLED_BY_DEFAULT);
#if !defined(OFFICIAL_BUILD)
// If enabled, dummy modules will be shown.
// This is a development switch. Keep indefinitely.
BASE_FEATURE(kNtpDummyModules,
"NtpDummyModules",
base::FEATURE_DISABLED_BY_DEFAULT);
#endif
// If enabled, Google Drive module will be shown.
// This is a kill switch. Keep indefinitely.
BASE_FEATURE(kNtpDriveModule,
"NtpDriveModule",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, the NTP Drive module does not require sync.
BASE_FEATURE(kNtpDriveModuleNoSyncRequirement,
"NtpDriveModuleNoSyncRequirement",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, segmentation data will be collected to decide whether or not to
// show the Drive module.
BASE_FEATURE(kNtpDriveModuleSegmentation,
"NtpDriveModuleSegmentation",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, six files show in the NTP Drive module, instead of three.
BASE_FEATURE(kNtpDriveModuleShowSixFiles,
"NtpDriveModuleShowSixFiles",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, logo will be shown.
// This is a kill switch. Keep indefinitely.
BASE_FEATURE(kNtpLogo, "NtpLogo", base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, middle slot promo will be shown.
// This is a kill switch. Keep indefinitely.
BASE_FEATURE(kNtpMiddleSlotPromo,
"NtpMiddleSlotPromo",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, middle slot promo will be dismissed from New Tab Page until new
// promo message is populated
BASE_FEATURE(kNtpMiddleSlotPromoDismissal,
"NtpMiddleSlotPromoDismissal",
base::FEATURE_ENABLED_BY_DEFAULT);
// Dummy feature to set param "NtpModulesLoadTimeoutMillisecondsParam".
// This is used for an emergency Finch param. Keep indefinitely.
BASE_FEATURE(kNtpModulesLoadTimeoutMilliseconds,
"NtpModulesLoadTimeoutMilliseconds",
base::FEATURE_DISABLED_BY_DEFAULT);
// Dummy feature to set param "NtpModulesOrderParam".
// This is used for an emergency Finch param. Keep indefinitely.
BASE_FEATURE(kNtpModulesOrder,
"NtpModulesOrder",
base::FEATURE_DISABLED_BY_DEFAULT);
// Dummy feature to set param "NtpModulesMaxColumnCountParam".
// This is used for an emergency Finch param. Keep indefinitely.
BASE_FEATURE(kNtpModulesMaxColumnCount,
"NtpModulesMaxColumnCount",
base::FEATURE_DISABLED_BY_DEFAULT);
// Dummy feature to set param "NtpModulesLoadedWithOtherModulesMaxInstanceCount"
// This is used for an emergency Finch param. Keep indefinitely.
BASE_FEATURE(kNtpModulesLoadedWithOtherModulesMaxInstanceCount,
"NtpModulesLoadedWithOtherModulesMaxInstanceCount",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, modules will be able to be reordered via dragging and dropping
BASE_FEATURE(kNtpModulesDragAndDrop,
"NtpModulesDragAndDrop",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, modules will be loaded but not shown. This is useful to determine
// if a user would have seen modules in order to counterfactually log or
// trigger.
BASE_FEATURE(kNtpModulesLoad,
"NtpModulesLoad",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, makes browser sign-in requirement per-module, instead of a
// requirement for all modules.
BASE_FEATURE(kNtpModuleSignInRequirement,
"NtpModuleSignInRequirement",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, OneGoogleBar will be shown.
// This is a kill switch. Keep indefinitely.
BASE_FEATURE(kNtpOneGoogleBar,
"NtpOneGoogleBar",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, outlook calendar module will be shown.
BASE_FEATURE(kNtpOutlookCalendarModule,
"NtpOutlookCalendarModule",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, Google Photos module will be shown.
BASE_FEATURE(kNtpPhotosModule,
"NtpPhotosModule",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, a customized title will be shown on the opt-in card.
BASE_FEATURE(kNtpPhotosModuleCustomizedOptInTitle,
"NtpPhotosModuleCustomizedOptInTitle",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, a customized art work will be shown on the opt-in card.
BASE_FEATURE(kNtpPhotosModuleCustomizedOptInArtWork,
"NtpPhotosModuleCustomizedOptInArtWork",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, Google Photos opt-in card will show a button to soft opt-out.
BASE_FEATURE(kNtpPhotosModuleSoftOptOut,
"NtpPhotosModuleSoftOptOut",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, the single svg image show in Photos opt-in screen will be
// replaced by constituent images to support i18n.
BASE_FEATURE(kNtpPhotosModuleSplitSvgOptInArtWork,
"NtpPhotosModuleSplitSvgOptInArtWork",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, Following Feed module will be shown.
BASE_FEATURE(kNtpFeedModule,
"NtpFeedModule",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, SafeBrowsing module will be shown to a target user.
BASE_FEATURE(kNtpSafeBrowsingModule,
"NtpSafeBrowsingModule",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, sharepoint module will be shown.
BASE_FEATURE(kNtpSharepointModule,
"NtpSharepointModule",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, shortcuts will be shown.
// This is a kill switch. Keep indefinitely.
BASE_FEATURE(kNtpShortcuts, "NtpShortcuts", base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, the Tab Resumption module will be shown.
BASE_FEATURE(kNtpMostRelevantTabResumptionModule,
"NtpMostRelevantTabResumptionModule",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, the Tab Resumption module will be allowed to fallback to the
// favicon server when fetching favicons for displayed continuation suggestions.
BASE_FEATURE(kNtpMostRelevantTabResumptionAllowFaviconServerFallback,
"NtpMostRelevantTabResumptionAllowFaviconServerFallback",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, the Tab Resumption module will fallback to host url to find a
// favicon if there are none locally available.
BASE_FEATURE(kNtpMostRelevantTabResumptionModuleFallbackToHost,
"NtpMostRelevantTabResumptionModuleFallbackToHost",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kNtpTabResumptionModuleCategories,
"NtpTabResumptionModuleCategories",
base::FEATURE_DISABLED_BY_DEFAULT);
// Dummy feature to set how recent tabs must be to be shown.
BASE_FEATURE(kNtpTabResumptionModuleTimeLimit,
"NtpTabResumptionModuleTimeLimit",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, shows entry point on New Tab Page for Customize Chrome Side Panel
// Wallpaper Search.
BASE_FEATURE(kNtpWallpaperSearchButton,
"NtpWallpaperSearchButton",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, animates New Tab Page's Wallpaper Search Button.
BASE_FEATURE(kNtpWallpaperSearchButtonAnimation,
"NtpWallpaperSearchButtonAnimation",
base::FEATURE_DISABLED_BY_DEFAULT);
// Dummy feature to set param "NtpWallpaperSearchButtonHideCondition".
// This is used for an emergency Finch param. Keep indefinitely.
BASE_FEATURE(kNtpWallpaperSearchButtonHideCondition,
"NtpWallpaperSearchButtonHideCondition",
base::FEATURE_DISABLED_BY_DEFAULT);
// Dummy feature to set param "NtpWallpaperSearchButtonAnimationShownThreshold".
// This is used for an emergency Finch param. Keep indefinitely.
BASE_FEATURE(kNtpWallpaperSearchButtonAnimationShownThreshold,
"NtpWallpaperSearchButtonAnimationShownThreshold",
base::FEATURE_DISABLED_BY_DEFAULT);
// Feature to control the display of a mobile promo on the NTP.
BASE_FEATURE(kNtpMobilePromo,
"NtpMobilePromo",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, the Microsoft Authentication module will be shown.
BASE_FEATURE(kNtpMicrosoftAuthenticationModule,
"NtpMicrosoftAuthenticationModule",
base::FEATURE_ENABLED_BY_DEFAULT);
// If enabled, the OGB loader will request for the async bar parts payload type.
BASE_FEATURE(kNtpOneGoogleBarAsyncBarParts,
"NtpOneGoogleBarAsyncBarParts",
base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, a footer will show on the NTP.
BASE_FEATURE(kNtpFooter, "NtpFooter", base::FEATURE_DISABLED_BY_DEFAULT);
const char kNtpModuleIgnoredCriteriaThreshold[] =
"NtpModuleIgnoredCriteriaThreshold";
const char kNtpModuleIgnoredHaTSDelayTimeParam[] =
"NtpModuleIgnoredHaTSDelayTimeParam";
const char kNtpModulesEligibleForHappinessTrackingSurveyParam[] =
"NtpModulesEligibleForHappinessTrackingSurveyParam";
const char kNtpModulesInteractionBasedSurveyEligibleIdsParam[] =
"NtpModulesInteractionBasedSurveyEligibleIdsParam";
const char kNtpModulesLoadTimeoutMillisecondsParam[] =
"NtpModulesLoadTimeoutMillisecondsParam";
const char kNtpModulesLoadedWithOtherModulesMaxInstanceCountParam[] =
"NtpModulesLoadedWithOtherModulesMaxInstanceCountParam";
const char kNtpModulesMaxColumnCountParam[] = "NtpModulesMaxColumnCountParam";
const char kNtpModulesOrderParam[] = "NtpModulesOrderParam";
const char kNtpCalendarModuleDataParam[] = "NtpCalendarModuleDataParam";
const char kNtpChromeCartModuleDataParam[] = "NtpChromeCartModuleDataParam";
const char kNtpChromeCartModuleAbandonedCartDiscountParam[] =
"NtpChromeCartModuleAbandonedCartDiscountParam";
const char kNtpChromeCartModuleAbandonedCartDiscountUseUtmParam[] =
"NtpChromeCartModuleAbandonedCartDiscountUseUtmParam";
const char kNtpChromeCartModuleHeuristicsImprovementParam[] =
"NtpChromeCartModuleHeuristicsImprovementParam";
const char kNtpChromeCartModuleCouponParam[] = "NtpChromeCartModuleCouponParam";
const char kNtpDriveModuleDataParam[] = "NtpDriveModuleDataParam";
const char kNtpDriveModuleManagedUsersOnlyParam[] =
"NtpDriveModuleManagedUsersOnlyParam";
const char kNtpDriveModuleCacheMaxAgeSParam[] =
"NtpDriveModuleCacheMaxAgeSParam";
const char kNtpDriveModuleExperimentGroupParam[] =
"NtpDriveModuleExperimentGroupParam";
const char kNtpOutlookCalendarModuleDataParam[] =
"NtpOutlookCalendarModuleDataParam";
const char kNtpMiddleSlotPromoDismissalParam[] =
"NtpMiddleSlotPromoDismissalParam";
const char kNtpPhotosModuleDataParam[] = "NtpPhotosModuleDataParam";
const char kNtpPhotosModuleOptInTitleParam[] = "NtpPhotosModuleOptInTitleParam";
const char kNtpPhotosModuleOptInArtWorkParam[] =
"NtpPhotosModuleOptInArtWorkParam";
const char kNtpSafeBrowsingModuleCooldownPeriodDaysParam[] =
"NtpSafeBrowsingModuleCooldownPeriodDaysParam";
const char kNtpSafeBrowsingModuleCountMaxParam[] =
"NtpSafeBrowsingModuleCountMaxParam";
const char kNtpMostRelevantTabResumptionModuleDataParam[] =
"NtpMostRelevantTabResumptionModuleDataParam";
const char kNtpMostRelevantTabResumptionModuleMaxVisitsParam[] =
"NtpMostRelevantTabResumptionModuleMaxVisitsParam";
const char kNtpTabResumptionModuleCategoriesBlocklistParam[] =
"NtpTabResumptionModuleCategoriesBlocklistParam";
const char kNtpTabResumptionModuleDismissalDurationParam[] =
"NtpMostRelevantTabResumptionModuleDismissalDurationParam";
const char kNtpTabResumptionModuleDataParam[] =
"NtpTabResumptionModuleDataParam";
const char kNtpTabResumptionModuleResultTypesParam[] =
"NtpTabResumptionModuleResultTypesParam";
const char kNtpTabResumptionModuleTimeLimitParam[] =
"NtpTabResumptionModuleTimeLimitParam";
const char kNtpTabResumptionModuleVisibilityThresholdDataParam[] =
"NtpTabResumptionModuleVisibilityThresholdDataParam";
const char kNtpWallpaperSearchButtonHideConditionParam[] =
"NtpWallpaperSearchButtonHideConditionParam";
const char kNtpWallpaperSearchButtonAnimationShownThresholdParam[] =
"NtpWallpaperSearchButtonAnimationShownThresholdParam";
const char kWallpaperSearchHatsDelayParam[] = "WallpaperSearchHatsDelayParam";
const char kNtpMobilePromoTargetUrlParam[] = "NtpMobilePromoTargetUrlParam";
const base::FeatureParam<std::string> kNtpCalendarModuleExperimentParam(
&ntp_features::kNtpCalendarModule,
"NtpCalendarModuleMaxExperimentParam",
"ntp-calendar");
const base::FeatureParam<int> kNtpCalendarModuleMaxEventsParam(
&ntp_features::kNtpCalendarModule,
"NtpCalendarModuleMaxEventsParam",
5);
const base::FeatureParam<base::TimeDelta> kNtpCalendarModuleWindowEndDeltaParam(
&ntp_features::kNtpCalendarModule,
"NtpCalendarModuleWindowEndDeltaParam",
base::Hours(12));
const base::FeatureParam<base::TimeDelta>
kNtpCalendarModuleWindowStartDeltaParam(
&ntp_features::kNtpCalendarModule,
"NtpCalendarModuleWindowStartDeltaParam",
base::Minutes(-15));
const base::FeatureParam<bool> kNtpOutlookCalendarModuleAttachmentCheckParam(
&ntp_features::kNtpOutlookCalendarModule,
"NtpOutlookCalendarModuleAttachmentCheckParam",
true);
extern const base::FeatureParam<bool>
kNtpOutlookCalendarModuleDisableAttachmentsParam(
&ntp_features::kNtpOutlookCalendarModule,
"NtpOutlookCalendarModuleDisableAttachmentsParam",
false);
const base::FeatureParam<int> kNtpOutlookCalendarModuleMaxEventsParam(
&ntp_features::kNtpOutlookCalendarModule,
"NtpOutlookCalendarModuleMaxEventsParam",
5);
const base::FeatureParam<base::TimeDelta>
kNtpOutlookCalendarModuleRetrievalWindowParam(
&ntp_features::kNtpOutlookCalendarModule,
"NtpOutlookCalendarModuleRetrievalWindowParam",
base::Hours(12));
const base::FeatureParam<bool> kNtpRealboxCr23ExpandedStateBgMatchesOmnibox(
&ntp_features::kRealboxCr23Theming,
"kNtpRealboxCr23ExpandedStateBgMatchesOmnibox",
true);
const base::FeatureParam<bool> kNtpRealboxCr23SteadyStateShadow(
&ntp_features::kRealboxCr23Theming,
"kNtpRealboxCr23SteadyStateShadow",
false);
const base::FeatureParam<int> kNtpMobilePromoImpressionLimit(
&ntp_features::kNtpMobilePromo,
"kNtpMobilePromoImpressionLimit",
10);
const base::FeatureParam<bool>
kNtpMostRelevantTabResumptionModuleFilterLocalTabsParam{
&kNtpMostRelevantTabResumptionModule,
/*name=*/"local_tab_filter",
/*default_value=*/true};
const base::FeatureParam<NtpSharepointModuleDataType>::Option
kNtpSharepointModuleDataTypeOptions[] = {
{NtpSharepointModuleDataType::kTrendingInsights, "trending-insights"},
{NtpSharepointModuleDataType::kNonInsights, "non-insights"},
{NtpSharepointModuleDataType::kTrendingInsightsFakeData,
"fake-trending"},
{NtpSharepointModuleDataType::kNonInsightsFakeData,
"fake-non-insights"},
{NtpSharepointModuleDataType::kCombinedSuggestions, "combined"}};
const base::FeatureParam<NtpSharepointModuleDataType>
kNtpSharepointModuleDataParam{&ntp_features::kNtpSharepointModule,
"NtpSharepointModuleDataParam",
NtpSharepointModuleDataType::kNonInsights,
&kNtpSharepointModuleDataTypeOptions};
const base::FeatureParam<int> kNtpMicrosoftFilesModuleMaxFilesParam(
&ntp_features::kNtpSharepointModule,
"NtpMicrosoftFilesModuleMaxFilesParam",
6);
const base::FeatureParam<int>
kNtpMicrosoftFilesModuleMaxTrendingFilesForCombinedParam(
&ntp_features::kNtpSharepointModule,
"NtpMicrosoftFilesModuleMaxTrendingFilesForCombinedParam",
2);
const base::FeatureParam<int>
kNtpMicrosoftFilesModuleMaxNonInsightsFilesForCombinedParam(
&ntp_features::kNtpSharepointModule,
"NtpMicrosoftFilesModuleMaxNonInsightsFilesForCombinedParam",
4);
base::TimeDelta GetModulesLoadTimeout() {
std::string param_value = base::GetFieldTrialParamValueByFeature(
kNtpModulesLoadTimeoutMilliseconds,
kNtpModulesLoadTimeoutMillisecondsParam);
// If the field trial param is not found or cannot be parsed to an unsigned
// integer, return the default value.
unsigned int param_value_as_int = 0;
if (!base::StringToUint(param_value, ¶m_value_as_int)) {
return base::Seconds(3);
}
return base::Milliseconds(param_value_as_int);
}
int GetModulesMaxColumnCount() {
return base::GetFieldTrialParamByFeatureAsInt(
kNtpModulesMaxColumnCount, kNtpModulesMaxColumnCountParam, 3);
}
int GetMultipleLoadedModulesMaxModuleInstanceCount() {
return base::GetFieldTrialParamByFeatureAsInt(
kNtpModulesLoadedWithOtherModulesMaxInstanceCount,
kNtpModulesLoadedWithOtherModulesMaxInstanceCountParam, 2);
}
std::vector<std::string> GetModulesOrder() {
return base::SplitString(base::GetFieldTrialParamValueByFeature(
kNtpModulesOrder, kNtpModulesOrderParam),
",:;", base::WhitespaceHandling::TRIM_WHITESPACE,
base::SplitResult::SPLIT_WANT_NONEMPTY);
}
int GetWallpaperSearchButtonAnimationShownThreshold() {
return base::GetFieldTrialParamByFeatureAsInt(
kNtpWallpaperSearchButtonAnimationShownThreshold,
kNtpWallpaperSearchButtonAnimationShownThresholdParam, 15);
}
int GetWallpaperSearchButtonHideCondition() {
return base::GetFieldTrialParamByFeatureAsInt(
kNtpWallpaperSearchButtonHideCondition,
kNtpWallpaperSearchButtonHideConditionParam, 2);
}
std::string GetMobilePromoTargetURL() {
std::string field_trial_url = base::GetFieldTrialParamValueByFeature(
ntp_features::kNtpMobilePromo,
ntp_features::kNtpMobilePromoTargetUrlParam);
return (field_trial_url.empty()) ? kMobilePromoQRCodeURL : field_trial_url;
}
} // namespace ntp_features
|