blob: 8b6ee7c85257b8178326e8812a02c8b2e2952cfe [file] [log] [blame]
sdefresne14900ee2015-11-27 14:43:211// Copyright 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Implementation of about_flags for iOS that sets flags based on experimental
6// settings.
7
Nazerke9c259052019-06-26 15:30:108#include "ios/chrome/browser/flags/about_flags.h"
sdefresne14900ee2015-11-27 14:43:219
Nazerke9c259052019-06-26 15:30:1010#import <UIKit/UIKit.h>
avi571943672015-12-22 02:12:4911#include <stddef.h>
12#include <stdint.h>
sdefresne14900ee2015-11-27 14:43:2113
Gregory Chatzinofff6523722017-11-21 01:33:5314#include "base/base_switches.h"
sdefresne14900ee2015-11-27 14:43:2115#include "base/bind.h"
danakjdb9ae7942020-11-11 16:01:3516#include "base/callback_helpers.h"
Hans Wennborg3a2fb61f2020-05-11 15:51:1617#include "base/check_op.h"
David Jean5ca263c2021-08-18 09:19:3018#import "base/mac/foundation_util.h"
Sylvain Defresne8327a2f2019-01-17 14:19:1819#include "base/no_destructor.h"
sdefresne14900ee2015-11-27 14:43:2120#include "base/strings/stringprintf.h"
21#include "base/strings/sys_string_conversions.h"
Sebastien Marchand75a7cdf2018-11-13 23:47:0322#include "base/system/sys_info.h"
Mohamad Ahmadic4df81f2017-12-20 04:41:5923#include "components/autofill/core/common/autofill_features.h"
Jared Sauld998539f2019-03-19 15:11:1724#include "components/autofill/core/common/autofill_payments_features.h"
Moe Ahmadid6d5d172018-06-20 17:20:2325#include "components/autofill/core/common/autofill_switches.h"
Olivier Robin3d60411622018-02-23 10:03:2226#include "components/autofill/ios/browser/autofill_switches.h"
Jesse McKenna85c1a59f2021-05-05 19:08:3027#include "components/breadcrumbs/core/features.h"
Matt Jones125dfb42022-02-11 17:23:4228#include "components/commerce/core/commerce_feature_list.h"
29#include "components/commerce/core/flag_descriptions.h"
Robbie Gibson5e3436632020-04-27 15:48:0430#include "components/content_settings/core/common/features.h"
sdefresne14900ee2015-11-27 14:43:2131#include "components/dom_distiller/core/dom_distiller_switches.h"
Guillaume Jenkins4e6ac1e2020-11-11 16:57:4032#include "components/enterprise/browser/enterprise_switches.h"
Tommy Nyquistc1d6dea12017-07-26 20:37:2333#include "components/feature_engagement/public/feature_constants.h"
34#include "components/feature_engagement/public/feature_list.h"
edchind847c0962021-03-03 18:17:0535#include "components/feed/feed_feature_list.h"
sdefresne14900ee2015-11-27 14:43:2136#include "components/flags_ui/feature_entry.h"
37#include "components/flags_ui/feature_entry_macros.h"
38#include "components/flags_ui/flags_storage.h"
39#include "components/flags_ui/flags_ui_switches.h"
Tanja Gornakb0985dd2018-10-11 17:24:4040#include "components/invalidation/impl/invalidation_switches.h"
noyau4cfb1332016-10-25 17:05:4241#include "components/ntp_tiles/switches.h"
Justin Donnelly33d712e2017-08-23 21:32:5142#include "components/omnibox/browser/omnibox_field_trial.h"
Tomasz Wiszkowskid938a1112019-03-06 18:01:5743#include "components/omnibox/common/omnibox_features.h"
Raj T3898f032021-08-19 23:51:2744#include "components/optimization_guide/core/optimization_guide_features.h"
Ioana Pandeled14ce9e2017-11-28 14:41:4645#include "components/password_manager/core/common/password_manager_features.h"
mathp9b4c11d2017-07-06 20:24:1346#include "components/payments/core/features.h"
Guillaume Jenkinseeb7007c2020-06-25 22:55:4047#import "components/policy/core/common/policy_loader_ios_constants.h"
48#include "components/policy/policy_constants.h"
Joemer Ramos34175732022-02-14 18:59:1649#include "components/safe_browsing/core/common/features.h"
Victor Hugo Vianna Silva0399402f2021-09-07 21:41:2550#import "components/send_tab_to_self/features.h"
Tommy Martino0caf3362021-01-13 20:29:5851#include "components/shared_highlighting/core/common/shared_highlighting_features.h"
Valeriya Sinevicha79dc612018-09-25 14:49:0952#include "components/signin/core/browser/account_reconcilor.h"
Jérôme Lebelc374fdd2019-09-27 10:36:4853#include "components/signin/ios/browser/features.h"
Colin Blundell3517170e2019-07-11 08:16:3454#include "components/signin/public/base/signin_switches.h"
sdefresne36579782016-02-05 11:08:2555#include "components/strings/grit/components_strings.h"
Victor Hugo Vianna Silvaa48aa01c2022-02-09 20:38:2356#include "components/sync/base/command_line_switches.h"
57#include "components/sync/base/features.h"
Ewann570a6302021-08-17 07:22:4258#include "components/sync/base/pref_names.h"
Moe Ahmadie4cce1f2018-12-18 23:48:0159#include "components/translate/core/browser/translate_prefs.h"
Olivier Robinffe767c2022-04-21 13:13:2360#include "components/translate/core/common/translate_util.h"
Sylvain Defresneae6987e2018-03-01 13:21:4061#include "ios/chrome/browser/browsing_data/browsing_data_features.h"
sdefresne14900ee2015-11-27 14:43:2162#include "ios/chrome/browser/chrome_switches.h"
Eugene But2823dc7e2020-07-21 18:10:3763#include "ios/chrome/browser/crash_report/features.h"
Nazerke21bdc45a2019-07-11 09:02:0564#include "ios/chrome/browser/flags/ios_chrome_flag_descriptions.h"
Ed Chin100660bf2022-04-26 16:59:1365#import "ios/chrome/browser/ntp/features.h"
Vincent Boisselled042d552022-04-09 01:22:5966#include "ios/chrome/browser/policy/cloud/user_policy_switch.h"
Vincent Boisselle19200bc2021-09-01 17:58:2567#include "ios/chrome/browser/policy/policy_util.h"
Sylvain Defresne9c107082020-10-27 16:39:1368#include "ios/chrome/browser/screen_time/screen_time_buildflags.h"
Olivier Robin3a957df2021-12-21 18:04:3469#import "ios/chrome/browser/sessions/session_features.h"
Gauthier Ambard33e03302019-02-21 13:28:5870#include "ios/chrome/browser/system_flags.h"
Louis Romeroac04f786a2022-04-19 09:39:3071#include "ios/chrome/browser/ui/bubble/bubble_features.h"
adamta22a4d502020-05-21 03:12:2172#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h"
Javier Ernesto Flores Robles209b2822021-03-25 19:16:5073#import "ios/chrome/browser/ui/default_promo/default_browser_utils.h"
Ewann1a9d33d2021-06-14 11:12:2474#import "ios/chrome/browser/ui/download/features.h"
Aliona DANGLAebfd7d022021-10-08 14:15:4575#include "ios/chrome/browser/ui/first_run/fre_field_trial.h"
Kurt Horimoto4da682b022018-04-12 07:43:3576#import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
adamta273568472020-12-04 23:53:5777#import "ios/chrome/browser/ui/ntp/new_tab_page_feature.h"
Christian Xub8c06cd2022-04-29 20:55:0178#import "ios/chrome/browser/ui/omnibox/omnibox_ui_features.h"
Tina Wang17514e2f2021-09-24 23:57:1879#import "ios/chrome/browser/ui/overlays/infobar_banner/infobar_banner_features.h"
Robbie Gibson686c56732021-10-04 17:11:4580#import "ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.h"
gogerald0ff29e52021-02-03 18:56:1981#import "ios/chrome/browser/ui/start_surface/start_surface_features.h"
Petro Akzhygitove5ee4a882022-05-04 09:19:3782#import "ios/chrome/browser/ui/sync/utils/features.h"
Nazerke0bf10c42020-11-12 11:17:3283#import "ios/chrome/browser/ui/tab_switcher/tab_grid/features.h"
Kurt Horimoto79d590b2018-09-12 19:09:2884#import "ios/chrome/browser/ui/toolbar_container/toolbar_container_features.h"
Justin Cohen2d81c582018-01-22 14:46:4485#include "ios/chrome/browser/ui/ui_feature_flags.h"
Louis Romerofbfbd932022-04-15 18:04:5086#include "ios/chrome/browser/ui/util/features.h"
Yi Su392b3032018-06-05 07:26:4787#include "ios/chrome/browser/web/features.h"
sdefresne14900ee2015-11-27 14:43:2188#include "ios/chrome/grit/ios_strings.h"
Mustafa Emre Acer4de8863a2022-05-03 22:17:0189#include "ios/components/security_interstitials/https_only_mode/feature.h"
Sylvain Defresne559ce5f2022-01-13 17:14:5890#include "ios/public/provider/chrome/browser/app_utils/app_utils_api.h"
Eugene But61818bc2019-04-15 21:04:0791#include "ios/web/common/features.h"
Eugene Bute79f2742019-07-26 17:07:2292#include "ios/web/common/user_agent.h"
Eugene Butb1416232019-07-22 17:31:5893#include "ios/web/common/web_view_creation_util.h"
sdefresne14900ee2015-11-27 14:43:2194
Sylvain Defresne9c107082020-10-27 16:39:1395#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
96#include "ios/chrome/browser/screen_time/features.h"
97#endif
98
sdefresne14900ee2015-11-27 14:43:2199#if !defined(OFFICIAL_BUILD)
100#include "components/variations/variations_switches.h"
vitaliii489217aa2017-01-30 14:50:22101#endif
stkhapuginc1be1792016-12-13 14:30:53102
103#if !defined(__has_feature) || !__has_feature(objc_arc)
104#error "This file requires ARC support."
105#endif
sdefresne14900ee2015-11-27 14:43:21106
elawrence816f6790e2017-06-16 18:19:28107using flags_ui::FeatureEntry;
108
sdefresne14900ee2015-11-27 14:43:21109namespace {
Emily Starkbafa9062017-12-27 15:22:46110
Olivier Robin3d60411622018-02-23 10:03:22111const FeatureEntry::Choice kAutofillIOSDelayBetweenFieldsChoices[] = {
112 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
113 {"0", autofill::switches::kAutofillIOSDelayBetweenFields, "0"},
114 {"10", autofill::switches::kAutofillIOSDelayBetweenFields, "10"},
115 {"20", autofill::switches::kAutofillIOSDelayBetweenFields, "20"},
116 {"50", autofill::switches::kAutofillIOSDelayBetweenFields, "50"},
117 {"100", autofill::switches::kAutofillIOSDelayBetweenFields, "100"},
118 {"200", autofill::switches::kAutofillIOSDelayBetweenFields, "200"},
119 {"500", autofill::switches::kAutofillIOSDelayBetweenFields, "500"},
120 {"1000", autofill::switches::kAutofillIOSDelayBetweenFields, "1000"},
121};
122
Nohemi Fernandez222d6d42020-09-30 20:35:57123const FeatureEntry::Choice kDelayThresholdMinutesToUpdateGaiaCookieChoices[] = {
124 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
125 {"0", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "0"},
126 {"10", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "10"},
127 {"60", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "60"},
128};
129
Nohemi Fernandezc00842a2021-07-26 11:47:34130const FeatureEntry::Choice
131 kWaitThresholdMillisecondsForCapabilitiesApiChoices[] = {
132 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
133 {"200", signin::kWaitThresholdMillisecondsForCapabilitiesApi, "200"},
134 {"500", signin::kWaitThresholdMillisecondsForCapabilitiesApi, "500"},
135 {"5000", signin::kWaitThresholdMillisecondsForCapabilitiesApi, "5000"},
136};
137
Stepan Khapugincc4e9842019-01-23 13:38:13138const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches3[] = {
139 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "3"}};
140const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches4[] = {
141 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "4"}};
142const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches5[] = {
143 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "5"}};
144const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches6[] = {
145 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "6"}};
146const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches8[] = {
147 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "8"}};
148const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches10[] = {
149 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "10"}};
150const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches12[] = {
151 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "12"}};
152
153const FeatureEntry::FeatureVariation
154 kOmniboxUIMaxAutocompleteMatchesVariations[] = {
155 {"3 matches", kOmniboxUIMaxAutocompleteMatches3,
Daniel Cheng1f047a82022-02-26 10:04:53156 std::size(kOmniboxUIMaxAutocompleteMatches3), nullptr},
Stepan Khapugincc4e9842019-01-23 13:38:13157 {"4 matches", kOmniboxUIMaxAutocompleteMatches4,
Daniel Cheng1f047a82022-02-26 10:04:53158 std::size(kOmniboxUIMaxAutocompleteMatches4), nullptr},
Stepan Khapugincc4e9842019-01-23 13:38:13159 {"5 matches", kOmniboxUIMaxAutocompleteMatches5,
Daniel Cheng1f047a82022-02-26 10:04:53160 std::size(kOmniboxUIMaxAutocompleteMatches5), nullptr},
Stepan Khapugincc4e9842019-01-23 13:38:13161 {"6 matches", kOmniboxUIMaxAutocompleteMatches6,
Daniel Cheng1f047a82022-02-26 10:04:53162 std::size(kOmniboxUIMaxAutocompleteMatches6), nullptr},
Stepan Khapugincc4e9842019-01-23 13:38:13163 {"8 matches", kOmniboxUIMaxAutocompleteMatches8,
Daniel Cheng1f047a82022-02-26 10:04:53164 std::size(kOmniboxUIMaxAutocompleteMatches8), nullptr},
Stepan Khapugincc4e9842019-01-23 13:38:13165 {"10 matches", kOmniboxUIMaxAutocompleteMatches10,
Daniel Cheng1f047a82022-02-26 10:04:53166 std::size(kOmniboxUIMaxAutocompleteMatches10), nullptr},
Stepan Khapugincc4e9842019-01-23 13:38:13167 {"12 matches", kOmniboxUIMaxAutocompleteMatches12,
Daniel Cheng1f047a82022-02-26 10:04:53168 std::size(kOmniboxUIMaxAutocompleteMatches12), nullptr}};
Stepan Khapugincc4e9842019-01-23 13:38:13169
Stepan Khapuginbac467e2022-05-06 21:11:54170const FeatureEntry::FeatureParam kOmniboxMaxZPSMatches6[] = {
171 {OmniboxFieldTrial::kMaxZeroSuggestMatchesParam, "6"}};
172const FeatureEntry::FeatureParam kOmniboxMaxZPSMatches15[] = {
173 {OmniboxFieldTrial::kMaxZeroSuggestMatchesParam, "15"}};
174const FeatureEntry::FeatureParam kOmniboxMaxZPSMatches20[] = {
175 {OmniboxFieldTrial::kMaxZeroSuggestMatchesParam, "20"}};
176
177const FeatureEntry::FeatureVariation kOmniboxMaxZPSMatchesVariations[] = {
178 {"6 matches", kOmniboxMaxZPSMatches6, std::size(kOmniboxMaxZPSMatches6),
179 nullptr},
180 {"15 matches", kOmniboxMaxZPSMatches15, std::size(kOmniboxMaxZPSMatches15),
181 nullptr},
182 {"20 matches", kOmniboxMaxZPSMatches20, std::size(kOmniboxMaxZPSMatches20),
183 nullptr},
184};
185
Caitlin Fischer37e01232019-05-24 13:05:45186const FeatureEntry::FeatureParam
187 kAutofillUseMobileLabelDisambiguationShowAll[] = {
188 {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName,
189 autofill::features::
190 kAutofillUseMobileLabelDisambiguationParameterShowAll}};
191const FeatureEntry::FeatureParam
192 kAutofillUseMobileLabelDisambiguationShowOne[] = {
193 {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName,
194 autofill::features::
195 kAutofillUseMobileLabelDisambiguationParameterShowOne}};
196
197const FeatureEntry::FeatureVariation
198 kAutofillUseMobileLabelDisambiguationVariations[] = {
199 {"(show all)", kAutofillUseMobileLabelDisambiguationShowAll,
Daniel Cheng1f047a82022-02-26 10:04:53200 std::size(kAutofillUseMobileLabelDisambiguationShowAll), nullptr},
Caitlin Fischer37e01232019-05-24 13:05:45201 {"(show one)", kAutofillUseMobileLabelDisambiguationShowOne,
Daniel Cheng1f047a82022-02-26 10:04:53202 std::size(kAutofillUseMobileLabelDisambiguationShowOne), nullptr}};
Caitlin Fischer37e01232019-05-24 13:05:45203
Javier Ernesto Flores Roblese85f4a12021-02-23 18:10:10204const FeatureEntry::FeatureParam
Javier Ernesto Flores Robles159414232021-06-16 14:29:59205 kDefaultBrowserFullscreenPromoExperimentRemindMeLater[] = {
206 {kDefaultBrowserFullscreenPromoExperimentRemindMeGroupParam, "true"}};
207const FeatureEntry::FeatureVariation
208 kDefaultBrowserFullscreenPromoExperimentVariations[] = {
209 {"Remind me later",
210 kDefaultBrowserFullscreenPromoExperimentRemindMeLater,
Daniel Cheng1f047a82022-02-26 10:04:53211 std::size(kDefaultBrowserFullscreenPromoExperimentRemindMeLater),
Javier Ernesto Flores Robles159414232021-06-16 14:29:59212 nullptr}};
213
gogeralddb0d8ae2020-11-13 03:56:58214const FeatureEntry::FeatureParam kDiscoverFeedInNtpEnableNativeUI[] = {
215 {kDiscoverFeedIsNativeUIEnabled, "true"}};
216const FeatureEntry::FeatureVariation kDiscoverFeedInNtpVariations[] = {
217 {"Native UI", kDiscoverFeedInNtpEnableNativeUI,
Daniel Cheng1f047a82022-02-26 10:04:53218 std::size(kDiscoverFeedInNtpEnableNativeUI), nullptr}};
gogeralddb0d8ae2020-11-13 03:56:58219
Sergio Collazos9fcc6ed2021-10-06 00:58:03220const FeatureEntry::FeatureParam kDiscoverFeedSRSReconstructedTemplates[] = {
221 {kDiscoverFeedSRSReconstructedTemplatesEnabled, "true"}};
222const FeatureEntry::FeatureParam kDiscoverFeedSRSPreloadTemplates[] = {
223 {kDiscoverFeedSRSPreloadTemplatesEnabled, "true"}};
224const FeatureEntry::FeatureVariation
225 kEnableDiscoverFeedStaticResourceServingVariations[] = {
226 {"Reconstruct Templates", kDiscoverFeedSRSReconstructedTemplates,
Daniel Cheng1f047a82022-02-26 10:04:53227 std::size(kDiscoverFeedSRSReconstructedTemplates), nullptr},
Sergio Collazos9fcc6ed2021-10-06 00:58:03228 {"Preload Templates", kDiscoverFeedSRSPreloadTemplates,
Daniel Cheng1f047a82022-02-26 10:04:53229 std::size(kDiscoverFeedSRSPreloadTemplates), nullptr},
Sergio Collazos9fcc6ed2021-10-06 00:58:03230};
231
Mohammad Refaatab6bee62022-05-16 16:31:15232const FeatureEntry::FeatureParam kDiscoverFeedTopSyncPromoFullWithTitle[] = {
233 {kDiscoverFeedTopSyncPromoStyleParam,
234 kDiscoverFeedTopSyncPromoStyleFullWithTitle}};
235const FeatureEntry::FeatureParam kDiscoverFeedTopSyncPromoCompact[] = {
236 {kDiscoverFeedTopSyncPromoStyleParam,
237 kDiscoverFeedTopSyncPromoStyleCompact}};
238const FeatureEntry::FeatureVariation kDiscoverFeedTopSyncPromoVariations[] = {
239 {"Full with title", kDiscoverFeedTopSyncPromoFullWithTitle,
240 std::size(kDiscoverFeedTopSyncPromoFullWithTitle), nullptr},
241 {"Compact", kDiscoverFeedTopSyncPromoCompact,
242 std::size(kDiscoverFeedTopSyncPromoCompact), nullptr}};
243
Robbie Gibson46351032022-03-31 19:46:23244const FeatureEntry::FeatureParam kiOSOmniboxUpdatedPopupUIVersion1[] = {
245 {kIOSOmniboxUpdatedPopupUIVariationName,
246 kIOSOmniboxUpdatedPopupUIVariation1}};
247const FeatureEntry::FeatureParam kiOSOmniboxUpdatedPopupUIVersion2[] = {
248 {kIOSOmniboxUpdatedPopupUIVariationName,
249 kIOSOmniboxUpdatedPopupUIVariation2}};
250const FeatureEntry::FeatureVariation kiOSOmniboxUpdatedPopupUIVariations[] = {
251 {"Version 1", kiOSOmniboxUpdatedPopupUIVersion1,
252 std::size(kiOSOmniboxUpdatedPopupUIVersion1), nullptr},
253 {"Version 2", kiOSOmniboxUpdatedPopupUIVersion2,
254 std::size(kiOSOmniboxUpdatedPopupUIVersion2), nullptr}};
255
gogerald53c6e7a2021-04-15 22:07:35256const FeatureEntry::FeatureParam kStartSurfaceTenSecondsShrinkLogo[] = {
Chris Lu5470417c2021-03-03 18:43:08257 {kStartSurfaceShrinkLogoParam, "true"},
gogerald53c6e7a2021-04-15 22:07:35258 {kReturnToStartSurfaceInactiveDurationInSeconds, "10"}};
259const FeatureEntry::FeatureParam kStartSurfaceTenSecondsHideShortcuts[] = {
Chris Lu5470417c2021-03-03 18:43:08260 {kStartSurfaceHideShortcutsParam, "true"},
gogerald53c6e7a2021-04-15 22:07:35261 {kReturnToStartSurfaceInactiveDurationInSeconds, "10"}};
262const FeatureEntry::FeatureParam kStartSurfaceTenSecondsReturnToRecentTab[] = {
Chris Lu5470417c2021-03-03 18:43:08263 {kStartSurfaceReturnToRecentTabParam, "true"},
gogerald53c6e7a2021-04-15 22:07:35264 {kReturnToStartSurfaceInactiveDurationInSeconds, "10"}};
265const FeatureEntry::FeatureParam
266 kStartSurfaceTenSecondsShrinkLogoReturnToRecentTab[] = {
267 {kStartSurfaceShrinkLogoParam, "true"},
268 {kStartSurfaceReturnToRecentTabParam, "true"},
269 {kReturnToStartSurfaceInactiveDurationInSeconds, "10"}};
270const FeatureEntry::FeatureParam
271 kStartSurfaceTenSecondsHideShortcutsReturnToRecentTab[] = {
272 {kStartSurfaceHideShortcutsParam, "true"},
273 {kStartSurfaceReturnToRecentTabParam, "true"},
274 {kReturnToStartSurfaceInactiveDurationInSeconds, "10"}};
275const FeatureEntry::FeatureParam kStartSurfaceOneHourShrinkLogo[] = {
Chris Lu5470417c2021-03-03 18:43:08276 {kStartSurfaceShrinkLogoParam, "true"},
gogerald53c6e7a2021-04-15 22:07:35277 {kReturnToStartSurfaceInactiveDurationInSeconds, "3600"}};
278const FeatureEntry::FeatureParam kStartSurfaceOneHourHideShortcuts[] = {
279 {kStartSurfaceHideShortcutsParam, "true"},
280 {kReturnToStartSurfaceInactiveDurationInSeconds, "3600"}};
281const FeatureEntry::FeatureParam kStartSurfaceOneHourReturnToRecentTab[] = {
Chris Lu5470417c2021-03-03 18:43:08282 {kStartSurfaceReturnToRecentTabParam, "true"},
gogerald53c6e7a2021-04-15 22:07:35283 {kReturnToStartSurfaceInactiveDurationInSeconds, "3600"}};
284const FeatureEntry::FeatureParam
285 kStartSurfaceOneHourShrinkLogoReturnToRecentTab[] = {
286 {kStartSurfaceShrinkLogoParam, "true"},
287 {kStartSurfaceReturnToRecentTabParam, "true"},
288 {kReturnToStartSurfaceInactiveDurationInSeconds, "3600"}};
289const FeatureEntry::FeatureParam
290 kStartSurfaceOneHourHideShortcutsReturnToRecentTab[] = {
291 {kStartSurfaceHideShortcutsParam, "true"},
292 {kStartSurfaceReturnToRecentTabParam, "true"},
293 {kReturnToStartSurfaceInactiveDurationInSeconds, "3600"}};
Chris Lu5470417c2021-03-03 18:43:08294
gogerald0e39e3aa2021-02-10 18:41:23295const FeatureEntry::FeatureVariation kStartSurfaceVariations[] = {
gogerald53c6e7a2021-04-15 22:07:35296 {"10s:Show Return to Recent Tab tile",
297 kStartSurfaceTenSecondsReturnToRecentTab,
Daniel Cheng1f047a82022-02-26 10:04:53298 std::size(kStartSurfaceTenSecondsReturnToRecentTab), nullptr},
gogerald53c6e7a2021-04-15 22:07:35299 {"10s:Shrink Logo", kStartSurfaceTenSecondsShrinkLogo,
Daniel Cheng1f047a82022-02-26 10:04:53300 std::size(kStartSurfaceTenSecondsShrinkLogo), nullptr},
gogerald53c6e7a2021-04-15 22:07:35301 {"10s:Hide Shortcuts", kStartSurfaceTenSecondsHideShortcuts,
Daniel Cheng1f047a82022-02-26 10:04:53302 std::size(kStartSurfaceTenSecondsHideShortcuts), nullptr},
gogerald53c6e7a2021-04-15 22:07:35303 {"10s:Shrink Logo and show Return to Recent Tab tile",
304 kStartSurfaceTenSecondsShrinkLogoReturnToRecentTab,
Daniel Cheng1f047a82022-02-26 10:04:53305 std::size(kStartSurfaceTenSecondsShrinkLogoReturnToRecentTab), nullptr},
gogerald53c6e7a2021-04-15 22:07:35306 {"10s:Hide Shortcuts and show Return to Recent Tab tile",
307 kStartSurfaceTenSecondsHideShortcutsReturnToRecentTab,
Daniel Cheng1f047a82022-02-26 10:04:53308 std::size(kStartSurfaceTenSecondsHideShortcutsReturnToRecentTab), nullptr},
gogerald53c6e7a2021-04-15 22:07:35309 {"1h:Show Return to Recent Tab tile", kStartSurfaceOneHourReturnToRecentTab,
Daniel Cheng1f047a82022-02-26 10:04:53310 std::size(kStartSurfaceOneHourReturnToRecentTab), nullptr},
gogerald53c6e7a2021-04-15 22:07:35311 {"1h:Shrink Logo", kStartSurfaceOneHourShrinkLogo,
Daniel Cheng1f047a82022-02-26 10:04:53312 std::size(kStartSurfaceOneHourShrinkLogo), nullptr},
gogerald53c6e7a2021-04-15 22:07:35313 {"1h:Hide Shortcuts", kStartSurfaceOneHourHideShortcuts,
Daniel Cheng1f047a82022-02-26 10:04:53314 std::size(kStartSurfaceOneHourHideShortcuts), nullptr},
gogerald53c6e7a2021-04-15 22:07:35315 {"1h:Shrink Logo and show Return to Recent Tab tile",
316 kStartSurfaceOneHourShrinkLogoReturnToRecentTab,
Daniel Cheng1f047a82022-02-26 10:04:53317 std::size(kStartSurfaceOneHourShrinkLogoReturnToRecentTab), nullptr},
gogerald53c6e7a2021-04-15 22:07:35318 {"1h:Hide Shortcuts and show Return to Recent Tab tile",
319 kStartSurfaceOneHourHideShortcutsReturnToRecentTab,
Daniel Cheng1f047a82022-02-26 10:04:53320 std::size(kStartSurfaceOneHourHideShortcutsReturnToRecentTab), nullptr},
Chris Lu5470417c2021-03-03 18:43:08321};
gogerald0e39e3aa2021-02-10 18:41:23322
Justin Cohen273add92022-05-26 15:34:36323const FeatureEntry::FeatureParam kFREDefaultPromoTestingDefaultDelay[] = {
324 {kFREDefaultPromoTestingDefaultDelayParam, "true"}};
325const FeatureEntry::FeatureParam kFREDefaultPromoTestingOnly[] = {
326 {kFREDefaultPromoTestingOnlyParam, "true"}};
327const FeatureEntry::FeatureParam kFREDefaultPromoTestingShortDelay[] = {
328 {kFREDefaultPromoTestingShortDelayParam, "true"}};
329const FeatureEntry::FeatureVariation kFREDefaultPromoTestingVariations[] = {
Aliona DANGLA8fae66f02021-10-06 15:47:11330 {"Wait 14 days after FRE default browser promo",
Justin Cohen273add92022-05-26 15:34:36331 kFREDefaultPromoTestingDefaultDelay,
332 std::size(kFREDefaultPromoTestingDefaultDelay), nullptr},
333 {"FRE default browser promo only", kFREDefaultPromoTestingOnly,
334 std::size(kFREDefaultPromoTestingOnly), nullptr},
Aliona DANGLA8fae66f02021-10-06 15:47:11335 {"Wait 3 days after FRE default browser promo",
Justin Cohen273add92022-05-26 15:34:36336 kFREDefaultPromoTestingShortDelay,
337 std::size(kFREDefaultPromoTestingShortDelay), nullptr},
Aliona DANGLA8fae66f02021-10-06 15:47:11338};
339
jlebel041fc1c2022-03-04 12:53:30340const FeatureEntry::FeatureParam kNewMICEFREWithUMADialog[] = {
341 {kNewMobileIdentityConsistencyFREParam,
342 kNewMobileIdentityConsistencyFREParamUMADialog}};
343const FeatureEntry::FeatureParam kNewMICEFREWithThreeSteps[] = {
344 {kNewMobileIdentityConsistencyFREParam,
345 kNewMobileIdentityConsistencyFREParamThreeSteps}};
346const FeatureEntry::FeatureParam kNewMICEFREWithTwoSteps[] = {
347 {kNewMobileIdentityConsistencyFREParam,
348 kNewMobileIdentityConsistencyFREParamTwoSteps}};
349const FeatureEntry::FeatureVariation
350 kNewMobileIdentityConsistencyFREVariations[] = {
351 {"New FRE with UMA dialog", kNewMICEFREWithUMADialog,
352 std::size(kNewMICEFREWithUMADialog), nullptr},
353 {"new FRE with 3 steps", kNewMICEFREWithThreeSteps,
354 std::size(kNewMICEFREWithThreeSteps), nullptr},
355 {"new FRE with 2 steps", kNewMICEFREWithTwoSteps,
356 std::size(kNewMICEFREWithTwoSteps), nullptr}};
357
Louis Romero023cc5052022-04-08 23:29:39358const FeatureEntry::FeatureParam kBubbleRichIPHTargetHighlight[] = {
359 {kBubbleRichIPHParameterName, kBubbleRichIPHParameterTargetHighlight}};
Christian Xubd60c4b72022-03-22 15:25:01360const FeatureEntry::FeatureParam kBubbleRichIPHExplicitDismissal[] = {
361 {kBubbleRichIPHParameterName, kBubbleRichIPHParameterExplicitDismissal}};
362const FeatureEntry::FeatureParam kBubbleRichIPHRich[] = {
363 {kBubbleRichIPHParameterName, kBubbleRichIPHParameterRich}};
364const FeatureEntry::FeatureParam kBubbleRichIPHRichWithSnooze[] = {
365 {kBubbleRichIPHParameterName, kBubbleRichIPHParameterRichWithSnooze}};
366const FeatureEntry::FeatureVariation kBubbleRichIPHVariations[] = {
Louis Romero023cc5052022-04-08 23:29:39367 {"Target Highlight", kBubbleRichIPHTargetHighlight,
368 std::size(kBubbleRichIPHTargetHighlight), nullptr},
Christian Xubd60c4b72022-03-22 15:25:01369 {"Explicit dismissal", kBubbleRichIPHExplicitDismissal,
370 std::size(kBubbleRichIPHExplicitDismissal), nullptr},
371 {"Dismissal and rich content", kBubbleRichIPHRich,
372 std::size(kBubbleRichIPHRich), nullptr},
Louis Romero023cc5052022-04-08 23:29:39373 {"Dismissal, rich content, and snooze", kBubbleRichIPHRichWithSnooze,
Christian Xubd60c4b72022-03-22 15:25:01374 std::size(kBubbleRichIPHRichWithSnooze), nullptr},
375};
376
Cooper Knaak1e026562017-07-26 05:22:28377// To add a new entry, add to the end of kFeatureEntries. There are four
sdefresne14900ee2015-11-27 14:43:21378// distinct types of entries:
Cooper Knaak1e026562017-07-26 05:22:28379// . ENABLE_DISABLE_VALUE: entry is either enabled, disabled, or uses the
380// default value for this feature. Use the ENABLE_DISABLE_VALUE_TYPE
sdefresne14900ee2015-11-27 14:43:21381// macro for this type supplying the command line to the macro.
382// . MULTI_VALUE: a list of choices, the first of which should correspond to a
383// deactivated state for this lab (i.e. no command line option). To specify
384// this type of entry use the macro MULTI_VALUE_TYPE supplying it the
385// array of choices.
Cooper Knaak1e026562017-07-26 05:22:28386// . FEATURE_VALUE: entry is associated with a base::Feature instance. Entry is
387// either enabled, disabled, or uses the default value of the associated
388// base::Feature instance. To specify this type of entry use the macro
389// FEATURE_VALUE_TYPE supplying it the base::Feature instance.
390// . FEATURE_WITH_PARAM_VALUES: a list of choices associated with a
391// base::Feature instance. Choices corresponding to the default state, a
392// universally enabled state, and a universally disabled state are
393// automatically included. To specify this type of entry use the macro
394// FEATURE_WITH_PARAMS_VALUE_TYPE supplying it the base::Feature instance and
395// the array of choices.
396//
sdefresne14900ee2015-11-27 14:43:21397// See the documentation of FeatureEntry for details on the fields.
398//
399// When adding a new choice, add it to the end of the list.
400const flags_ui::FeatureEntry kFeatureEntries[] = {
Cooper Knaak1e026562017-07-26 05:22:28401 {"in-product-help-demo-mode-choice",
402 flag_descriptions::kInProductHelpDemoModeName,
403 flag_descriptions::kInProductHelpDemoModeDescription, flags_ui::kOsIos,
404 FEATURE_WITH_PARAMS_VALUE_TYPE(
Tommy Nyquistc1d6dea12017-07-26 20:37:23405 feature_engagement::kIPHDemoMode,
406 feature_engagement::kIPHDemoModeChoiceVariations,
Marc Treib2752e8b2017-08-04 14:12:09407 "IPH_DemoMode")},
Moe Ahmadic3fd7cd2018-05-11 21:40:22408 {"enable-autofill-credit-card-upload",
409 flag_descriptions::kAutofillCreditCardUploadName,
410 flag_descriptions::kAutofillCreditCardUploadDescription, flags_ui::kOsIos,
Anne Lim579b5732018-08-30 18:24:24411 FEATURE_VALUE_TYPE(autofill::features::kAutofillUpstream)},
Tina Wang41d431c2021-06-21 21:04:13412 {"enable-discover-feed-preview",
413 flag_descriptions::kEnableDiscoverFeedPreviewName,
414 flag_descriptions::kEnableDiscoverFeedPreviewDescription, flags_ui::kOsIos,
415 FEATURE_VALUE_TYPE(kEnableDiscoverFeedPreview)},
Moe Ahmadid6d5d172018-06-20 17:20:23416 {"use-sync-sandbox", flag_descriptions::kSyncSandboxName,
417 flag_descriptions::kSyncSandboxDescription, flags_ui::kOsIos,
418 SINGLE_VALUE_TYPE_AND_VALUE(
Victor Hugo Vianna Silva3cd7ae92022-02-09 20:49:51419 syncer::kSyncServiceURL,
Moe Ahmadid6d5d172018-06-20 17:20:23420 "https://chrome-sync.sandbox.google.com/chrome-sync/alpha")},
421 {"wallet-service-use-sandbox",
422 flag_descriptions::kWalletServiceUseSandboxName,
423 flag_descriptions::kWalletServiceUseSandboxDescription, flags_ui::kOsIos,
424 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(
425 autofill::switches::kWalletServiceUseSandbox,
426 "1",
427 autofill::switches::kWalletServiceUseSandbox,
428 "0")},
Mohamad Ahmadic4df81f2017-12-20 04:41:59429 {"show-autofill-type-predictions",
430 flag_descriptions::kShowAutofillTypePredictionsName,
431 flag_descriptions::kShowAutofillTypePredictionsDescription,
432 flags_ui::kOsIos,
Gauthier Ambardcfd85182018-01-05 10:37:46433 FEATURE_VALUE_TYPE(autofill::features::kAutofillShowTypePredictions)},
Olivier Robin3d60411622018-02-23 10:03:22434 {"autofill-ios-delay-between-fields",
435 flag_descriptions::kAutofillIOSDelayBetweenFieldsName,
436 flag_descriptions::kAutofillIOSDelayBetweenFieldsDescription,
437 flags_ui::kOsIos, MULTI_VALUE_TYPE(kAutofillIOSDelayBetweenFieldsChoices)},
Kurt Horimotodc33af32018-05-01 01:39:14438 {"fullscreen-viewport-adjustment-experiment",
Chris Lu481a9322019-09-25 22:16:53439 flag_descriptions::kFullscreenSmoothScrollingName,
440 flag_descriptions::kFullscreenSmoothScrollingDescription, flags_ui::kOsIos,
441 FEATURE_VALUE_TYPE(fullscreen::features::kSmoothScrollingDefault)},
Robbie Gibson1f37a5e2020-08-06 17:03:06442 {"webpage-default-zoom-from-dynamic-type",
443 flag_descriptions::kWebPageDefaultZoomFromDynamicTypeName,
444 flag_descriptions::kWebPageDefaultZoomFromDynamicTypeDescription,
445 flags_ui::kOsIos,
446 FEATURE_VALUE_TYPE(web::kWebPageDefaultZoomFromDynamicType)},
Robbie Gibson88f23962020-09-28 14:35:56447 {"webpage-alternative-text-zoom",
448 flag_descriptions::kWebPageAlternativeTextZoomName,
449 flag_descriptions::kWebPageAlternativeTextZoomDescription,
450 flags_ui::kOsIos, FEATURE_VALUE_TYPE(web::kWebPageAlternativeTextZoom)},
Kurt Horimoto79d590b2018-09-12 19:09:28451 {"toolbar-container", flag_descriptions::kToolbarContainerName,
452 flag_descriptions::kToolbarContainerDescription, flags_ui::kOsIos,
453 FEATURE_VALUE_TYPE(toolbar_container::kToolbarContainerEnabled)},
Stepan Khapugincc4e9842019-01-23 13:38:13454 {"omnibox-ui-max-autocomplete-matches",
455 flag_descriptions::kOmniboxUIMaxAutocompleteMatchesName,
456 flag_descriptions::kOmniboxUIMaxAutocompleteMatchesDescription,
457 flags_ui::kOsIos,
458 FEATURE_WITH_PARAMS_VALUE_TYPE(
459 omnibox::kUIExperimentMaxAutocompleteMatches,
460 kOmniboxUIMaxAutocompleteMatchesVariations,
461 "OmniboxUIMaxAutocompleteVariations")},
Stepan Khapuginbac467e2022-05-06 21:11:54462 {"omnibox-max-zps-matches", flag_descriptions::kOmniboxMaxZPSMatchesName,
463 flag_descriptions::kOmniboxMaxZPSMatchesDescription, flags_ui::kOsIos,
464 FEATURE_WITH_PARAMS_VALUE_TYPE(omnibox::kMaxZeroSuggestMatches,
465 kOmniboxMaxZPSMatchesVariations,
466 "OmniboxMaxZPSVariations")},
Robbie Gibson84f1ddc2020-12-10 21:41:28467 {"omnibox-local-history-zero-suggest",
468 flag_descriptions::kOmniboxLocalHistoryZeroSuggestName,
469 flag_descriptions::kOmniboxLocalHistoryZeroSuggestDescription,
470 flags_ui::kOsIos, FEATURE_VALUE_TYPE(omnibox::kLocalHistoryZeroSuggest)},
Justin Cohen20b6f072019-01-16 01:38:50471#if defined(DCHECK_IS_CONFIGURABLE)
472 {"dcheck-is-fatal", flag_descriptions::kDcheckIsFatalName,
473 flag_descriptions::kDcheckIsFatalDescription, flags_ui::kOsIos,
474 FEATURE_VALUE_TYPE(base::kDCheckIsFatalFeature)},
475#endif // defined(DCHECK_IS_CONFIGURABLE)
Caitlin Fischer43edd90a2019-05-01 13:24:30476 {"autofill-use-mobile-label-disambiguation",
477 flag_descriptions::kAutofillUseMobileLabelDisambiguationName,
478 flag_descriptions::kAutofillUseMobileLabelDisambiguationDescription,
479 flags_ui::kOsIos,
Caitlin Fischer37e01232019-05-24 13:05:45480 FEATURE_WITH_PARAMS_VALUE_TYPE(
481 autofill::features::kAutofillUseMobileLabelDisambiguation,
482 kAutofillUseMobileLabelDisambiguationVariations,
483 "AutofillUseMobileLabelDisambiguation")},
Olivier Robin43814bb2021-06-22 15:25:45484 {"metrickit-crash-reports", flag_descriptions::kMetrickitCrashReportName,
485 flag_descriptions::kMetrickitCrashReportDescription, flags_ui::kOsIos,
486 FEATURE_VALUE_TYPE(kMetrickitCrashReport)},
Mike Doughertyb6c770d2019-09-13 22:56:46487 {"ios-breadcrumbs", flag_descriptions::kLogBreadcrumbsName,
488 flag_descriptions::kLogBreadcrumbsDescription, flags_ui::kOsIos,
Jesse McKenna85c1a59f2021-05-05 19:08:30489 FEATURE_VALUE_TYPE(breadcrumbs::kLogBreadcrumbs)},
Eugene But2823dc7e2020-07-21 18:10:37490 {"ios-synthetic-crash-reports",
491 flag_descriptions::kSyntheticCrashReportsForUteName,
492 flag_descriptions::kSyntheticCrashReportsForUteDescription,
493 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kSyntheticCrashReportsForUte)},
Jérôme Lebelc374fdd2019-09-27 10:36:48494 {"force-startup-signin-promo",
495 flag_descriptions::kForceStartupSigninPromoName,
496 flag_descriptions::kForceStartupSigninPromoDescription, flags_ui::kOsIos,
Alice Wang345e09442021-07-05 09:03:29497 FEATURE_VALUE_TYPE(switches::kForceStartupSigninPromo)},
Yoichi Osato7ae11752021-03-16 03:27:22498 {"restore-session-from-cache",
499 flag_descriptions::kRestoreSessionFromCacheName,
500 flag_descriptions::kRestoreSessionFromCacheDescription, flags_ui::kOsIos,
Justin Cohen3ec2522c2021-04-23 18:23:49501 FEATURE_VALUE_TYPE(web::kRestoreSessionFromCache)},
sczs4622e6e2019-11-06 01:17:59502 {"autofill-save-card-dismiss-on-navigation",
503 flag_descriptions::kAutofillSaveCardDismissOnNavigationName,
504 flag_descriptions::kAutofillSaveCardDismissOnNavigationDescription,
505 flags_ui::kOsIos,
506 FEATURE_VALUE_TYPE(
507 autofill::features::kAutofillSaveCardDismissOnNavigation)},
sczs37d9c132020-07-18 06:06:33508 {"new-content-suggestions-feed", flag_descriptions::kDiscoverFeedInNtpName,
adamta22a4d502020-05-21 03:12:21509 flag_descriptions::kDiscoverFeedInNtpDescription, flags_ui::kOsIos,
gogeralddb0d8ae2020-11-13 03:56:58510 FEATURE_WITH_PARAMS_VALUE_TYPE(kDiscoverFeedInNtp,
511 kDiscoverFeedInNtpVariations,
512 "IOSDiscoverFeed")},
Roberto Mourab87b9722020-06-17 17:12:09513 {"expanded-tab-strip", flag_descriptions::kExpandedTabStripName,
514 flag_descriptions::kExpandedTabStripDescription, flags_ui::kOsIos,
515 FEATURE_VALUE_TYPE(kExpandedTabStrip)},
Tommy Martino6b4eb7e2020-06-25 18:25:41516 {"shared-highlighting-ios", flag_descriptions::kSharedHighlightingIOSName,
517 flag_descriptions::kSharedHighlightingIOSDescription, flags_ui::kOsIos,
518 FEATURE_VALUE_TYPE(kSharedHighlightingIOS)},
Veronique Nguyen6593c762021-11-30 17:28:56519 {"enable-fre-ui-module-ios-with-options",
520 flag_descriptions::kEnableFREUIModuleIOSName,
Tina Wanga252ca42021-04-01 17:14:23521 flag_descriptions::kEnableFREUIModuleIOSDescription, flags_ui::kOsIos,
ginnnnnnny429b5522022-05-05 03:50:06522 FEATURE_VALUE_TYPE(kEnableFREUIModuleIOS)},
jlebel041fc1c2022-03-04 12:53:30523 {"new-mobile-identity-consistency-fre",
524 flag_descriptions::kNewMobileIdentityConsistencyFREName,
525 flag_descriptions::kNewMobileIdentityConsistencyFREDescription,
526 flags_ui::kOsIos,
527 FEATURE_WITH_PARAMS_VALUE_TYPE(signin::kNewMobileIdentityConsistencyFRE,
528 kNewMobileIdentityConsistencyFREVariations,
Justin Cohen273add92022-05-26 15:34:36529 "NewMobileIdentityConsistencyFRE")},
Tina Wang17514e2f2021-09-24 23:57:18530 {"enable-long-message-duration",
531 flag_descriptions::kEnableLongMessageDurationName,
532 flag_descriptions::kEnableLongMessageDurationDescription, flags_ui::kOsIos,
533 FEATURE_VALUE_TYPE(kEnableLongMessageDuration)},
Sylvain Defresne9c107082020-10-27 16:39:13534#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
edchin81467b82020-09-03 19:31:45535 {"screen-time-integration-ios",
536 flag_descriptions::kScreenTimeIntegrationName,
537 flag_descriptions::kScreenTimeIntegrationDescription, flags_ui::kOsIos,
538 FEATURE_VALUE_TYPE(kScreenTimeIntegration)},
Sylvain Defresne9c107082020-10-27 16:39:13539#endif
Nazerke3e993f72020-09-21 13:00:06540 {"modern-tab-strip", flag_descriptions::kModernTabStripName,
541 flag_descriptions::kModernTabStripDescription, flags_ui::kOsIos,
542 FEATURE_VALUE_TYPE(kModernTabStrip)},
Nohemi Fernandez222d6d42020-09-30 20:35:57543 {"minutes-delay-to-restore-gaia-cookies-if-deleted",
544 flag_descriptions::kDelayThresholdMinutesToUpdateGaiaCookieName,
545 flag_descriptions::kDelayThresholdMinutesToUpdateGaiaCookieDescription,
546 flags_ui::kOsIos,
547 MULTI_VALUE_TYPE(kDelayThresholdMinutesToUpdateGaiaCookieChoices)},
Vidhan Jainb4de5c52021-08-30 17:08:02548 {"add-passwords-in-settings",
549 flag_descriptions::kAddPasswordsInSettingsName,
550 flag_descriptions::kAddPasswordsInSettingsDescription, flags_ui::kOsIos,
551 FEATURE_VALUE_TYPE(
552 password_manager::features::kSupportForAddPasswordsInSettings)},
Eugene Butf869bff2020-12-10 01:16:55553 {"record-snapshot-size", flag_descriptions::kRecordSnapshotSizeName,
554 flag_descriptions::kRecordSnapshotSizeDescription, flags_ui::kOsIos,
555 FEATURE_VALUE_TYPE(web::features::kRecordSnapshotSize)},
Chris Lub17195f2020-12-10 20:49:14556 {"default-browser-fullscreen-promo-experiment",
557 flag_descriptions::kDefaultBrowserFullscreenPromoExperimentName,
558 flag_descriptions::kDefaultBrowserFullscreenPromoExperimentDescription,
559 flags_ui::kOsIos,
Javier Ernesto Flores Robles159414232021-06-16 14:29:59560 FEATURE_WITH_PARAMS_VALUE_TYPE(
561 kDefaultBrowserFullscreenPromoExperiment,
562 kDefaultBrowserFullscreenPromoExperimentVariations,
563 "IOSDefaultBrowserFullscreenPromoExperiment")},
Cheick Cisse76ade3d2020-12-16 00:15:11564 {"ios-shared-highlighting-color-change",
565 flag_descriptions::kIOSSharedHighlightingColorChangeName,
566 flag_descriptions::kIOSSharedHighlightingColorChangeDescription,
Cheick Cissed0b5bfe2021-02-11 14:23:07567 flags_ui::kOsIos,
568 FEATURE_VALUE_TYPE(web::features::kIOSSharedHighlightingColorChange)},
Cheick Cissefe994862021-12-15 16:01:34569 {"ios-shared-highlighting-v2",
570 flag_descriptions::kIOSSharedHighlightingV2Name,
571 flag_descriptions::kIOSSharedHighlightingV2Description, flags_ui::kOsIos,
572 FEATURE_VALUE_TYPE(shared_highlighting::kIOSSharedHighlightingV2)},
Stepan Khapugin04341202021-01-07 12:22:45573 {"omnibox-new-textfield-implementation",
574 flag_descriptions::kOmniboxNewImplementationName,
575 flag_descriptions::kOmniboxNewImplementationDescription, flags_ui::kOsIos,
576 FEATURE_VALUE_TYPE(kIOSNewOmniboxImplementation)},
Stepan Khapugin422f08d2022-02-18 16:19:44577 {"omnibox-new-popup-ui", flag_descriptions::kIOSOmniboxUpdatedPopupUIName,
578 flag_descriptions::kIOSOmniboxUpdatedPopupUIDescription, flags_ui::kOsIos,
Robbie Gibson46351032022-03-31 19:46:23579 FEATURE_WITH_PARAMS_VALUE_TYPE(kIOSOmniboxUpdatedPopupUI,
580 kiOSOmniboxUpdatedPopupUIVariations,
Stepan Khapugina45baed2022-05-13 19:15:43581 "IOSOmniboxUpdatedPopupUI")},
gogerald0ff29e52021-02-03 18:56:19582 {"start-surface", flag_descriptions::kStartSurfaceName,
583 flag_descriptions::kStartSurfaceDescription, flags_ui::kOsIos,
gogerald0e39e3aa2021-02-10 18:41:23584 FEATURE_WITH_PARAMS_VALUE_TYPE(kStartSurface,
585 kStartSurfaceVariations,
586 "StartSurface")},
Justin Cohen13ac7a202021-02-04 18:27:28587 {"ios-crashpad", flag_descriptions::kCrashpadIOSName,
588 flag_descriptions::kCrashpadIOSDescription, flags_ui::kOsIos,
589 FEATURE_VALUE_TYPE(kCrashpadIOS)},
Vidhan Jain451b4752021-07-15 10:16:42590 {"autofill-address-verification-in-save-prompt",
591 flag_descriptions::kEnableAutofillAddressSavePromptAddressVerificationName,
592 flag_descriptions::
593 kEnableAutofillAddressSavePromptAddressVerificationDescription,
594 flags_ui::kOsIos,
595 FEATURE_VALUE_TYPE(
596 autofill::features::
597 kAutofillAddressProfileSavePromptAddressVerificationSupport)},
Vidhan Jaina65741552021-03-09 17:18:27598 {"autofill-address-save-prompt",
599 flag_descriptions::kEnableAutofillAddressSavePromptName,
600 flag_descriptions::kEnableAutofillAddressSavePromptDescription,
601 flags_ui::kOsIos,
602 FEATURE_VALUE_TYPE(autofill::features::kAutofillAddressProfileSavePrompt)},
Viktor Semeniuk68e794a2021-03-24 10:23:25603 {"filling-across-affiliated-websites",
604 flag_descriptions::kFillingAcrossAffiliatedWebsitesName,
605 flag_descriptions::kFillingAcrossAffiliatedWebsitesDescription,
606 flags_ui::kOsIos,
607 FEATURE_VALUE_TYPE(
608 password_manager::features::kFillingAcrossAffiliatedWebsites)},
Jared Sauld47c2b72021-03-25 22:47:31609 {"autofill-parse-merchant-promo-code-fields",
610 flag_descriptions::kAutofillParseMerchantPromoCodeFieldsName,
611 flag_descriptions::kAutofillParseMerchantPromoCodeFieldsDescription,
612 flags_ui::kOsIos,
613 FEATURE_VALUE_TYPE(
614 autofill::features::kAutofillParseMerchantPromoCodeFields)},
edchin257cea2f2021-04-07 13:07:13615 {"interest-feed-v2-clicks-and-views-cond-upload",
616 flag_descriptions::kInterestFeedV2ClickAndViewActionsConditionalUploadName,
617 flag_descriptions::
618 kInterestFeedV2ClickAndViewActionsConditionalUploadDescription,
619 flags_ui::kOsIos,
620 FEATURE_VALUE_TYPE(feed::kInterestFeedV2ClicksAndViewsConditionalUpload)},
Mohammad Refaat76b14f542021-10-27 14:46:55621 {"tabs-search-ios", flag_descriptions::kTabsSearchName,
622 flag_descriptions::kTabsSearchDescription, flags_ui::kOsIos,
623 FEATURE_VALUE_TYPE(kTabsSearch)},
Mohammad Refaat95410082022-02-23 02:01:02624 {"tabs-search-regular-results-suggested-actions-ios",
625 flag_descriptions::kTabsSearchRegularResultsSuggestedActionsName,
626 flag_descriptions::kTabsSearchRegularResultsSuggestedActionsDescription,
627 flags_ui::kOsIos,
628 FEATURE_VALUE_TYPE(kTabsSearchRegularResultsSuggestedActions)},
Side Yilmaz0e6c15a2021-04-26 12:55:09629 {"incognito-brand-consistency-for-ios",
630 flag_descriptions::kIncognitoBrandConsistencyForIOSName,
631 flag_descriptions::kIncognitoBrandConsistencyForIOSDescription,
632 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kIncognitoBrandConsistencyForIOS)},
Side Yilmaz6c53f7102021-09-07 13:26:19633 {"incognito-ntp-revamp", flag_descriptions::kIncognitoNtpRevampName,
634 flag_descriptions::kIncognitoNtpRevampDescription, flags_ui::kOsIos,
635 FEATURE_VALUE_TYPE(kIncognitoNtpRevamp)},
Side YILMAZ4b40a3082022-04-11 10:13:33636 {"update-history-entry-points-in-incognito",
637 flag_descriptions::kUpdateHistoryEntryPointsInIncognitoName,
638 flag_descriptions::kUpdateHistoryEntryPointsInIncognitoDescription,
639 flags_ui::kOsIos,
640 FEATURE_VALUE_TYPE(kUpdateHistoryEntryPointsInIncognito)},
jlebeld95434d652021-06-22 10:32:48641 {"sync-trusted-vault-passphrase-ios-rpc",
642 flag_descriptions::kSyncTrustedVaultPassphraseiOSRPCName,
643 flag_descriptions::kSyncTrustedVaultPassphraseiOSRPCDescription,
644 flags_ui::kOsIos,
Victor Hugo Vianna Silva3cd7ae92022-02-09 20:49:51645 FEATURE_VALUE_TYPE(::syncer::kSyncTrustedVaultPassphraseiOSRPC)},
Mikel Astiz850b0fe2021-06-16 09:47:27646 {"sync-trusted-vault-passphrase-promo",
647 flag_descriptions::kSyncTrustedVaultPassphrasePromoName,
648 flag_descriptions::kSyncTrustedVaultPassphrasePromoDescription,
649 flags_ui::kOsIos,
Victor Hugo Vianna Silva3cd7ae92022-02-09 20:49:51650 FEATURE_VALUE_TYPE(::syncer::kSyncTrustedVaultPassphrasePromo)},
Mikel Astiz850b0fe2021-06-16 09:47:27651 {"sync-trusted-vault-passphrase-recovery",
652 flag_descriptions::kSyncTrustedVaultPassphraseRecoveryName,
653 flag_descriptions::kSyncTrustedVaultPassphraseRecoveryDescription,
654 flags_ui::kOsIos,
Victor Hugo Vianna Silva3cd7ae92022-02-09 20:49:51655 FEATURE_VALUE_TYPE(::syncer::kSyncTrustedVaultPassphraseRecovery)},
Nohemi Fernandezc00842a2021-07-26 11:47:34656 {"wait-threshold-seconds-for-capabilities-api",
657 flag_descriptions::kWaitThresholdMillisecondsForCapabilitiesApiName,
658 flag_descriptions::kWaitThresholdMillisecondsForCapabilitiesApiDescription,
659 flags_ui::kOsIos,
660 MULTI_VALUE_TYPE(kWaitThresholdMillisecondsForCapabilitiesApiChoices)},
Jared Saul2188f762021-08-02 21:22:23661 {"autofill-fill-merchant-promo-code-fields",
662 flag_descriptions::kAutofillFillMerchantPromoCodeFieldsName,
663 flag_descriptions::kAutofillFillMerchantPromoCodeFieldsDescription,
664 flags_ui::kOsIos,
665 FEATURE_VALUE_TYPE(
666 autofill::features::kAutofillFillMerchantPromoCodeFields)},
Gauthier Ambard14d3a262021-08-09 18:09:23667 {"context-menu-phase2",
668 flag_descriptions::kWebViewNativeContextMenuPhase2Name,
669 flag_descriptions::kWebViewNativeContextMenuPhase2Description,
670 flags_ui::kOsIos,
671 FEATURE_VALUE_TYPE(web::features::kWebViewNativeContextMenuPhase2)},
Gauthier Ambard14d3a262021-08-09 18:09:23672 {"default-wkwebview-context-menu",
673 flag_descriptions::kDefaultWebViewContextMenuName,
674 flag_descriptions::kDefaultWebViewContextMenuDescription, flags_ui::kOsIos,
675 FEATURE_VALUE_TYPE(web::features::kDefaultWebViewContextMenu)},
Sylvain Defresnedff67e42021-09-24 09:43:03676 {"new-overflow-menu", flag_descriptions::kNewOverflowMenuName,
677 flag_descriptions::kNewOverflowMenuDescription, flags_ui::kOsIos,
678 FEATURE_VALUE_TYPE(kNewOverflowMenu)},
Robbie Gibsonfe748e52022-05-09 18:20:46679 {"new-overflow-menu-settings-action",
680 flag_descriptions::kNewOverflowMenuSettingsActionName,
Robbie Gibsone2ad5632022-05-16 20:46:10681 flag_descriptions::kNewOverflowMenuSettingsActionDescription,
682 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kNewOverflowMenuSettingsAction)},
683 {"new-overflow-menu-simple-destination-icons",
684 flag_descriptions::kNewOverflowMenuSimpleDestinationIconsName,
685 flag_descriptions::kNewOverflowMenuSimpleDestinationIconsDescription,
686 flags_ui::kOsIos,
687 FEATURE_VALUE_TYPE(kNewOverflowMenuSimpleDestinationIcons)},
Robbie Gibson640bccb32022-05-10 18:43:35688 {"new-overflow-menu-cbd-action",
689 flag_descriptions::kNewOverflowMenuCBDActionName,
690 flag_descriptions::kNewOverflowMenuCBDActionDescription, flags_ui::kOsIos,
691 FEATURE_VALUE_TYPE(kNewOverflowMenuCBDAction)},
Sylvain Defresnedff67e42021-09-24 09:43:03692 {"enable-new-download-api", flag_descriptions::kEnableNewDownloadAPIName,
693 flag_descriptions::kEnableNewDownloadAPIDescription, flags_ui::kOsIos,
694 FEATURE_VALUE_TYPE(web::features::kEnableNewDownloadAPI)},
Evan Bernstein0a85f332021-09-29 19:07:24695 {"use-lens-to-search-for-image",
696 flag_descriptions::kUseLensToSearchForImageName,
697 flag_descriptions::kUseLensToSearchForImageDescription, flags_ui::kOsIos,
Ali Juma02a9b7b2021-10-01 13:44:44698 FEATURE_VALUE_TYPE(kUseLensToSearchForImage)},
Benjamin Williamsbee6ab62022-02-28 18:09:40699 {"use-load-simulated-request-for-error-page-navigation",
Gauthier Ambard33cceaf2022-05-05 14:00:23700 flag_descriptions::kUseLoadSimulatedRequestForOfflinePageName,
701 flag_descriptions::kUseLoadSimulatedRequestForOfflinePageDescription,
Benjamin Williamsbee6ab62022-02-28 18:09:40702 flags_ui::kOsIos,
Gauthier Ambard33cceaf2022-05-05 14:00:23703 FEATURE_VALUE_TYPE(web::features::kUseLoadSimulatedRequestForOfflinePage)},
Sergio Collazos9fcc6ed2021-10-06 00:58:03704 {"enable-discover-feed-static-resource-serving",
705 flag_descriptions::kEnableDiscoverFeedStaticResourceServingName,
706 flag_descriptions::kEnableDiscoverFeedStaticResourceServingDescription,
707 flags_ui::kOsIos,
708 FEATURE_WITH_PARAMS_VALUE_TYPE(
709 kEnableDiscoverFeedStaticResourceServing,
710 kEnableDiscoverFeedStaticResourceServingVariations,
711 "IOSDiscoverFeedStaticResourceServing")},
712 {"enable-disco-feed-endpoint",
713 flag_descriptions::kEnableDiscoverFeedDiscoFeedEndpointName,
714 flag_descriptions::kEnableDiscoverFeedDiscoFeedEndpointDescription,
715 flags_ui::kOsIos,
Aliona DANGLA8fae66f02021-10-06 15:47:11716 FEATURE_VALUE_TYPE(kEnableDiscoverFeedDiscoFeedEndpoint)},
Mohammad Refaatab6bee62022-05-16 16:31:15717 {"enable-discover-feed-top-sync-promo",
718 flag_descriptions::kEnableDiscoverFeedTopSyncPromoName,
719 flag_descriptions::kEnableDiscoverFeedTopSyncPromoDescription,
720 flags_ui::kOsIos,
721 FEATURE_WITH_PARAMS_VALUE_TYPE(kEnableDiscoverFeedTopSyncPromo,
722 kDiscoverFeedTopSyncPromoVariations,
723 "EnableDiscoverFeedTopSyncPromo")},
Aliona DANGLA8fae66f02021-10-06 15:47:11724 {"enable-fre-default-browser-screen-testing",
Justin Cohen273add92022-05-26 15:34:36725 flag_descriptions::kEnableFREDefaultBrowserScreenTestingName,
726 flag_descriptions::kEnableFREDefaultBrowserScreenTestingDescription,
Aliona DANGLA8fae66f02021-10-06 15:47:11727 flags_ui::kOsIos,
Justin Cohen273add92022-05-26 15:34:36728 FEATURE_WITH_PARAMS_VALUE_TYPE(kEnableFREDefaultBrowserScreenTesting,
729 kFREDefaultPromoTestingVariations,
730 "EnableFREDefaultBrowserScreenTesting")},
edchin1313f2b2021-10-11 08:08:47731 {"enable-discover-feed-shorter-cache",
732 flag_descriptions::kEnableDiscoverFeedShorterCacheName,
733 flag_descriptions::kEnableDiscoverFeedShorterCacheDescription,
734 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableDiscoverFeedShorterCache)},
Tommy Martino7393d762021-10-12 17:59:28735 {"shared-highlighting-amp",
736 flag_descriptions::kIOSSharedHighlightingAmpName,
737 flag_descriptions::kIOSSharedHighlightingAmpDescription, flags_ui::kOsIos,
738 FEATURE_VALUE_TYPE(shared_highlighting::kSharedHighlightingAmp)},
David Maunderf4a5e1e2021-10-18 17:24:28739 {"enable-commerce-price-tracking",
Matt Jones125dfb42022-02-11 17:23:42740 commerce::flag_descriptions::kCommercePriceTrackingName,
741 commerce::flag_descriptions::kCommercePriceTrackingDescription,
742 flags_ui::kOsIos,
743 FEATURE_WITH_PARAMS_VALUE_TYPE(commerce::kCommercePriceTracking,
744 commerce::kCommercePriceTrackingVariations,
adamta67b6c5812021-10-19 17:02:15745 "CommercePriceTracking")},
Tina Wang8058d5f2021-11-04 20:06:06746 {"web-feed-ios", flag_descriptions::kEnableWebChannelsName,
747 flag_descriptions::kEnableWebChannelsDescription, flags_ui::kOsIos,
748 FEATURE_VALUE_TYPE(kEnableWebChannels)},
adamta39331592021-11-01 20:18:54749 {"ntp-view-hierarchy-repair",
750 flag_descriptions::kNTPViewHierarchyRepairName,
751 flag_descriptions::kNTPViewHierarchyRepairDescription, flags_ui::kOsIos,
752 FEATURE_VALUE_TYPE(kNTPViewHierarchyRepair)},
Chris Lu37588a92021-11-02 21:19:45753 {"single-ntp", flag_descriptions::kSingleNtpName,
754 flag_descriptions::kSingleNtpDescription, flags_ui::kOsIos,
755 FEATURE_VALUE_TYPE(kSingleNtp)},
Justin Cohen69cec682021-11-04 20:10:26756 {"synthesized-restore-session",
757 flag_descriptions::kSynthesizedRestoreSessionName,
758 flag_descriptions::kSynthesizedRestoreSessionDescription, flags_ui::kOsIos,
759 FEATURE_VALUE_TYPE(web::features::kSynthesizedRestoreSession)},
Chris Lu4723b822021-11-05 21:47:44760 {"remove-extra-ntps", flag_descriptions::kRemoveExcessNTPsExperimentName,
761 flag_descriptions::kRemoveExcessNTPsExperimentDescription,
Sylvain Defresne1619dd002021-11-06 10:09:48762 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kRemoveExcessNTPs)},
763 {"lazily-create-web-state-on-restoration",
764 flag_descriptions::kLazilyCreateWebStateOnRestorationName,
765 flag_descriptions::kLazilyCreateWebStateOnRestorationDescription,
766 flags_ui::kOsIos,
767 FEATURE_VALUE_TYPE(web::features::kEnableUnrealizedWebStates)},
ginny huang1f1755c2021-11-11 23:38:23768 {"enable-shortened-password-auto-fill-instruction",
769 flag_descriptions::kEnableShortenedPasswordAutoFillInstructionName,
770 flag_descriptions::kEnableShortenedPasswordAutoFillInstructionDescription,
771 flags_ui::kOsIos,
772 FEATURE_VALUE_TYPE(kEnableShortenedPasswordAutoFillInstruction)},
Benjamin Williams0e7e2fb2021-11-17 03:03:41773 {"enable-password-manager-branding-update",
774 flag_descriptions::kIOSEnablePasswordManagerBrandingUpdateName,
775 flag_descriptions::kIOSEnablePasswordManagerBrandingUpdateDescription,
776 flags_ui::kOsIos,
Aliona DANGLAe5b0b6e52021-11-30 11:58:19777 FEATURE_VALUE_TYPE(
778 password_manager::features::kIOSEnablePasswordManagerBrandingUpdate)},
Gauthier Ambard1d326e22021-12-16 10:57:53779 {"default-mode-ua", flag_descriptions::kAddSettingForDefaultPageModeName,
780 flag_descriptions::kAddSettingForDefaultPageModeDescription,
781 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kAddSettingForDefaultPageMode)},
ginnnnnnny1532d872021-12-20 15:57:37782 {"ios-media-permissions-control",
783 flag_descriptions::kMediaPermissionsControlName,
784 flag_descriptions::kMediaPermissionsControlDescription, flags_ui::kOsIos,
785 FEATURE_VALUE_TYPE(web::features::kMediaPermissionsControl)},
Olivier Robin3a957df2021-12-21 18:04:34786 {"enable-save-session-tabs-in-separate-files",
787 flag_descriptions::kSaveSessionTabsToSeparateFilesName,
788 flag_descriptions::kSaveSessionTabsToSeparateFilesDescription,
789 flags_ui::kOsIos,
790 FEATURE_VALUE_TYPE(sessions::kSaveSessionTabsToSeparateFiles)},
Ewann8c7aadc2022-05-19 15:41:05791 {"use-sf-symbols", flag_descriptions::kUseSFSymbolsName,
792 flag_descriptions::kUseSFSymbolsDescription, flags_ui::kOsIos,
793 FEATURE_VALUE_TYPE(kUseSFSymbols)},
Nohemi Fernandez76f54802022-01-10 18:23:32794 {"enable-unicorn-account-support",
795 flag_descriptions::kEnableUnicornAccountSupportName,
796 flag_descriptions::kEnableUnicornAccountSupportDescription,
797 flags_ui::kOsIos,
798 FEATURE_VALUE_TYPE(signin::kEnableUnicornAccountSupport)},
Chris Lu411bea82022-01-12 18:19:22799 {"single-cell-content-suggestions",
800 flag_descriptions::kSingleCellContentSuggestionsName,
801 flag_descriptions::kSingleCellContentSuggestionsDescription,
802 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kSingleCellContentSuggestions)},
Chris Lue5211052022-02-02 20:44:04803 {"content-suggestions-header-migration",
804 flag_descriptions::kContentSuggestionsHeaderMigrationName,
805 flag_descriptions::kContentSuggestionsHeaderMigrationDescription,
806 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kContentSuggestionsHeaderMigration)},
rgod90cca8b2022-02-04 12:38:27807 {"leak-detection-unauthenticated",
808 flag_descriptions::kLeakDetectionUnauthenticatedName,
809 flag_descriptions::kLeakDetectionUnauthenticatedDescription,
810 flags_ui::kOsIos,
811 FEATURE_VALUE_TYPE(
812 password_manager::features::kLeakDetectionUnauthenticated)},
Veronique Nguyenfc9824b2022-02-10 17:12:53813 {"mute-compromised-passwords",
814 flag_descriptions::kMuteCompromisedPasswordsName,
815 flag_descriptions::kMuteCompromisedPasswordsDescription, flags_ui::kOsIos,
816 FEATURE_VALUE_TYPE(password_manager::features::kMuteCompromisedPasswords)},
Veronique Nguyen00ba26ea2022-02-25 14:57:17817 {"enable-favicon-passwords",
818 flag_descriptions::kEnableFaviconForPasswordsName,
819 flag_descriptions::kEnableFaviconForPasswordsDescription, flags_ui::kOsIos,
820 FEATURE_VALUE_TYPE(
821 password_manager::features::kEnableFaviconForPasswords)},
Shivani Chauhanbf97b0d2022-02-08 22:21:28822 {"autofill-enable-sending-bcn-in-get-upload-details",
823 flag_descriptions::kAutofillEnableSendingBcnInGetUploadDetailsName,
824 flag_descriptions::kAutofillEnableSendingBcnInGetUploadDetailsDescription,
825 flags_ui::kOsIos,
826 FEATURE_VALUE_TYPE(
827 autofill::features::kAutofillEnableSendingBcnInGetUploadDetails)},
Ali Juma1429cf8a2022-02-09 15:31:01828 {"enable-fullscreen-api", flag_descriptions::kEnableFullscreenAPIName,
829 flag_descriptions::kEnableFullscreenAPIDescription, flags_ui::kOsIos,
830 FEATURE_VALUE_TYPE(web::features::kEnableFullscreenAPI)},
Joemer Ramos34175732022-02-14 18:59:16831 {"enable-enhanced-safe-browsing",
832 flag_descriptions::kEnhancedProtectionName,
833 flag_descriptions::kEnhancedProtectionDescription, flags_ui::kOsIos,
834 FEATURE_VALUE_TYPE(safe_browsing::kEnhancedProtection)},
Joemer Ramos26e2b512022-05-24 17:26:41835 {"enable-enhanced-safe-browsing-phase-2",
836 flag_descriptions::kEnhancedProtectionPhase2Name,
837 flag_descriptions::kEnhancedProtectionPhase2Description, flags_ui::kOsIos,
838 FEATURE_VALUE_TYPE(safe_browsing::kEnhancedProtectionPhase2IOS)},
Christian Xu612e2852022-02-10 17:27:42839 {"context-menu-phase2-screenshot",
840 flag_descriptions::kWebViewNativeContextMenuPhase2ScreenshotName,
841 flag_descriptions::kWebViewNativeContextMenuPhase2ScreenshotDescription,
842 flags_ui::kOsIos,
843 FEATURE_VALUE_TYPE(
844 web::features::kWebViewNativeContextMenuPhase2Screenshot)},
Shivani Chauhanaf1eb74d2022-02-11 21:13:19845 {"autofill-enable-unmask-card-request-set-instrument-id",
846 flag_descriptions::kAutofillEnableUnmaskCardRequestSetInstrumentIdName,
847 flag_descriptions::
848 kAutofillEnableUnmaskCardRequestSetInstrumentIdDescription,
849 flags_ui::kOsIos,
850 FEATURE_VALUE_TYPE(
851 autofill::features::kAutofillEnableUnmaskCardRequestSetInstrumentId)},
Victor Hugo Vianna Silvaf0a44002022-02-16 10:38:00852 {"send-tab-to-self-signin-promo",
853 flag_descriptions::kSendTabToSelfSigninPromoName,
854 flag_descriptions::kSendTabToSelfSigninPromoDescription, flags_ui::kOsIos,
855 FEATURE_VALUE_TYPE(send_tab_to_self::kSendTabToSelfSigninPromo)},
Chris Lu7f560f72022-03-01 18:19:01856 {"content-suggestions-uiviewcontroller-migration",
857 flag_descriptions::kContentSuggestionsUIViewControllerMigrationName,
858 flag_descriptions::kContentSuggestionsUIViewControllerMigrationDescription,
859 flags_ui::kOsIos,
860 FEATURE_VALUE_TYPE(kContentSuggestionsUIViewControllerMigration)},
Christian Xubd60c4b72022-03-22 15:25:01861 {"bubble-rich-iph", flag_descriptions::kBubbleRichIPHName,
862 flag_descriptions::kBubbleRichIPHDescription, flags_ui::kOsIos,
863 FEATURE_WITH_PARAMS_VALUE_TYPE(kBubbleRichIPH,
864 kBubbleRichIPHVariations,
865 "BubbleRichIPH")},
Siyu Anff02e742022-04-07 19:08:22866 {"autofill-enforce-delays-in-strike-database",
867 flag_descriptions::kAutofillEnforceDelaysInStrikeDatabaseName,
868 flag_descriptions::kAutofillEnforceDelaysInStrikeDatabaseDescription,
869 flags_ui::kOsIos,
870 FEATURE_VALUE_TYPE(
871 autofill::features::kAutofillEnforceDelaysInStrikeDatabase)},
Ewann4f260562022-04-11 13:37:19872 {"download-calendar", flag_descriptions::kDownloadCalendarName,
873 flag_descriptions::kDownloadCalendarDescription, flags_ui::kOsIos,
874 FEATURE_VALUE_TYPE(kDownloadCalendar)},
Louis Romerofbfbd932022-04-15 18:04:50875 {"uiview-window-observing", flag_descriptions::kUIViewWindowObservingName,
876 flag_descriptions::kUIViewWindowObservingDescription, flags_ui::kOsIos,
877 FEATURE_VALUE_TYPE(kUIViewWindowObserving)},
Jared Saulb0473bd2022-04-20 00:03:41878 {"autofill-upstream-allow-additional-email-domains",
879 flag_descriptions::kAutofillUpstreamAllowAdditionalEmailDomainsName,
880 flag_descriptions::kAutofillUpstreamAllowAdditionalEmailDomainsDescription,
881 flags_ui::kOsIos,
882 FEATURE_VALUE_TYPE(
883 autofill::features::kAutofillUpstreamAllowAdditionalEmailDomains)},
884 {"autofill-upstream-allow-all-email-domains",
885 flag_descriptions::kAutofillUpstreamAllowAllEmailDomainsName,
886 flag_descriptions::kAutofillUpstreamAllowAllEmailDomainsDescription,
887 flags_ui::kOsIos,
888 FEATURE_VALUE_TYPE(
889 autofill::features::kAutofillUpstreamAllowAllEmailDomains)},
Olivier Robinffe767c2022-04-21 13:13:23890 {"enable-tflite-language-detection",
891 flag_descriptions::kTFLiteLanguageDetectionName,
892 flag_descriptions::kTFLiteLanguageDetectionDescription, flags_ui::kOsIos,
893 FEATURE_VALUE_TYPE(translate::kTFLiteLanguageDetectionEnabled)},
894 {"optimization-guide-model-downloading",
895 flag_descriptions::kOptimizationGuideModelDownloadingName,
896 flag_descriptions::kOptimizationGuideModelDownloadingDescription,
897 flags_ui::kOsIos,
898 FEATURE_VALUE_TYPE(
899 optimization_guide::features::kOptimizationGuideModelDownloading)},
900 {"optimization-target-prediction",
901 flag_descriptions::kOptimizationTargetPredictionName,
902 flag_descriptions::kOptimizationTargetPredictionDescription,
903 flags_ui::kOsIos,
904 FEATURE_VALUE_TYPE(
905 optimization_guide::features::kOptimizationTargetPrediction)},
Rushan Suleymanov727309602022-04-28 20:08:54906 {"sync-standalone-invalidations", flag_descriptions::kSyncInvalidationsName,
907 flag_descriptions::kSyncInvalidationsDescription, flags_ui::kOsIos,
908 FEATURE_VALUE_TYPE(::syncer::kUseSyncInvalidations)},
909 {"sync-standalone-invalidations-wallet-and-offer",
910 flag_descriptions::kSyncInvalidationsWalletAndOfferName,
911 flag_descriptions::kSyncInvalidationsWalletAndOfferDescription,
912 flags_ui::kOsIos,
913 FEATURE_VALUE_TYPE(::syncer::kUseSyncInvalidationsForWalletAndOffer)},
Christian Xub8c06cd2022-04-29 20:55:01914 {"suggestions-scrolling-ipad",
915 flag_descriptions::kEnableSuggestionsScrollingOnIPadName,
916 flag_descriptions::kEnableSuggestionsScrollingOnIPadDescription,
917 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableSuggestionsScrollingOnIPad)},
David Jean7a8fa702022-05-02 15:21:22918 {"experience-kit-calendar", flag_descriptions::kCalendarExperienceKitName,
919 flag_descriptions::kCalendarExperienceKitDescription, flags_ui::kOsIos,
920 FEATURE_VALUE_TYPE(kCalendarExperienceKit)},
Mustafa Emre Acer4de8863a2022-05-03 22:17:01921 {"https-only-mode", flag_descriptions::kHttpsOnlyModeName,
922 flag_descriptions::kHttpsOnlyModeDescription, flags_ui::kOsIos,
923 FEATURE_VALUE_TYPE(security_interstitials::features::kHttpsOnlyMode)},
Petro Akzhygitove5ee4a882022-05-04 09:19:37924 {"display-sync-errors-refactor",
925 flag_descriptions::kDisplaySyncErrorsRefactorName,
926 flag_descriptions::kDisplaySyncErrorsRefactorDescription, flags_ui::kOsIos,
927 FEATURE_VALUE_TYPE(kDisplaySyncErrorsRefactor)},
Benjamin Williams419c81e2022-05-04 18:33:22928 {"smart-sorting-new-overflow-menu",
929 flag_descriptions::kSmartSortingNewOverflowMenuName,
930 flag_descriptions::kSmartSortingNewOverflowMenuDescription,
931 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kSmartSortingNewOverflowMenu)},
Alexander Tekled46a36982022-05-09 20:32:42932 {"autofill-enable-ranking-formula",
933 flag_descriptions::kAutofillEnableRankingFormulaName,
934 flag_descriptions::kAutofillEnableRankingFormulaDescription,
935 flags_ui::kOsIos,
936 FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableRankingFormula)},
Siyu An4f658a92022-05-13 22:59:02937 {"autofill-remove-card-expiry-from-downstream-suggestion",
938 flag_descriptions::kAutofillRemoveCardExpiryFromDownstreamSuggestionName,
939 flag_descriptions::
940 kAutofillRemoveCardExpiryFromDownstreamSuggestionDescription,
941 flags_ui::kOsIos,
942 FEATURE_VALUE_TYPE(autofill::features::
943 kAutofillRemoveCardExpiryFromDownstreamSuggestion)},
Sergio Collazos58558712022-05-18 17:24:02944 {"enable-feed-ablation", flag_descriptions::kEnableFeedAblationName,
945 flag_descriptions::kEnableFeedAblationDescription, flags_ui::kOsIos,
946 FEATURE_VALUE_TYPE(kEnableFeedAblation)},
Chris Lu7f024ed2c2022-05-27 23:11:27947 {"content-suggestions-ui-module-refresh",
948 flag_descriptions::kContentSuggestionsUIModuleRefreshName,
949 flag_descriptions::kContentSuggestionsUIModuleRefreshDescription,
950 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kContentSuggestionsUIModuleRefresh)},
Sylvain Defresne1619dd002021-11-06 10:09:48951};
sdefresne14900ee2015-11-27 14:43:21952
Rohit Raobed794c2020-04-27 15:27:45953bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) {
954 return false;
955}
956
957flags_ui::FlagsState& GetGlobalFlagsState() {
958 static base::NoDestructor<flags_ui::FlagsState> flags_state(kFeatureEntries,
959 nullptr);
960 return *flags_state;
961}
David Jean5ca263c2021-08-18 09:19:30962// Creates the experimental test policies map, used by AsyncPolicyLoader and
963// PolicyLoaderIOS to locally enable policies.
Vincent Boisselleed0e6f1a2021-11-09 06:47:34964NSMutableDictionary* CreateExperimentalTestingPolicies() {
sdefresne14900ee2015-11-27 14:43:21965 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
966
Guillaume Jenkins25e9bd72020-08-27 17:39:06967 // Shared variables for all enterprise experimental flags.
Guillaume Jenkins57606d72020-08-13 17:32:55968 NSMutableDictionary* testing_policies = [[NSMutableDictionary alloc] init];
Guillaume Jenkins25e9bd72020-08-27 17:39:06969 NSMutableArray* allowed_experimental_policies = [[NSMutableArray alloc] init];
Guillaume Jenkins57606d72020-08-13 17:32:55970
Guillaume Jenkins25e9bd72020-08-27 17:39:06971 // Set some sample policy values for testing if EnableSamplePolicies is set to
972 // true.
Guillaume Jenkinseeb7007c2020-06-25 22:55:40973 if ([defaults boolForKey:@"EnableSamplePolicies"]) {
Guillaume Jenkins57606d72020-08-13 17:32:55974 [testing_policies addEntriesFromDictionary:@{
Tina Wang59d0b7e2020-08-11 04:41:01975 base::SysUTF8ToNSString(policy::key::kAutofillAddressEnabled) : @NO,
976
Guillaume Jenkinseeb7007c2020-06-25 22:55:40977 base::SysUTF8ToNSString(policy::key::kAutofillCreditCardEnabled) : @NO,
978
979 // 2 = Disable all variations
980 base::SysUTF8ToNSString(policy::key::kChromeVariations) : @2,
981
982 // 2 = Do not allow any site to show popups
983 base::SysUTF8ToNSString(policy::key::kDefaultPopupsSetting) : @2,
984
Tina Wang5abee802020-07-29 23:09:52985 // Set default search engine.
986 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderEnabled) :
987 @YES,
988 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderSearchURL) :
989 @"http://www.google.com/search?q={searchTerms}",
990 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderName) :
Tina Wang7cd0a062020-09-15 21:31:02991 @"TestEngine",
Tina Wang5abee802020-07-29 23:09:52992
Tina Wang89068c82020-10-29 15:51:50993 base::SysUTF8ToNSString(policy::key::kEditBookmarksEnabled) : @NO,
994
Gauthier Ambard21b23702021-04-16 16:11:27995 base::SysUTF8ToNSString(policy::key::kNTPContentSuggestionsEnabled) : @NO,
996
Guillaume Jenkinseeb7007c2020-06-25 22:55:40997 base::SysUTF8ToNSString(policy::key::kPasswordManagerEnabled) : @NO,
Tina Wang59d0b7e2020-08-11 04:41:01998
999 base::SysUTF8ToNSString(policy::key::kTranslateEnabled) : @NO,
Tina Wang54dddfc22020-08-20 22:34:531000
1001 // 2 = Enhanced safe browsing protection
1002 base::SysUTF8ToNSString(policy::key::kSafeBrowsingProtectionLevel) : @2,
1003
1004 base::SysUTF8ToNSString(policy::key::kSearchSuggestEnabled) : @YES,
Guillaume Jenkins57606d72020-08-13 17:32:551005 }];
1006 }
1007
Ewann227a3c02021-04-19 12:04:541008 if ([defaults boolForKey:@"EnableSyncDisabledPolicy"]) {
Guillaume Jenkinsfe46d3a2021-04-26 19:51:041009 NSString* sync_policy_key =
1010 base::SysUTF8ToNSString(policy::key::kSyncDisabled);
David Jean5ca263c2021-08-18 09:19:301011 [testing_policies addEntriesFromDictionary:@{sync_policy_key : @YES}];
Ewann227a3c02021-04-19 12:04:541012 }
Ewann227a3c02021-04-19 12:04:541013
Ewann570a6302021-08-17 07:22:421014 // SyncTypesListDisabled policy.
1015 NSString* Sync_types_list_disabled_key =
1016 base::SysUTF8ToNSString(policy::key::kSyncTypesListDisabled);
1017 NSMutableArray* Sync_types_list_disabled_values =
1018 [[NSMutableArray alloc] init];
1019 if ([defaults boolForKey:@"SyncTypesListBookmarks"]) {
1020 [Sync_types_list_disabled_values addObject:@"bookmarks"];
1021 }
1022 if ([defaults boolForKey:@"SyncTypesListReadingList"]) {
1023 [Sync_types_list_disabled_values addObject:@"readingList"];
1024 }
1025 if ([defaults boolForKey:@"SyncTypesListPreferences"]) {
1026 [Sync_types_list_disabled_values addObject:@"preferences"];
1027 }
1028 if ([defaults boolForKey:@"SyncTypesListPasswords"]) {
1029 [Sync_types_list_disabled_values addObject:@"passwords"];
1030 }
1031 if ([defaults boolForKey:@"SyncTypesListAutofill"]) {
1032 [Sync_types_list_disabled_values addObject:@"autofill"];
1033 }
1034 if ([defaults boolForKey:@"SyncTypesListTypedUrls"]) {
1035 [Sync_types_list_disabled_values addObject:@"typedUrls"];
1036 }
1037 if ([defaults boolForKey:@"SyncTypesListTabs"]) {
1038 [Sync_types_list_disabled_values addObject:@"tabs"];
1039 }
1040 if ([Sync_types_list_disabled_values count]) {
1041 [testing_policies addEntriesFromDictionary:@{
1042 Sync_types_list_disabled_key : Sync_types_list_disabled_values
1043 }];
Ewann570a6302021-08-17 07:22:421044 }
1045
Gauthier Ambard073eaa92021-11-22 15:24:131046 // If an incognito mode availability is set, set the value.
Tina Wangc6bcf572021-01-27 18:15:521047 NSString* incognito_policy_key =
1048 base::SysUTF8ToNSString(policy::key::kIncognitoModeAvailability);
1049 NSInteger incognito_mode_availability =
1050 [defaults integerForKey:incognito_policy_key];
1051 if (incognito_mode_availability) {
Tina Wangc6bcf572021-01-27 18:15:521052 [testing_policies addEntriesFromDictionary:@{
1053 incognito_policy_key : @(incognito_mode_availability),
1054 }];
1055 }
1056
Ewann40a8f8a2021-07-29 10:01:201057 NSString* restriction_pattern =
1058 [defaults stringForKey:@"RestrictAccountsToPatterns"];
1059 if ([restriction_pattern length] > 0) {
Ewannb3bee382021-08-16 09:12:291060 NSString* restrict_key =
1061 base::SysUTF8ToNSString(policy::key::kRestrictAccountsToPatterns);
Ewann40a8f8a2021-07-29 10:01:201062 [testing_policies addEntriesFromDictionary:@{
Ewannb3bee382021-08-16 09:12:291063 restrict_key : @[ restriction_pattern ]
Ewann40a8f8a2021-07-29 10:01:201064 }];
1065 }
1066
Vincent Boisselle19200bc2021-09-01 17:58:251067 // If the sign-in policy is set (not "None"), add the policy key to the list
1068 // of enabled experimental policies, and set the value.
1069 NSString* const kSigninPolicyKey = @"BrowserSignin";
1070 NSInteger signin_policy_mode = [defaults integerForKey:kSigninPolicyKey];
1071 if (signin_policy_mode) {
1072 // Remove the mode offset that was used to represent the unset policy.
1073 --signin_policy_mode;
1074 DCHECK(signin_policy_mode >= 0);
1075
Vincent Boisselle19200bc2021-09-01 17:58:251076 [testing_policies addEntriesFromDictionary:@{
1077 kSigninPolicyKey : @(signin_policy_mode),
1078 }];
1079 }
1080
Veronique Nguyen9b1044f2022-01-11 14:41:131081 // If the New Tab Page URL is set (not empty) add the value to the list of
1082 // test policies.
1083 NSString* ntp_location = [defaults stringForKey:@"NTPLocation"];
1084 if ([ntp_location length] > 0) {
1085 NSString* ntp_location_key =
1086 base::SysUTF8ToNSString(policy::key::kNewTabPageLocation);
1087 [testing_policies
1088 addEntriesFromDictionary:@{ntp_location_key : ntp_location}];
Veronique Nguyen302d8702022-01-12 21:18:571089 [allowed_experimental_policies addObject:ntp_location_key];
Veronique Nguyen9b1044f2022-01-11 14:41:131090 }
1091
Ali Juma9ec36d22022-03-28 14:53:121092 if ([defaults boolForKey:@"DisallowChromeDataInBackups"]) {
1093 NSString* allow_backups_key =
1094 base::SysUTF8ToNSString(policy::key::kAllowChromeDataInBackups);
1095 [testing_policies addEntriesFromDictionary:@{allow_backups_key : @NO}];
1096 [allowed_experimental_policies addObject:allow_backups_key];
1097 }
1098
Guillaume Jenkins25e9bd72020-08-27 17:39:061099 // If any experimental policy was allowed, set the EnableExperimentalPolicies
1100 // policy.
1101 if ([allowed_experimental_policies count] > 0) {
1102 [testing_policies setValue:allowed_experimental_policies
1103 forKey:base::SysUTF8ToNSString(
1104 policy::key::kEnableExperimentalPolicies)];
1105 }
1106
jlebel2eb40222022-05-06 11:15:421107 NSString* metrics_reporting_key = @"MetricsReportingEnabled";
1108 switch ([defaults integerForKey:metrics_reporting_key]) {
1109 case 1:
1110 // Metrics reporting forced.
1111 [testing_policies setValue:@(YES) forKey:metrics_reporting_key];
1112 break;
1113 case 2:
1114 // Metrics reporting disabled.
1115 [testing_policies setValue:@(NO) forKey:metrics_reporting_key];
1116 break;
1117 default:
1118 // Metrics reporting not managed.
1119 break;
1120 }
1121
David Jean6f85d44f2021-08-19 08:08:451122 // Warning: Add new flags to TestingPoliciesHash() below.
1123
David Jean5ca263c2021-08-18 09:19:301124 return testing_policies;
1125}
David Jean6f85d44f2021-08-19 08:08:451126
1127// Generates a unique NSString based on currently monitored policies from
1128// NSUserDefaults standardUserDefaults.
1129NSString* TestingPoliciesHash() {
1130 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
1131 return [NSString
jlebel2eb40222022-05-06 11:15:421132 stringWithFormat:@"%d|%d|%d|%d|%@|%d|%d|%d|%d|%d|%d|%d|%d|%@|%d",
Ali Juma9ec36d22022-03-28 14:53:121133 [defaults boolForKey:@"DisallowChromeDataInBackups"],
David Jean6f85d44f2021-08-19 08:08:451134 [defaults boolForKey:@"EnableSyncDisabledPolicy"],
1135 [defaults boolForKey:@"EnableSamplePolicies"],
jlebel2eb40222022-05-06 11:15:421136 static_cast<int>([defaults
1137 integerForKey:@"IncognitoModeAvailability"]),
David Jean6f85d44f2021-08-19 08:08:451138 [defaults stringForKey:@"RestrictAccountsToPatterns"],
1139 [defaults boolForKey:@"SyncTypesListBookmarks"],
1140 [defaults boolForKey:@"SyncTypesListReadingList"],
1141 [defaults boolForKey:@"SyncTypesListPreferences"],
1142 [defaults boolForKey:@"SyncTypesListPasswords"],
1143 [defaults boolForKey:@"SyncTypesListAutofill"],
1144 [defaults boolForKey:@"SyncTypesListTypedUrls"],
jlebel2eb40222022-05-06 11:15:421145 [defaults boolForKey:@"SyncTypesListTabs"],
1146 static_cast<int>(
1147 [defaults integerForKey:@"BrowserSignin"]),
1148 [defaults stringForKey:@"NTPLocation"],
1149 static_cast<int>([defaults
1150 integerForKey:@"MetricsReportingEnabled"])];
David Jean6f85d44f2021-08-19 08:08:451151}
David Jean5ca263c2021-08-18 09:19:301152} // namespace
1153
1154// Add all switches from experimental flags to |command_line|.
1155void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) {
1156 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
1157
1158 // Set the UA flag if UseMobileSafariUA is enabled.
1159 if ([defaults boolForKey:@"UseMobileSafariUA"]) {
1160 // Safari uses "Vesion/", followed by the OS version excluding bugfix, where
1161 // Chrome puts its product token.
1162 int32_t major = 0;
1163 int32_t minor = 0;
1164 int32_t bugfix = 0;
1165 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
1166 std::string product = base::StringPrintf("Version/%d.%d", major, minor);
1167
1168 command_line->AppendSwitchASCII(switches::kUserAgent,
1169 web::BuildMobileUserAgent(product));
1170 }
1171
1172 // Shared variables for all enterprise experimental flags.
Vincent Boisselleed0e6f1a2021-11-09 06:47:341173 NSMutableDictionary* testing_policies = CreateExperimentalTestingPolicies();
David Jean5ca263c2021-08-18 09:19:301174
1175 // If a CBCM enrollment token is provided, force Chrome Browser Cloud
1176 // Management to enabled and add the token to the list of policies.
1177 NSString* token_key =
1178 base::SysUTF8ToNSString(policy::key::kCloudManagementEnrollmentToken);
1179 NSString* token = [defaults stringForKey:token_key];
1180
1181 if ([token length] > 0) {
1182 command_line->AppendSwitch(switches::kEnableChromeBrowserCloudManagement);
1183 [testing_policies setValue:token forKey:token_key];
1184 }
1185
Vincent Boisselled042d552022-04-09 01:22:591186 if ([defaults boolForKey:@"EnableUserPolicy"]) {
1187 policy::EnableUserPolicy();
1188 }
1189
Guillaume Jenkins57606d72020-08-13 17:32:551190 // If some policies were set, commit them to the app's registration defaults.
1191 if ([testing_policies count] > 0) {
Guillaume Jenkinseeb7007c2020-06-25 22:55:401192 NSDictionary* registration_defaults =
1193 @{kPolicyLoaderIOSConfigurationKey : testing_policies};
1194 [defaults registerDefaults:registration_defaults];
1195 }
1196
sdefresne14900ee2015-11-27 14:43:211197 // Freeform commandline flags. These are added last, so that any flags added
1198 // earlier in this function take precedence.
1199 if ([defaults boolForKey:@"EnableFreeformCommandLineFlags"]) {
1200 base::CommandLine::StringVector flags;
1201 // Append an empty "program" argument.
1202 flags.push_back("");
1203
1204 // The number of flags corresponds to the number of text fields in
1205 // Experimental.plist.
1206 const int kNumFreeformFlags = 5;
1207 for (int i = 1; i <= kNumFreeformFlags; ++i) {
1208 NSString* key =
1209 [NSString stringWithFormat:@"FreeformCommandLineFlag%d", i];
1210 NSString* flag = [defaults stringForKey:key];
1211 if ([flag length]) {
Robbie Gibsonc91ce622019-05-20 14:44:331212 // iOS keyboard replaces -- with —, so undo that.
1213 flag = [flag stringByReplacingOccurrencesOfString:@"—"
1214 withString:@"--"
1215 options:0
1216 range:NSMakeRange(0, 1)];
1217 // To make things easier, allow flags with no dashes by prepending them
1218 // here. This also allows for flags that just have one dash if they
1219 // exist.
1220 if (![flag hasPrefix:@"-"]) {
1221 flag = [@"--" stringByAppendingString:flag];
1222 }
sdefresne14900ee2015-11-27 14:43:211223 flags.push_back(base::SysNSStringToUTF8(flag));
1224 }
1225 }
1226
1227 base::CommandLine temp_command_line(flags);
1228 command_line->AppendArguments(temp_command_line, false);
1229 }
msardafc76f662017-02-24 12:46:281230
justincohendacc85d2017-06-28 23:34:101231 // Populate command line flag for 3rd party keyboard omnibox workaround.
1232 NSString* enableThirdPartyKeyboardWorkaround =
1233 [defaults stringForKey:@"EnableThirdPartyKeyboardWorkaround"];
1234 if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Enabled"]) {
1235 command_line->AppendSwitch(switches::kEnableThirdPartyKeyboardWorkaround);
1236 } else if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Disabled"]) {
1237 command_line->AppendSwitch(switches::kDisableThirdPartyKeyboardWorkaround);
1238 }
1239
Sylvain Defresned3cd8d92022-01-18 13:35:081240 ios::provider::AppendSwitchesFromExperimentalSettings(defaults, command_line);
sdefresne14900ee2015-11-27 14:43:211241}
1242
David Jean5ca263c2021-08-18 09:19:301243void MonitorExperimentalSettingsChanges() {
David Jean5ca263c2021-08-18 09:19:301244 // Startup values for settings to be observed.
David Jean6f85d44f2021-08-19 08:08:451245 __block NSString* hash = TestingPoliciesHash();
David Jeane83ed652021-08-25 14:52:481246 static std::atomic_bool pending_check(false);
David Jean5ca263c2021-08-18 09:19:301247
1248 auto monitor = ^(NSNotification* notification) {
David Jeane83ed652021-08-25 14:52:481249 bool has_pending_check = pending_check.exchange(true);
1250 if (has_pending_check)
1251 return;
1252
David Jeanbc0fae32021-08-25 10:31:391253 // Can be called from any thread from where the notification was sent,
1254 // but since it may change standardUserDefaults, and that has to be on main
1255 // thread, dispatch to main thread.
1256 dispatch_async(dispatch_get_main_queue(), ^{
1257 // Check if observed settings have changed. Since source and destination
1258 // are both user defaults, this is required to avoid cycling back here.
1259 NSString* newHash = TestingPoliciesHash();
1260 if (![newHash isEqualToString:hash]) {
1261 hash = newHash;
David Jean5ca263c2021-08-18 09:19:301262
David Jeanbc0fae32021-08-25 10:31:391263 // Publish update.
1264 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
1265 NSMutableDictionary* testing_policies =
Vincent Boisselleed0e6f1a2021-11-09 06:47:341266 CreateExperimentalTestingPolicies();
David Jeanbc0fae32021-08-25 10:31:391267 NSDictionary* registration_defaults =
1268 @{kPolicyLoaderIOSConfigurationKey : testing_policies};
1269 [defaults registerDefaults:registration_defaults];
1270 }
David Jeane83ed652021-08-25 14:52:481271
1272 pending_check.store(false);
David Jeanbc0fae32021-08-25 10:31:391273 });
David Jean5ca263c2021-08-18 09:19:301274 };
1275
1276 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
1277 [center addObserverForName:NSUserDefaultsDidChangeNotification
1278 object:nil
David Jeanbc0fae32021-08-25 10:31:391279 queue:nil
David Jean5ca263c2021-08-18 09:19:301280 usingBlock:monitor];
1281}
1282
sdefresne14900ee2015-11-27 14:43:211283void ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage,
1284 base::CommandLine* command_line) {
Sylvain Defresne8327a2f2019-01-17 14:19:181285 GetGlobalFlagsState().ConvertFlagsToSwitches(
sdefresnec9763902015-12-02 10:30:111286 flags_storage, command_line, flags_ui::kAddSentinels,
Gregory Chatzinofff6523722017-11-21 01:33:531287 switches::kEnableFeatures, switches::kDisableFeatures);
sdefresne14900ee2015-11-27 14:43:211288}
1289
jkrcalbf073372016-07-29 07:21:311290std::vector<std::string> RegisterAllFeatureVariationParameters(
1291 flags_ui::FlagsStorage* flags_storage,
1292 base::FeatureList* feature_list) {
Justin Cohen2e2adb52019-10-25 17:00:021293 // Occasionally DCHECK crashes on canary can be very distuptive. An
1294 // experimental flag was added to aid in temporarily disabling this for
1295 // canary testers.
1296#if defined(DCHECK_IS_CONFIGURABLE)
1297 if (experimental_flags::AreDCHECKCrashesDisabled()) {
1298 std::vector<base::FeatureList::FeatureOverrideInfo> overrides;
1299 overrides.push_back(
1300 {std::cref(base::kDCheckIsFatalFeature),
1301 base::FeatureList::OverrideState::OVERRIDE_DISABLE_FEATURE});
1302 feature_list->RegisterExtraFeatureOverrides(std::move(overrides));
1303 }
1304#endif // defined(DCHECK_IS_CONFIGURABLE)
1305
Sylvain Defresne8327a2f2019-01-17 14:19:181306 return GetGlobalFlagsState().RegisterAllFeatureVariationParameters(
1307 flags_storage, feature_list);
jkrcalbf073372016-07-29 07:21:311308}
1309
sdefresne14900ee2015-11-27 14:43:211310void GetFlagFeatureEntries(flags_ui::FlagsStorage* flags_storage,
1311 flags_ui::FlagAccess access,
Morten Stenshorne7afa5802021-07-15 10:04:431312 base::Value::ListStorage& supported_entries,
1313 base::Value::ListStorage& unsupported_entries) {
Sylvain Defresne8327a2f2019-01-17 14:19:181314 GetGlobalFlagsState().GetFlagFeatureEntries(
sdefresne14900ee2015-11-27 14:43:211315 flags_storage, access, supported_entries, unsupported_entries,
Renjie Tang208c8192020-11-03 00:46:511316 base::BindRepeating(&SkipConditionalFeatureEntry));
sdefresne14900ee2015-11-27 14:43:211317}
1318
1319void SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage,
1320 const std::string& internal_name,
1321 bool enable) {
Sylvain Defresne8327a2f2019-01-17 14:19:181322 GetGlobalFlagsState().SetFeatureEntryEnabled(flags_storage, internal_name,
1323 enable);
sdefresne14900ee2015-11-27 14:43:211324}
1325
1326void ResetAllFlags(flags_ui::FlagsStorage* flags_storage) {
Sylvain Defresne8327a2f2019-01-17 14:19:181327 GetGlobalFlagsState().ResetAllFlags(flags_storage);
sdefresne14900ee2015-11-27 14:43:211328}
1329
1330namespace testing {
1331
Elly Fong-Jones323ab1092021-08-23 22:36:311332base::span<const flags_ui::FeatureEntry> GetFeatureEntries() {
1333 return base::span<const flags_ui::FeatureEntry>(kFeatureEntries,
Daniel Cheng1f047a82022-02-26 10:04:531334 std::size(kFeatureEntries));
sdefresne14900ee2015-11-27 14:43:211335}
1336
1337} // namespace testing