blob: c5633a8611950ace33b5171dc167470525add836 [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"
sdefresne14900ee2015-11-27 14:43:2118#include "base/command_line.h"
Lei Zhangd4a2f8e2021-07-08 03:43:2819#include "base/cxx17_backports.h"
Sylvain Defresne8327a2f2019-01-17 14:19:1820#include "base/no_destructor.h"
sdefresne14900ee2015-11-27 14:43:2121#include "base/strings/stringprintf.h"
22#include "base/strings/sys_string_conversions.h"
Sebastien Marchand75a7cdf2018-11-13 23:47:0323#include "base/system/sys_info.h"
Mohamad Ahmadic4df81f2017-12-20 04:41:5924#include "components/autofill/core/common/autofill_features.h"
Jared Sauld998539f2019-03-19 15:11:1725#include "components/autofill/core/common/autofill_payments_features.h"
Moe Ahmadid6d5d172018-06-20 17:20:2326#include "components/autofill/core/common/autofill_switches.h"
Olivier Robin3d60411622018-02-23 10:03:2227#include "components/autofill/ios/browser/autofill_switches.h"
Jesse McKenna85c1a59f2021-05-05 19:08:3028#include "components/breadcrumbs/core/features.h"
Robbie Gibson5e3436632020-04-27 15:48:0429#include "components/content_settings/core/common/features.h"
sdefresne14900ee2015-11-27 14:43:2130#include "components/dom_distiller/core/dom_distiller_switches.h"
Guillaume Jenkins4e6ac1e2020-11-11 16:57:4031#include "components/enterprise/browser/enterprise_switches.h"
Tommy Nyquistc1d6dea12017-07-26 20:37:2332#include "components/feature_engagement/public/feature_constants.h"
33#include "components/feature_engagement/public/feature_list.h"
edchind847c0962021-03-03 18:17:0534#include "components/feed/feed_feature_list.h"
sdefresne14900ee2015-11-27 14:43:2135#include "components/flags_ui/feature_entry.h"
36#include "components/flags_ui/feature_entry_macros.h"
37#include "components/flags_ui/flags_storage.h"
38#include "components/flags_ui/flags_ui_switches.h"
Tanja Gornakb0985dd2018-10-11 17:24:4039#include "components/invalidation/impl/invalidation_switches.h"
noyau4cfb1332016-10-25 17:05:4240#include "components/ntp_tiles/switches.h"
Justin Donnelly33d712e2017-08-23 21:32:5141#include "components/omnibox/browser/omnibox_field_trial.h"
Tomasz Wiszkowskid938a1112019-03-06 18:01:5742#include "components/omnibox/common/omnibox_features.h"
Ioana Pandeled14ce9e2017-11-28 14:41:4643#include "components/password_manager/core/common/password_manager_features.h"
mathp9b4c11d2017-07-06 20:24:1344#include "components/payments/core/features.h"
Guillaume Jenkinseeb7007c2020-06-25 22:55:4045#import "components/policy/core/common/policy_loader_ios_constants.h"
46#include "components/policy/policy_constants.h"
Emily Starkbafa9062017-12-27 15:22:4647#include "components/security_state/core/features.h"
Sébastien Séguin-Gagnondcb854b2019-04-10 16:36:4448#include "components/send_tab_to_self/features.h"
Tommy Martino0caf3362021-01-13 20:29:5849#include "components/shared_highlighting/core/common/shared_highlighting_features.h"
Valeriya Sinevicha79dc612018-09-25 14:49:0950#include "components/signin/core/browser/account_reconcilor.h"
Jérôme Lebelc374fdd2019-09-27 10:36:4851#include "components/signin/ios/browser/features.h"
Nohemi Fernandez983d6d52020-09-09 09:46:1952#include "components/signin/public/base/account_consistency_method.h"
Colin Blundell3517170e2019-07-11 08:16:3453#include "components/signin/public/base/signin_switches.h"
sdefresne36579782016-02-05 11:08:2554#include "components/strings/grit/components_strings.h"
Rushan Suleymanov988ad372020-07-26 19:10:0855#include "components/sync/base/sync_base_switches.h"
Moe Ahmadid6d5d172018-06-20 17:20:2356#include "components/sync/driver/sync_driver_switches.h"
Moe Ahmadie4cce1f2018-12-18 23:48:0157#include "components/translate/core/browser/translate_prefs.h"
Sylvain Defresneae6987e2018-03-01 13:21:4058#include "ios/chrome/browser/browsing_data/browsing_data_features.h"
sdefresne14900ee2015-11-27 14:43:2159#include "ios/chrome/browser/chrome_switches.h"
Eugene But2823dc7e2020-07-21 18:10:3760#include "ios/chrome/browser/crash_report/features.h"
Nazerke21bdc45a2019-07-11 09:02:0561#include "ios/chrome/browser/flags/ios_chrome_flag_descriptions.h"
edchin68696842020-04-09 17:19:3162#include "ios/chrome/browser/policy/policy_features.h"
Sylvain Defresne9c107082020-10-27 16:39:1363#include "ios/chrome/browser/screen_time/screen_time_buildflags.h"
Gauthier Ambard33e03302019-02-21 13:28:5864#include "ios/chrome/browser/system_flags.h"
adamta22a4d502020-05-21 03:12:2165#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h"
Javier Ernesto Flores Robles209b2822021-03-25 19:16:5066#import "ios/chrome/browser/ui/default_promo/default_browser_utils.h"
Ewann1a9d33d2021-06-14 11:12:2467#import "ios/chrome/browser/ui/download/features.h"
Kurt Horimoto4da682b022018-04-12 07:43:3568#import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
sczs80a6f462018-12-05 20:37:1869#import "ios/chrome/browser/ui/infobars/infobar_feature.h"
adamta273568472020-12-04 23:53:5770#import "ios/chrome/browser/ui/ntp/new_tab_page_feature.h"
Chris Lue45c94c62021-05-21 01:32:5971#import "ios/chrome/browser/ui/reading_list/reading_list_features.h"
gogerald0ff29e52021-02-03 18:56:1972#import "ios/chrome/browser/ui/start_surface/start_surface_features.h"
Nazerke0bf10c42020-11-12 11:17:3273#import "ios/chrome/browser/ui/tab_switcher/tab_grid/features.h"
sczs76b9ba02019-07-23 23:34:3074#import "ios/chrome/browser/ui/table_view/feature_flags.h"
Kurt Horimoto79d590b2018-09-12 19:09:2875#import "ios/chrome/browser/ui/toolbar_container/toolbar_container_features.h"
Justin Cohen2d81c582018-01-22 14:46:4476#include "ios/chrome/browser/ui/ui_feature_flags.h"
Yi Su392b3032018-06-05 07:26:4777#include "ios/chrome/browser/web/features.h"
sdefresne14900ee2015-11-27 14:43:2178#include "ios/chrome/grit/ios_strings.h"
msardafc76f662017-02-24 12:46:2879#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
Eugene But61818bc2019-04-15 21:04:0780#include "ios/web/common/features.h"
Eugene Bute79f2742019-07-26 17:07:2281#include "ios/web/common/user_agent.h"
Eugene Butb1416232019-07-22 17:31:5882#include "ios/web/common/web_view_creation_util.h"
sdefresne14900ee2015-11-27 14:43:2183
Sylvain Defresne9c107082020-10-27 16:39:1384#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
85#include "ios/chrome/browser/screen_time/features.h"
86#endif
87
sdefresne14900ee2015-11-27 14:43:2188#if !defined(OFFICIAL_BUILD)
89#include "components/variations/variations_switches.h"
vitaliii489217aa2017-01-30 14:50:2290#endif
stkhapuginc1be1792016-12-13 14:30:5391
92#if !defined(__has_feature) || !__has_feature(objc_arc)
93#error "This file requires ARC support."
94#endif
sdefresne14900ee2015-11-27 14:43:2195
elawrence816f6790e2017-06-16 18:19:2896using flags_ui::FeatureEntry;
97
sdefresne14900ee2015-11-27 14:43:2198namespace {
Emily Starkbafa9062017-12-27 15:22:4699
Olivier Robin3d60411622018-02-23 10:03:22100const FeatureEntry::Choice kAutofillIOSDelayBetweenFieldsChoices[] = {
101 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
102 {"0", autofill::switches::kAutofillIOSDelayBetweenFields, "0"},
103 {"10", autofill::switches::kAutofillIOSDelayBetweenFields, "10"},
104 {"20", autofill::switches::kAutofillIOSDelayBetweenFields, "20"},
105 {"50", autofill::switches::kAutofillIOSDelayBetweenFields, "50"},
106 {"100", autofill::switches::kAutofillIOSDelayBetweenFields, "100"},
107 {"200", autofill::switches::kAutofillIOSDelayBetweenFields, "200"},
108 {"500", autofill::switches::kAutofillIOSDelayBetweenFields, "500"},
109 {"1000", autofill::switches::kAutofillIOSDelayBetweenFields, "1000"},
110};
111
Nohemi Fernandez222d6d42020-09-30 20:35:57112const FeatureEntry::Choice kDelayThresholdMinutesToUpdateGaiaCookieChoices[] = {
113 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
114 {"0", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "0"},
115 {"10", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "10"},
116 {"60", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "60"},
117};
118
Nohemi Fernandezc00842a2021-07-26 11:47:34119const FeatureEntry::Choice
120 kWaitThresholdMillisecondsForCapabilitiesApiChoices[] = {
121 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
122 {"200", signin::kWaitThresholdMillisecondsForCapabilitiesApi, "200"},
123 {"500", signin::kWaitThresholdMillisecondsForCapabilitiesApi, "500"},
124 {"5000", signin::kWaitThresholdMillisecondsForCapabilitiesApi, "5000"},
125};
126
Ce Chenc8d803a2020-04-27 09:31:33127const FeatureEntry::FeatureVariation
Ce Chenc8d803a2020-04-27 09:31:33128 kOmniboxOnDeviceHeadSuggestNonIncognitoExperimentVariations[] = {
129 {
130 "relevance-1000",
131 (FeatureEntry::FeatureParam[]){
132 {OmniboxFieldTrial::kOnDeviceHeadSuggestMaxScoreForNonUrlInput,
133 "1000"},
134 {OmniboxFieldTrial::kOnDeviceHeadSuggestDemoteMode,
135 "decrease-relevances"}},
136 2,
137 nullptr,
138 },
139 {
Ce Chen2616ea92021-03-10 04:13:07140 "no-delay-relevance-1000",
Ce Chenc8d803a2020-04-27 09:31:33141 (FeatureEntry::FeatureParam[]){
142 {OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs,
Ce Chen2616ea92021-03-10 04:13:07143 "0"},
Ce Chenc8d803a2020-04-27 09:31:33144 {OmniboxFieldTrial::kOnDeviceHeadSuggestMaxScoreForNonUrlInput,
145 "1000"},
146 {OmniboxFieldTrial::kOnDeviceHeadSuggestDemoteMode,
147 "decrease-relevances"}},
148 3,
149 nullptr,
150 }};
Ce Chen104a5382019-12-10 01:09:05151
Stepan Khapugincc4e9842019-01-23 13:38:13152const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches3[] = {
153 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "3"}};
154const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches4[] = {
155 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "4"}};
156const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches5[] = {
157 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "5"}};
158const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches6[] = {
159 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "6"}};
160const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches8[] = {
161 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "8"}};
162const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches10[] = {
163 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "10"}};
164const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches12[] = {
165 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "12"}};
166
167const FeatureEntry::FeatureVariation
168 kOmniboxUIMaxAutocompleteMatchesVariations[] = {
169 {"3 matches", kOmniboxUIMaxAutocompleteMatches3,
170 base::size(kOmniboxUIMaxAutocompleteMatches3), nullptr},
171 {"4 matches", kOmniboxUIMaxAutocompleteMatches4,
172 base::size(kOmniboxUIMaxAutocompleteMatches4), nullptr},
173 {"5 matches", kOmniboxUIMaxAutocompleteMatches5,
174 base::size(kOmniboxUIMaxAutocompleteMatches5), nullptr},
175 {"6 matches", kOmniboxUIMaxAutocompleteMatches6,
176 base::size(kOmniboxUIMaxAutocompleteMatches6), nullptr},
177 {"8 matches", kOmniboxUIMaxAutocompleteMatches8,
178 base::size(kOmniboxUIMaxAutocompleteMatches8), nullptr},
179 {"10 matches", kOmniboxUIMaxAutocompleteMatches10,
180 base::size(kOmniboxUIMaxAutocompleteMatches10), nullptr},
181 {"12 matches", kOmniboxUIMaxAutocompleteMatches12,
182 base::size(kOmniboxUIMaxAutocompleteMatches12), nullptr}};
183
Caitlin Fischer37e01232019-05-24 13:05:45184const FeatureEntry::FeatureParam
185 kAutofillUseMobileLabelDisambiguationShowAll[] = {
186 {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName,
187 autofill::features::
188 kAutofillUseMobileLabelDisambiguationParameterShowAll}};
189const FeatureEntry::FeatureParam
190 kAutofillUseMobileLabelDisambiguationShowOne[] = {
191 {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName,
192 autofill::features::
193 kAutofillUseMobileLabelDisambiguationParameterShowOne}};
194
195const FeatureEntry::FeatureVariation
196 kAutofillUseMobileLabelDisambiguationVariations[] = {
197 {"(show all)", kAutofillUseMobileLabelDisambiguationShowAll,
198 base::size(kAutofillUseMobileLabelDisambiguationShowAll), nullptr},
199 {"(show one)", kAutofillUseMobileLabelDisambiguationShowOne,
200 base::size(kAutofillUseMobileLabelDisambiguationShowOne), nullptr}};
201
Javier Ernesto Flores Roblese85f4a12021-02-23 18:10:10202const FeatureEntry::FeatureParam
Javier Ernesto Flores Robles159414232021-06-16 14:29:59203 kDefaultBrowserFullscreenPromoExperimentRemindMeLater[] = {
204 {kDefaultBrowserFullscreenPromoExperimentRemindMeGroupParam, "true"}};
205const FeatureEntry::FeatureVariation
206 kDefaultBrowserFullscreenPromoExperimentVariations[] = {
207 {"Remind me later",
208 kDefaultBrowserFullscreenPromoExperimentRemindMeLater,
209 base::size(kDefaultBrowserFullscreenPromoExperimentRemindMeLater),
210 nullptr}};
211
Javier Ernesto Flores Robles308150b2021-03-24 20:09:40212const FeatureEntry::FeatureParam kDefaultPromoTailoredIOS[] = {
213 {kDefaultPromoTailoredVariantIOSParam, "true"}};
214const FeatureEntry::FeatureParam kDefaultPromoTailoredSafe[] = {
215 {kDefaultPromoTailoredVariantSafeParam, "true"}};
216const FeatureEntry::FeatureParam kDefaultPromoTailoredTabs[] = {
217 {kDefaultPromoTailoredVariantTabsParam, "true"}};
218const FeatureEntry::FeatureVariation kDefaultPromoTailoredVariations[] = {
219 {"Built for iOS", kDefaultPromoTailoredIOS,
220 base::size(kDefaultPromoTailoredIOS), nullptr},
221 {"Stay Safe With Google Chrome", kDefaultPromoTailoredSafe,
222 base::size(kDefaultPromoTailoredSafe), nullptr},
223 {"All Your Tabs In One Browser", kDefaultPromoTailoredTabs,
224 base::size(kDefaultPromoTailoredTabs), nullptr},
225};
226
227const FeatureEntry::FeatureParam
228 kDefaultPromoNonModalShortTimeoutWithInstructions[] = {
229 {kDefaultPromoNonModalTimeoutParam, "15"},
230 {kDefaultPromoNonModalInstructionsParam, "true"}};
231const FeatureEntry::FeatureParam
232 kDefaultPromoNonModalLongTimeoutWithInstructions[] = {
233 {kDefaultPromoNonModalTimeoutParam, "45"},
234 {kDefaultPromoNonModalInstructionsParam, "true"}};
235const FeatureEntry::FeatureParam
236 kDefaultPromoNonModalShortTimeoutWithoutInstructions[] = {
237 {kDefaultPromoNonModalTimeoutParam, "15"}};
238const FeatureEntry::FeatureParam
239 kDefaultPromoNonModalLongTimeoutWithoutInstructions[] = {
240 {kDefaultPromoNonModalTimeoutParam, "45"}};
241const FeatureEntry::FeatureVariation kDefaultPromoNonModalVariations[] = {
242 {"Short timeout, with instructions",
243 kDefaultPromoNonModalShortTimeoutWithInstructions,
244 base::size(kDefaultPromoNonModalShortTimeoutWithInstructions), nullptr},
245 {"Long timeout, with instructions",
246 kDefaultPromoNonModalLongTimeoutWithInstructions,
247 base::size(kDefaultPromoNonModalLongTimeoutWithInstructions), nullptr},
248 {"Short timeout, without instructions",
249 kDefaultPromoNonModalShortTimeoutWithoutInstructions,
250 base::size(kDefaultPromoNonModalShortTimeoutWithoutInstructions), nullptr},
251 {"Long timeout, without instructions",
252 kDefaultPromoNonModalLongTimeoutWithoutInstructions,
253 base::size(kDefaultPromoNonModalLongTimeoutWithoutInstructions), nullptr},
254};
255
gogeralddb0d8ae2020-11-13 03:56:58256const FeatureEntry::FeatureParam kDiscoverFeedInNtpEnableNativeUI[] = {
257 {kDiscoverFeedIsNativeUIEnabled, "true"}};
258const FeatureEntry::FeatureVariation kDiscoverFeedInNtpVariations[] = {
259 {"Native UI", kDiscoverFeedInNtpEnableNativeUI,
260 base::size(kDiscoverFeedInNtpEnableNativeUI), nullptr}};
261
sczs0f696782021-02-20 00:05:52262const FeatureEntry::FeatureParam kRefactoredNTPLogging[] = {
263 {kRefactoredNTPLoggingEnabled, "true"}};
264const FeatureEntry::FeatureVariation kRefactoredNTPLoggingVariations[] = {
265 {"Logging Enabled", kRefactoredNTPLogging,
266 base::size(kRefactoredNTPLogging), nullptr}};
267
gogerald53c6e7a2021-04-15 22:07:35268const FeatureEntry::FeatureParam kStartSurfaceTenSecondsShrinkLogo[] = {
Chris Lu5470417c2021-03-03 18:43:08269 {kStartSurfaceShrinkLogoParam, "true"},
gogerald53c6e7a2021-04-15 22:07:35270 {kReturnToStartSurfaceInactiveDurationInSeconds, "10"}};
271const FeatureEntry::FeatureParam kStartSurfaceTenSecondsHideShortcuts[] = {
Chris Lu5470417c2021-03-03 18:43:08272 {kStartSurfaceHideShortcutsParam, "true"},
gogerald53c6e7a2021-04-15 22:07:35273 {kReturnToStartSurfaceInactiveDurationInSeconds, "10"}};
274const FeatureEntry::FeatureParam kStartSurfaceTenSecondsReturnToRecentTab[] = {
Chris Lu5470417c2021-03-03 18:43:08275 {kStartSurfaceReturnToRecentTabParam, "true"},
gogerald53c6e7a2021-04-15 22:07:35276 {kReturnToStartSurfaceInactiveDurationInSeconds, "10"}};
277const FeatureEntry::FeatureParam
278 kStartSurfaceTenSecondsShrinkLogoReturnToRecentTab[] = {
279 {kStartSurfaceShrinkLogoParam, "true"},
280 {kStartSurfaceReturnToRecentTabParam, "true"},
281 {kReturnToStartSurfaceInactiveDurationInSeconds, "10"}};
282const FeatureEntry::FeatureParam
283 kStartSurfaceTenSecondsHideShortcutsReturnToRecentTab[] = {
284 {kStartSurfaceHideShortcutsParam, "true"},
285 {kStartSurfaceReturnToRecentTabParam, "true"},
286 {kReturnToStartSurfaceInactiveDurationInSeconds, "10"}};
287const FeatureEntry::FeatureParam kStartSurfaceOneHourShrinkLogo[] = {
Chris Lu5470417c2021-03-03 18:43:08288 {kStartSurfaceShrinkLogoParam, "true"},
gogerald53c6e7a2021-04-15 22:07:35289 {kReturnToStartSurfaceInactiveDurationInSeconds, "3600"}};
290const FeatureEntry::FeatureParam kStartSurfaceOneHourHideShortcuts[] = {
291 {kStartSurfaceHideShortcutsParam, "true"},
292 {kReturnToStartSurfaceInactiveDurationInSeconds, "3600"}};
293const FeatureEntry::FeatureParam kStartSurfaceOneHourReturnToRecentTab[] = {
Chris Lu5470417c2021-03-03 18:43:08294 {kStartSurfaceReturnToRecentTabParam, "true"},
gogerald53c6e7a2021-04-15 22:07:35295 {kReturnToStartSurfaceInactiveDurationInSeconds, "3600"}};
296const FeatureEntry::FeatureParam
297 kStartSurfaceOneHourShrinkLogoReturnToRecentTab[] = {
298 {kStartSurfaceShrinkLogoParam, "true"},
299 {kStartSurfaceReturnToRecentTabParam, "true"},
300 {kReturnToStartSurfaceInactiveDurationInSeconds, "3600"}};
301const FeatureEntry::FeatureParam
302 kStartSurfaceOneHourHideShortcutsReturnToRecentTab[] = {
303 {kStartSurfaceHideShortcutsParam, "true"},
304 {kStartSurfaceReturnToRecentTabParam, "true"},
305 {kReturnToStartSurfaceInactiveDurationInSeconds, "3600"}};
Chris Lu5470417c2021-03-03 18:43:08306
gogerald0e39e3aa2021-02-10 18:41:23307const FeatureEntry::FeatureVariation kStartSurfaceVariations[] = {
gogerald53c6e7a2021-04-15 22:07:35308 {"10s:Show Return to Recent Tab tile",
309 kStartSurfaceTenSecondsReturnToRecentTab,
310 base::size(kStartSurfaceTenSecondsReturnToRecentTab), nullptr},
311 {"10s:Shrink Logo", kStartSurfaceTenSecondsShrinkLogo,
312 base::size(kStartSurfaceTenSecondsShrinkLogo), nullptr},
313 {"10s:Hide Shortcuts", kStartSurfaceTenSecondsHideShortcuts,
314 base::size(kStartSurfaceTenSecondsHideShortcuts), nullptr},
315 {"10s:Shrink Logo and show Return to Recent Tab tile",
316 kStartSurfaceTenSecondsShrinkLogoReturnToRecentTab,
317 base::size(kStartSurfaceTenSecondsShrinkLogoReturnToRecentTab), nullptr},
318 {"10s:Hide Shortcuts and show Return to Recent Tab tile",
319 kStartSurfaceTenSecondsHideShortcutsReturnToRecentTab,
320 base::size(kStartSurfaceTenSecondsHideShortcutsReturnToRecentTab),
321 nullptr},
322 {"1h:Show Return to Recent Tab tile", kStartSurfaceOneHourReturnToRecentTab,
323 base::size(kStartSurfaceOneHourReturnToRecentTab), nullptr},
324 {"1h:Shrink Logo", kStartSurfaceOneHourShrinkLogo,
325 base::size(kStartSurfaceOneHourShrinkLogo), nullptr},
326 {"1h:Hide Shortcuts", kStartSurfaceOneHourHideShortcuts,
327 base::size(kStartSurfaceOneHourHideShortcuts), nullptr},
328 {"1h:Shrink Logo and show Return to Recent Tab tile",
329 kStartSurfaceOneHourShrinkLogoReturnToRecentTab,
330 base::size(kStartSurfaceOneHourShrinkLogoReturnToRecentTab), nullptr},
331 {"1h:Hide Shortcuts and show Return to Recent Tab tile",
332 kStartSurfaceOneHourHideShortcutsReturnToRecentTab,
333 base::size(kStartSurfaceOneHourHideShortcutsReturnToRecentTab), nullptr},
Chris Lu5470417c2021-03-03 18:43:08334};
gogerald0e39e3aa2021-02-10 18:41:23335
Gauthier Ambard58bd32a42021-01-08 16:56:53336const FeatureEntry::FeatureParam kWebViewNativeContextMenuWeb[] = {
337 {web::features::kWebViewNativeContextMenuName,
338 web::features::kWebViewNativeContextMenuParameterWeb}};
339const FeatureEntry::FeatureParam kWebViewNativeContextMenuSystem[] = {
340 {web::features::kWebViewNativeContextMenuName,
341 web::features::kWebViewNativeContextMenuParameterSystem}};
342
343const FeatureEntry::FeatureVariation kWebViewNativeContextMenuVariations[] = {
344 {"Web", kWebViewNativeContextMenuWeb,
345 base::size(kWebViewNativeContextMenuWeb), nullptr},
346 {"System", kWebViewNativeContextMenuSystem,
347 base::size(kWebViewNativeContextMenuSystem), nullptr}};
348
Cooper Knaak1e026562017-07-26 05:22:28349// To add a new entry, add to the end of kFeatureEntries. There are four
sdefresne14900ee2015-11-27 14:43:21350// distinct types of entries:
Cooper Knaak1e026562017-07-26 05:22:28351// . ENABLE_DISABLE_VALUE: entry is either enabled, disabled, or uses the
352// default value for this feature. Use the ENABLE_DISABLE_VALUE_TYPE
sdefresne14900ee2015-11-27 14:43:21353// macro for this type supplying the command line to the macro.
354// . MULTI_VALUE: a list of choices, the first of which should correspond to a
355// deactivated state for this lab (i.e. no command line option). To specify
356// this type of entry use the macro MULTI_VALUE_TYPE supplying it the
357// array of choices.
Cooper Knaak1e026562017-07-26 05:22:28358// . FEATURE_VALUE: entry is associated with a base::Feature instance. Entry is
359// either enabled, disabled, or uses the default value of the associated
360// base::Feature instance. To specify this type of entry use the macro
361// FEATURE_VALUE_TYPE supplying it the base::Feature instance.
362// . FEATURE_WITH_PARAM_VALUES: a list of choices associated with a
363// base::Feature instance. Choices corresponding to the default state, a
364// universally enabled state, and a universally disabled state are
365// automatically included. To specify this type of entry use the macro
366// FEATURE_WITH_PARAMS_VALUE_TYPE supplying it the base::Feature instance and
367// the array of choices.
368//
sdefresne14900ee2015-11-27 14:43:21369// See the documentation of FeatureEntry for details on the fields.
370//
371// When adding a new choice, add it to the end of the list.
372const flags_ui::FeatureEntry kFeatureEntries[] = {
Cooper Knaak1e026562017-07-26 05:22:28373 {"in-product-help-demo-mode-choice",
374 flag_descriptions::kInProductHelpDemoModeName,
375 flag_descriptions::kInProductHelpDemoModeDescription, flags_ui::kOsIos,
376 FEATURE_WITH_PARAMS_VALUE_TYPE(
Tommy Nyquistc1d6dea12017-07-26 20:37:23377 feature_engagement::kIPHDemoMode,
378 feature_engagement::kIPHDemoModeChoiceVariations,
Marc Treib2752e8b2017-08-04 14:12:09379 "IPH_DemoMode")},
Moe Ahmadic3fd7cd2018-05-11 21:40:22380 {"enable-autofill-credit-card-upload",
381 flag_descriptions::kAutofillCreditCardUploadName,
382 flag_descriptions::kAutofillCreditCardUploadDescription, flags_ui::kOsIos,
Anne Lim579b5732018-08-30 18:24:24383 FEATURE_VALUE_TYPE(autofill::features::kAutofillUpstream)},
Tina Wang41d431c2021-06-21 21:04:13384 {"enable-discover-feed-preview",
385 flag_descriptions::kEnableDiscoverFeedPreviewName,
386 flag_descriptions::kEnableDiscoverFeedPreviewDescription, flags_ui::kOsIos,
387 FEATURE_VALUE_TYPE(kEnableDiscoverFeedPreview)},
Moe Ahmadid6d5d172018-06-20 17:20:23388 {"use-sync-sandbox", flag_descriptions::kSyncSandboxName,
389 flag_descriptions::kSyncSandboxDescription, flags_ui::kOsIos,
390 SINGLE_VALUE_TYPE_AND_VALUE(
391 switches::kSyncServiceURL,
392 "https://chrome-sync.sandbox.google.com/chrome-sync/alpha")},
393 {"wallet-service-use-sandbox",
394 flag_descriptions::kWalletServiceUseSandboxName,
395 flag_descriptions::kWalletServiceUseSandboxDescription, flags_ui::kOsIos,
396 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(
397 autofill::switches::kWalletServiceUseSandbox,
398 "1",
399 autofill::switches::kWalletServiceUseSandbox,
400 "0")},
Mohamad Ahmadic4df81f2017-12-20 04:41:59401 {"show-autofill-type-predictions",
402 flag_descriptions::kShowAutofillTypePredictionsName,
403 flag_descriptions::kShowAutofillTypePredictionsDescription,
404 flags_ui::kOsIos,
Gauthier Ambardcfd85182018-01-05 10:37:46405 FEATURE_VALUE_TYPE(autofill::features::kAutofillShowTypePredictions)},
Olivier Robin3d60411622018-02-23 10:03:22406 {"autofill-ios-delay-between-fields",
407 flag_descriptions::kAutofillIOSDelayBetweenFieldsName,
408 flag_descriptions::kAutofillIOSDelayBetweenFieldsDescription,
409 flags_ui::kOsIos, MULTI_VALUE_TYPE(kAutofillIOSDelayBetweenFieldsChoices)},
Kurt Horimotodc33af32018-05-01 01:39:14410 {"fullscreen-viewport-adjustment-experiment",
Chris Lu481a9322019-09-25 22:16:53411 flag_descriptions::kFullscreenSmoothScrollingName,
412 flag_descriptions::kFullscreenSmoothScrollingDescription, flags_ui::kOsIos,
413 FEATURE_VALUE_TYPE(fullscreen::features::kSmoothScrollingDefault)},
Robbie Gibson1f37a5e2020-08-06 17:03:06414 {"webpage-default-zoom-from-dynamic-type",
415 flag_descriptions::kWebPageDefaultZoomFromDynamicTypeName,
416 flag_descriptions::kWebPageDefaultZoomFromDynamicTypeDescription,
417 flags_ui::kOsIos,
418 FEATURE_VALUE_TYPE(web::kWebPageDefaultZoomFromDynamicType)},
Yi Su392b3032018-06-05 07:26:47419 {"webpage-text-accessibility",
420 flag_descriptions::kWebPageTextAccessibilityName,
421 flag_descriptions::kWebPageTextAccessibilityDescription, flags_ui::kOsIos,
422 FEATURE_VALUE_TYPE(web::kWebPageTextAccessibility)},
Robbie Gibson88f23962020-09-28 14:35:56423 {"webpage-alternative-text-zoom",
424 flag_descriptions::kWebPageAlternativeTextZoomName,
425 flag_descriptions::kWebPageAlternativeTextZoomDescription,
426 flags_ui::kOsIos, FEATURE_VALUE_TYPE(web::kWebPageAlternativeTextZoom)},
Kurt Horimoto79d590b2018-09-12 19:09:28427 {"toolbar-container", flag_descriptions::kToolbarContainerName,
428 flag_descriptions::kToolbarContainerDescription, flags_ui::kOsIos,
429 FEATURE_VALUE_TYPE(toolbar_container::kToolbarContainerEnabled)},
Ce Chenc8d803a2020-04-27 09:31:33430 {"omnibox-on-device-head-suggestions-incognito",
431 flag_descriptions::kOmniboxOnDeviceHeadSuggestionsIncognitoName,
432 flag_descriptions::kOmniboxOnDeviceHeadSuggestionsIncognitoDescription,
Ce Chen104a5382019-12-10 01:09:05433 flags_ui::kOsIos,
Ce Chend565f71f2020-08-12 01:15:53434 FEATURE_VALUE_TYPE(omnibox::kOnDeviceHeadProviderIncognito)},
Ce Chenc8d803a2020-04-27 09:31:33435 {"omnibox-on-device-head-suggestions-non-incognito",
436 flag_descriptions::kOmniboxOnDeviceHeadSuggestionsNonIncognitoName,
437 flag_descriptions::kOmniboxOnDeviceHeadSuggestionsNonIncognitoDescription,
438 flags_ui::kOsIos,
439 FEATURE_WITH_PARAMS_VALUE_TYPE(
440 omnibox::kOnDeviceHeadProviderNonIncognito,
441 kOmniboxOnDeviceHeadSuggestNonIncognitoExperimentVariations,
Ce Chen2616ea92021-03-10 04:13:07442 "OmniboxOnDeviceHeadNonIncognitoTuningMobile")},
Stepan Khapugincc4e9842019-01-23 13:38:13443 {"omnibox-ui-max-autocomplete-matches",
444 flag_descriptions::kOmniboxUIMaxAutocompleteMatchesName,
445 flag_descriptions::kOmniboxUIMaxAutocompleteMatchesDescription,
446 flags_ui::kOsIos,
447 FEATURE_WITH_PARAMS_VALUE_TYPE(
448 omnibox::kUIExperimentMaxAutocompleteMatches,
449 kOmniboxUIMaxAutocompleteMatchesVariations,
450 "OmniboxUIMaxAutocompleteVariations")},
Robbie Gibson84f1ddc2020-12-10 21:41:28451 {"omnibox-local-history-zero-suggest",
452 flag_descriptions::kOmniboxLocalHistoryZeroSuggestName,
453 flag_descriptions::kOmniboxLocalHistoryZeroSuggestDescription,
454 flags_ui::kOsIos, FEATURE_VALUE_TYPE(omnibox::kLocalHistoryZeroSuggest)},
Justin Cohen20b6f072019-01-16 01:38:50455#if defined(DCHECK_IS_CONFIGURABLE)
456 {"dcheck-is-fatal", flag_descriptions::kDcheckIsFatalName,
457 flag_descriptions::kDcheckIsFatalDescription, flags_ui::kOsIos,
458 FEATURE_VALUE_TYPE(base::kDCheckIsFatalFeature)},
459#endif // defined(DCHECK_IS_CONFIGURABLE)
Gauthier Ambard5f610862019-01-17 11:43:55460 {"settings-refresh", flag_descriptions::kSettingsRefreshName,
461 flag_descriptions::kSettingsRefreshDescription, flags_ui::kOsIos,
462 FEATURE_VALUE_TYPE(kSettingsRefresh)},
Caitlin Fischer43edd90a2019-05-01 13:24:30463 {"autofill-use-mobile-label-disambiguation",
464 flag_descriptions::kAutofillUseMobileLabelDisambiguationName,
465 flag_descriptions::kAutofillUseMobileLabelDisambiguationDescription,
466 flags_ui::kOsIos,
Caitlin Fischer37e01232019-05-24 13:05:45467 FEATURE_WITH_PARAMS_VALUE_TYPE(
468 autofill::features::kAutofillUseMobileLabelDisambiguation,
469 kAutofillUseMobileLabelDisambiguationVariations,
470 "AutofillUseMobileLabelDisambiguation")},
edchinb5d92582020-03-11 15:26:11471 {"autofill-prune-suggestions",
Caitlin Fischer6d609542019-05-01 21:59:21472 flag_descriptions::kAutofillPruneSuggestionsName,
473 flag_descriptions::kAutofillPruneSuggestionsDescription, flags_ui::kOsIos,
474 FEATURE_VALUE_TYPE(autofill::features::kAutofillPruneSuggestions)},
sczs76b9ba02019-07-23 23:34:30475 {"collections-card-presentation-style",
476 flag_descriptions::kCollectionsCardPresentationStyleName,
477 flag_descriptions::kCollectionsCardPresentationStyleDescription,
478 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kCollectionsCardPresentationStyle)},
Olivier Robin43814bb2021-06-22 15:25:45479 {"metrickit-crash-reports", flag_descriptions::kMetrickitCrashReportName,
480 flag_descriptions::kMetrickitCrashReportDescription, flags_ui::kOsIos,
481 FEATURE_VALUE_TYPE(kMetrickitCrashReport)},
Mike Doughertyb6c770d2019-09-13 22:56:46482 {"ios-breadcrumbs", flag_descriptions::kLogBreadcrumbsName,
483 flag_descriptions::kLogBreadcrumbsDescription, flags_ui::kOsIos,
Jesse McKenna85c1a59f2021-05-05 19:08:30484 FEATURE_VALUE_TYPE(breadcrumbs::kLogBreadcrumbs)},
Eugene But2823dc7e2020-07-21 18:10:37485 {"ios-synthetic-crash-reports",
486 flag_descriptions::kSyntheticCrashReportsForUteName,
487 flag_descriptions::kSyntheticCrashReportsForUteDescription,
488 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kSyntheticCrashReportsForUte)},
Jérôme Lebelc374fdd2019-09-27 10:36:48489 {"force-startup-signin-promo",
490 flag_descriptions::kForceStartupSigninPromoName,
491 flag_descriptions::kForceStartupSigninPromoDescription, flags_ui::kOsIos,
Alice Wang345e09442021-07-05 09:03:29492 FEATURE_VALUE_TYPE(switches::kForceStartupSigninPromo)},
Yoichi Osato7ae11752021-03-16 03:27:22493 {"restore-session-from-cache",
494 flag_descriptions::kRestoreSessionFromCacheName,
495 flag_descriptions::kRestoreSessionFromCacheDescription, flags_ui::kOsIos,
Justin Cohen3ec2522c2021-04-23 18:23:49496 FEATURE_VALUE_TYPE(web::kRestoreSessionFromCache)},
sczs4622e6e2019-11-06 01:17:59497 {"autofill-save-card-dismiss-on-navigation",
498 flag_descriptions::kAutofillSaveCardDismissOnNavigationName,
499 flag_descriptions::kAutofillSaveCardDismissOnNavigationDescription,
500 flags_ui::kOsIos,
501 FEATURE_VALUE_TYPE(
502 autofill::features::kAutofillSaveCardDismissOnNavigation)},
Rohit Raoe7b489312019-11-12 12:28:55503 {"force-unstacked-tabstrip", flag_descriptions::kForceUnstackedTabstripName,
504 flag_descriptions::kForceUnstackedTabstripDescription, flags_ui::kOsIos,
505 FEATURE_VALUE_TYPE(kForceUnstackedTabstrip)},
Gauthier Ambardbde9def2019-11-19 18:04:33506 {"desktop-version-default", flag_descriptions::kDefaultToDesktopOnIPadName,
507 flag_descriptions::kDefaultToDesktopOnIPadDescription, flags_ui::kOsIos,
Gauthier Ambard054175f2019-12-16 11:54:09508 FEATURE_VALUE_TYPE(web::features::kUseDefaultUserAgentInWebClient)},
Gauthier Ambardbde9def2019-11-19 18:04:33509 {"mobile-google-srp", flag_descriptions::kMobileGoogleSRPName,
510 flag_descriptions::kMobileGoogleSRPDescription, flags_ui::kOsIos,
511 FEATURE_VALUE_TYPE(web::kMobileGoogleSRP)},
Kurt Horimotod754e8ec2019-12-03 20:54:02512 {"infobar-overlay-ui", flag_descriptions::kInfobarOverlayUIName,
513 flag_descriptions::kInfobarOverlayUIDescription, flags_ui::kOsIos,
514 FEATURE_VALUE_TYPE(kInfobarOverlayUI)},
Mike Dougherty768389502020-04-21 08:28:35515 {"url-blocklist-ios", flag_descriptions::kURLBlocklistIOSName,
516 flag_descriptions::kURLBlocklistIOSDescription, flags_ui::kOsIos,
517 FEATURE_VALUE_TYPE(kURLBlocklistIOS)},
Tina Wang52aea19d2020-05-15 16:47:33518 {"enable-ios-managed-settings-ui",
519 flag_descriptions::kEnableIOSManagedSettingsUIName,
520 flag_descriptions::kEnableIOSManagedSettingsUIDescription,
521 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableIOSManagedSettingsUI)},
sczs37d9c132020-07-18 06:06:33522 {"new-content-suggestions-feed", flag_descriptions::kDiscoverFeedInNtpName,
adamta22a4d502020-05-21 03:12:21523 flag_descriptions::kDiscoverFeedInNtpDescription, flags_ui::kOsIos,
gogeralddb0d8ae2020-11-13 03:56:58524 FEATURE_WITH_PARAMS_VALUE_TYPE(kDiscoverFeedInNtp,
525 kDiscoverFeedInNtpVariations,
526 "IOSDiscoverFeed")},
adamta273568472020-12-04 23:53:57527 {"refactored-ntp", flag_descriptions::kRefactoredNTPName,
528 flag_descriptions::kRefactoredNTPDescription, flags_ui::kOsIos,
sczs0f696782021-02-20 00:05:52529 FEATURE_WITH_PARAMS_VALUE_TYPE(kRefactoredNTP,
530 kRefactoredNTPLoggingVariations,
531 "RefactoredNTP")},
Roberto Mourab87b9722020-06-17 17:12:09532 {"expanded-tab-strip", flag_descriptions::kExpandedTabStripName,
533 flag_descriptions::kExpandedTabStripDescription, flags_ui::kOsIos,
534 FEATURE_VALUE_TYPE(kExpandedTabStrip)},
Ben Blake14592fe2020-06-16 15:34:38535 {"autofill-enable-offers-in-downstream",
536 flag_descriptions::kAutofillEnableOffersInDownstreamName,
537 flag_descriptions::kAutofillEnableOffersInDownstreamDescription,
538 flags_ui::kOsIos,
539 FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableOffersInDownstream)},
Tommy Martino6b4eb7e2020-06-25 18:25:41540 {"shared-highlighting-ios", flag_descriptions::kSharedHighlightingIOSName,
541 flag_descriptions::kSharedHighlightingIOSDescription, flags_ui::kOsIos,
542 FEATURE_VALUE_TYPE(kSharedHighlightingIOS)},
Aliona DANGLAfe2e87d2021-07-23 11:40:19543 {"enable-fre-default-browser-screen",
544 flag_descriptions::kEnableFREDefaultBrowserScreenName,
545 flag_descriptions::kEnableFREDefaultBrowserScreenDescription,
546 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableFREDefaultBrowserScreen)},
Tina Wanga252ca42021-04-01 17:14:23547 {"enable-fre-ui-module-ios", flag_descriptions::kEnableFREUIModuleIOSName,
548 flag_descriptions::kEnableFREUIModuleIOSDescription, flags_ui::kOsIos,
549 FEATURE_VALUE_TYPE(kEnableFREUIModuleIOS)},
Julian Mentasti-Meza4c0a4162020-07-20 18:51:41550 {"enable-fullpage-screenshot",
551 flag_descriptions::kEnableFullPageScreenshotName,
552 flag_descriptions::kEnableFullPageScreenshotDescription, flags_ui::kOsIos,
553 FEATURE_VALUE_TYPE(kEnableFullPageScreenshot)},
Chris Thompson40cbb162020-08-04 23:22:15554 {"legacy-tls-interstitial",
555 flag_descriptions::kIOSLegacyTLSInterstitialsName,
556 flag_descriptions::kIOSLegacyTLSInterstitialsDescription, flags_ui::kOsIos,
557 FEATURE_VALUE_TYPE(web::features::kIOSLegacyTLSInterstitial)},
Ewanne1ffc6d2020-09-01 07:56:13558 {"enable-close-all-tabs-confirmation",
559 flag_descriptions::kEnableCloseAllTabsConfirmationName,
560 flag_descriptions::kEnableCloseAllTabsConfirmationDescription,
561 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableCloseAllTabsConfirmation)},
Sylvain Defresne9c107082020-10-27 16:39:13562#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
edchin81467b82020-09-03 19:31:45563 {"screen-time-integration-ios",
564 flag_descriptions::kScreenTimeIntegrationName,
565 flag_descriptions::kScreenTimeIntegrationDescription, flags_ui::kOsIos,
566 FEATURE_VALUE_TYPE(kScreenTimeIntegration)},
Sylvain Defresne9c107082020-10-27 16:39:13567#endif
jlebel5a31acc2021-05-26 01:23:39568 {"mice-web-signin", flag_descriptions::kMICEWebSignInName,
569 flag_descriptions::kMICEWebSignInDescription, flags_ui::kOsIos,
570 FEATURE_VALUE_TYPE(signin::kMICEWebSignIn)},
Nohemi Fernandez983d6d52020-09-09 09:46:19571 {"mobile-identity-consistency",
572 flag_descriptions::kMobileIdentityConsistencyName,
573 flag_descriptions::kMobileIdentityConsistencyDescription, flags_ui::kOsIos,
574 FEATURE_VALUE_TYPE(signin::kMobileIdentityConsistency)},
Jérôme Lebel1d4b0fa2021-01-28 01:01:43575 {"simplify-sign-out-ios", flag_descriptions::kSimplifySignOutIOSName,
576 flag_descriptions::kSimplifySignOutIOSDescription, flags_ui::kOsIos,
577 FEATURE_VALUE_TYPE(signin::kSimplifySignOutIOS)},
Gauthier Ambarda1d88a02020-09-14 11:46:37578 {"default-browser-setting", flag_descriptions::kDefaultBrowserSettingsName,
579 flag_descriptions::kDefaultBrowserSettingsDescription, flags_ui::kOsIos,
580 FEATURE_VALUE_TYPE(kDefaultBrowserSettings)},
Nazerke3e993f72020-09-21 13:00:06581 {"modern-tab-strip", flag_descriptions::kModernTabStripName,
582 flag_descriptions::kModernTabStripDescription, flags_ui::kOsIos,
583 FEATURE_VALUE_TYPE(kModernTabStrip)},
Maria Kazinovad4e2ed72020-09-22 17:40:50584 {"autofill-use-renderer-ids",
585 flag_descriptions::kAutofillUseRendererIDsName,
586 flag_descriptions::kAutofillUseRendererIDsDescription, flags_ui::kOsIos,
587 FEATURE_VALUE_TYPE(
588 autofill::features::kAutofillUseUniqueRendererIDsOnIOS)},
Nohemi Fernandez7af63ca22020-12-11 13:06:40589 {"restore-gaia-cookies-on-user-action",
590 flag_descriptions::kRestoreGaiaCookiesOnUserActionName,
591 flag_descriptions::kRestoreGaiaCookiesOnUserActionDescription,
592 flags_ui::kOsIos,
593 FEATURE_VALUE_TYPE(signin::kRestoreGaiaCookiesOnUserAction)},
Nohemi Fernandez14a80f72020-11-09 13:01:04594 {"use-username-for-signin-notification-infobar-title",
595 flag_descriptions::kSigninNotificationInfobarUsernameInTitleName,
596 flag_descriptions::kSigninNotificationInfobarUsernameInTitleDescription,
597 flags_ui::kOsIos,
598 FEATURE_VALUE_TYPE(signin::kSigninNotificationInfobarUsernameInTitle)},
Nohemi Fernandez222d6d42020-09-30 20:35:57599 {"minutes-delay-to-restore-gaia-cookies-if-deleted",
600 flag_descriptions::kDelayThresholdMinutesToUpdateGaiaCookieName,
601 flag_descriptions::kDelayThresholdMinutesToUpdateGaiaCookieDescription,
602 flags_ui::kOsIos,
603 MULTI_VALUE_TYPE(kDelayThresholdMinutesToUpdateGaiaCookieChoices)},
Viktor Semeniukd932ff52020-10-13 13:10:17604 {"edit-passwords-in-settings",
605 flag_descriptions::kEditPasswordsInSettingsName,
606 flag_descriptions::kEditPasswordsInSettingsDescription, flags_ui::kOsIos,
607 FEATURE_VALUE_TYPE(password_manager::features::kEditPasswordsInSettings)},
Stepan Khapuginddb85962020-10-21 11:49:58608 {"enable-incognito-authentication-ios",
609 flag_descriptions::kIncognitoAuthenticationName,
610 flag_descriptions::kIncognitoAuthenticationDescription, flags_ui::kOsIos,
611 FEATURE_VALUE_TYPE(kIncognitoAuthentication)},
Gauthier Ambardcb6a0ccc2020-10-30 13:12:00612 {"web-view-native-context-menu",
613 flag_descriptions::kWebViewNativeContextMenuName,
614 flag_descriptions::kWebViewNativeContextMenuDescription, flags_ui::kOsIos,
Gauthier Ambard58bd32a42021-01-08 16:56:53615 FEATURE_WITH_PARAMS_VALUE_TYPE(web::features::kWebViewNativeContextMenu,
616 kWebViewNativeContextMenuVariations,
617 "WebViewNativeContextMenu")},
Chris Lu4b15abc2020-11-09 20:19:19618 {"location-permissions-prompt",
619 flag_descriptions::kLocationPermissionsPromptName,
620 flag_descriptions::kLocationPermissionsPromptDescription, flags_ui::kOsIos,
621 FEATURE_VALUE_TYPE(kLocationPermissionsPrompt)},
Eugene Butf869bff2020-12-10 01:16:55622 {"record-snapshot-size", flag_descriptions::kRecordSnapshotSizeName,
623 flag_descriptions::kRecordSnapshotSizeDescription, flags_ui::kOsIos,
624 FEATURE_VALUE_TYPE(web::features::kRecordSnapshotSize)},
Chris Lub17195f2020-12-10 20:49:14625 {"default-browser-fullscreen-promo-experiment",
626 flag_descriptions::kDefaultBrowserFullscreenPromoExperimentName,
627 flag_descriptions::kDefaultBrowserFullscreenPromoExperimentDescription,
628 flags_ui::kOsIos,
Javier Ernesto Flores Robles159414232021-06-16 14:29:59629 FEATURE_WITH_PARAMS_VALUE_TYPE(
630 kDefaultBrowserFullscreenPromoExperiment,
631 kDefaultBrowserFullscreenPromoExperimentVariations,
632 "IOSDefaultBrowserFullscreenPromoExperiment")},
Cheick Cisse76ade3d2020-12-16 00:15:11633 {"ios-shared-highlighting-color-change",
634 flag_descriptions::kIOSSharedHighlightingColorChangeName,
635 flag_descriptions::kIOSSharedHighlightingColorChangeDescription,
Cheick Cissed0b5bfe2021-02-11 14:23:07636 flags_ui::kOsIos,
637 FEATURE_VALUE_TYPE(web::features::kIOSSharedHighlightingColorChange)},
Chris Lu07e32772020-12-30 01:54:44638 {"ios-persist-crash-restore-infobar",
639 flag_descriptions::kIOSPersistCrashRestoreName,
640 flag_descriptions::kIOSPersistCrashRestoreDescription, flags_ui::kOsIos,
641 FEATURE_VALUE_TYPE(kIOSPersistCrashRestore)},
Stepan Khapugin04341202021-01-07 12:22:45642 {"omnibox-new-textfield-implementation",
643 flag_descriptions::kOmniboxNewImplementationName,
644 flag_descriptions::kOmniboxNewImplementationDescription, flags_ui::kOsIos,
645 FEATURE_VALUE_TYPE(kIOSNewOmniboxImplementation)},
Tommy Martino0caf3362021-01-13 20:29:58646 {"shared-highlighting-use-blocklist",
647 flag_descriptions::kSharedHighlightingUseBlocklistIOSName,
648 flag_descriptions::kSharedHighlightingUseBlocklistIOSDescription,
649 flags_ui::kOsIos,
650 FEATURE_VALUE_TYPE(shared_highlighting::kSharedHighlightingUseBlocklist)},
gogerald0ff29e52021-02-03 18:56:19651 {"start-surface", flag_descriptions::kStartSurfaceName,
652 flag_descriptions::kStartSurfaceDescription, flags_ui::kOsIos,
gogerald0e39e3aa2021-02-10 18:41:23653 FEATURE_WITH_PARAMS_VALUE_TYPE(kStartSurface,
654 kStartSurfaceVariations,
655 "StartSurface")},
Justin Cohen13ac7a202021-02-04 18:27:28656 {"ios-crashpad", flag_descriptions::kCrashpadIOSName,
657 flag_descriptions::kCrashpadIOSDescription, flags_ui::kOsIos,
658 FEATURE_VALUE_TYPE(kCrashpadIOS)},
Maria Kazinovab69b75d2021-02-16 00:09:37659 {"detect-form-submission-on-form-clear",
660 flag_descriptions::kDetectFormSubmissionOnFormClearIOSName,
661 flag_descriptions::kDetectFormSubmissionOnFormClearIOSDescription,
662 flags_ui::kOsIos,
663 FEATURE_VALUE_TYPE(
664 password_manager::features::kDetectFormSubmissionOnFormClear)},
edchin39bc6f12021-02-17 00:33:29665 {"password-reuse-detection", flag_descriptions::kPasswordReuseDetectionName,
666 flag_descriptions::kPasswordReuseDetectionDescription, flags_ui::kOsIos,
667 FEATURE_VALUE_TYPE(
668 password_manager::features::kPasswordReuseDetectionEnabled)},
Maria Kazinova852e23702021-02-24 11:10:11669 {"enable-manual-password-generation",
670 flag_descriptions::kEnableManualPasswordGenerationName,
671 flag_descriptions::kEnableManualPasswordGenerationDescription,
672 flags_ui::kOsIos,
673 FEATURE_VALUE_TYPE(
674 password_manager::features::kEnableManualPasswordGeneration)},
edchind847c0962021-03-03 18:17:05675 {"interest-feed-notice-card-auto-dismiss",
676 flag_descriptions::kInterestFeedNoticeCardAutoDismissName,
677 flag_descriptions::kInterestFeedNoticeCardAutoDismissDescription,
678 flags_ui::kOsIos,
679 FEATURE_VALUE_TYPE(feed::kInterestFeedNoticeCardAutoDismiss)},
Vidhan Jain451b4752021-07-15 10:16:42680 {"autofill-address-verification-in-save-prompt",
681 flag_descriptions::kEnableAutofillAddressSavePromptAddressVerificationName,
682 flag_descriptions::
683 kEnableAutofillAddressSavePromptAddressVerificationDescription,
684 flags_ui::kOsIos,
685 FEATURE_VALUE_TYPE(
686 autofill::features::
687 kAutofillAddressProfileSavePromptAddressVerificationSupport)},
Vidhan Jaina65741552021-03-09 17:18:27688 {"autofill-address-save-prompt",
689 flag_descriptions::kEnableAutofillAddressSavePromptName,
690 flag_descriptions::kEnableAutofillAddressSavePromptDescription,
691 flags_ui::kOsIos,
692 FEATURE_VALUE_TYPE(autofill::features::kAutofillAddressProfileSavePrompt)},
Viktor Semeniuk68e794a2021-03-24 10:23:25693 {"filling-across-affiliated-websites",
694 flag_descriptions::kFillingAcrossAffiliatedWebsitesName,
695 flag_descriptions::kFillingAcrossAffiliatedWebsitesDescription,
696 flags_ui::kOsIos,
697 FEATURE_VALUE_TYPE(
698 password_manager::features::kFillingAcrossAffiliatedWebsites)},
Javier Ernesto Flores Robles308150b2021-03-24 20:09:40699 {"default-browser-promo-non-modal",
700 flag_descriptions::kDefaultPromoNonModalName,
701 flag_descriptions::kDefaultPromoNonModalDescription, flags_ui::kOsIos,
Javier Ernesto Flores Robles2b38d802021-05-21 01:19:02702 FEATURE_WITH_PARAMS_VALUE_TYPE(
703 kDefaultPromoNonModal,
704 kDefaultPromoNonModalVariations,
705 "IOSDefaultBrowserNonModalPromoExperiment")},
Javier Ernesto Flores Robles308150b2021-03-24 20:09:40706 {"default-browser-promo-tailored",
707 flag_descriptions::kDefaultPromoTailoredName,
708 flag_descriptions::kDefaultPromoTailoredDescription, flags_ui::kOsIos,
709 FEATURE_WITH_PARAMS_VALUE_TYPE(kDefaultPromoTailored,
710 kDefaultPromoTailoredVariations,
711 "DefaultPromoTailored")},
Jared Sauld47c2b72021-03-25 22:47:31712 {"autofill-parse-merchant-promo-code-fields",
713 flag_descriptions::kAutofillParseMerchantPromoCodeFieldsName,
714 flag_descriptions::kAutofillParseMerchantPromoCodeFieldsDescription,
715 flags_ui::kOsIos,
716 FEATURE_VALUE_TYPE(
717 autofill::features::kAutofillParseMerchantPromoCodeFields)},
harrisonseana9d13042021-03-31 17:21:13718 {"search-history-link-ios", flag_descriptions::kSearchHistoryLinkIOSName,
719 flag_descriptions::kSearchHistoryLinkIOSDescription, flags_ui::kOsIos,
720 FEATURE_VALUE_TYPE(kSearchHistoryLinkIOS)},
edchin257cea2f2021-04-07 13:07:13721 {"interest-feed-v2-clicks-and-views-cond-upload",
722 flag_descriptions::kInterestFeedV2ClickAndViewActionsConditionalUploadName,
723 flag_descriptions::
724 kInterestFeedV2ClickAndViewActionsConditionalUploadDescription,
725 flags_ui::kOsIos,
726 FEATURE_VALUE_TYPE(feed::kInterestFeedV2ClicksAndViewsConditionalUpload)},
Mohammad Refaatbd8bff12021-04-09 17:00:16727 {"tabs-bulkactions-ios", flag_descriptions::kTabsBulkActionsName,
728 flag_descriptions::kTabsBulkActionsDescription, flags_ui::kOsIos,
729 FEATURE_VALUE_TYPE(kTabsBulkActions)},
730 {"tabgrid-context-menu-ios", flag_descriptions::kTabGridContextMenuName,
731 flag_descriptions::kTabGridContextMenuDescription, flags_ui::kOsIos,
732 FEATURE_VALUE_TYPE(kTabGridContextMenu)},
Side Yilmaz0e6c15a2021-04-26 12:55:09733 {"incognito-brand-consistency-for-ios",
734 flag_descriptions::kIncognitoBrandConsistencyForIOSName,
735 flag_descriptions::kIncognitoBrandConsistencyForIOSDescription,
736 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kIncognitoBrandConsistencyForIOS)},
Side Yilmazc0e4a4c62021-05-05 13:41:42737 {"update-history-entry-points-in-incognito",
738 flag_descriptions::kUpdateHistoryEntryPointsInIncognitoName,
739 flag_descriptions::kUpdateHistoryEntryPointsInIncognitoDescription,
740 flags_ui::kOsIos,
741 FEATURE_VALUE_TYPE(kUpdateHistoryEntryPointsInIncognito)},
Victor Hugo Vianna Silvae427a722021-05-07 12:47:36742 {"enable-autofill-account-wallet-storage",
743 flag_descriptions::kEnableAutofillAccountWalletStorageName,
744 flag_descriptions::kEnableAutofillAccountWalletStorageDescription,
745 flags_ui::kOsIos,
746 FEATURE_VALUE_TYPE(
747 autofill::features::kAutofillEnableAccountWalletStorage)},
Chris Lue45c94c62021-05-21 01:32:59748 {"reading-list-messages", flag_descriptions::kReadingListMessagesName,
749 flag_descriptions::kReadingListMessagesDescription, flags_ui::kOsIos,
750 FEATURE_VALUE_TYPE(kReadingListMessages)},
Nohemi Fernandez58baec0f2021-06-10 10:41:36751 {"force-disable-extended-sync-promos",
752 flag_descriptions::kForceDisableExtendedSyncPromosName,
753 flag_descriptions::kForceDisableExtendedSyncPromosDescription,
754 flags_ui::kOsIos,
755 FEATURE_VALUE_TYPE(switches::kForceDisableExtendedSyncPromos)},
756 {"enable-extended-sync-promos-capability",
757 flag_descriptions::kEnableExtendedSyncPromosCapabilityName,
758 flag_descriptions::kEnableExtendedSyncPromosCapabilityDescription,
759 flags_ui::kOsIos, FEATURE_VALUE_TYPE(switches::kMinorModeSupport)},
Ewann1a9d33d2021-06-14 11:12:24760 {"download-mobileconfig-file",
761 flag_descriptions::kDownloadMobileConfigFileName,
762 flag_descriptions::kDownloadMobileConfigFileDescription, flags_ui::kOsIos,
763 FEATURE_VALUE_TYPE(kDownloadMobileConfigFile)},
jlebeld95434d652021-06-22 10:32:48764 {"sync-trusted-vault-passphrase-ios-rpc",
765 flag_descriptions::kSyncTrustedVaultPassphraseiOSRPCName,
766 flag_descriptions::kSyncTrustedVaultPassphraseiOSRPCDescription,
767 flags_ui::kOsIos,
768 FEATURE_VALUE_TYPE(::switches::kSyncTrustedVaultPassphraseiOSRPC)},
Mikel Astiz850b0fe2021-06-16 09:47:27769 {"sync-trusted-vault-passphrase-promo",
770 flag_descriptions::kSyncTrustedVaultPassphrasePromoName,
771 flag_descriptions::kSyncTrustedVaultPassphrasePromoDescription,
772 flags_ui::kOsIos,
773 FEATURE_VALUE_TYPE(::switches::kSyncTrustedVaultPassphrasePromo)},
774 {"sync-trusted-vault-passphrase-recovery",
775 flag_descriptions::kSyncTrustedVaultPassphraseRecoveryName,
776 flag_descriptions::kSyncTrustedVaultPassphraseRecoveryDescription,
777 flags_ui::kOsIos,
778 FEATURE_VALUE_TYPE(::switches::kSyncTrustedVaultPassphraseRecovery)},
Sergio Collazosdaf078b2021-06-26 01:21:52779 {"enable-ntp-memory-enhancement",
780 flag_descriptions::kEnableNTPMemoryEnhancementName,
781 flag_descriptions::kEnableNTPMemoryEnhancementDescription,
782 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableNTPMemoryEnhancement)},
Victor Hugo Vianna Silvacbf44342021-07-01 15:27:59783 {"enable-autofill-save-card-info-bar-account-indication-footer",
784 flag_descriptions::
785 kEnableAutofillSaveCardInfoBarAccountIndicationFooterName,
786 flag_descriptions::
787 kEnableAutofillSaveCardInfoBarAccountIndicationFooterDescription,
788 flags_ui::kOsIos,
789 FEATURE_VALUE_TYPE(
790 autofill::features::
791 kAutofillEnableSaveCardInfoBarAccountIndicationFooter)},
Nohemi Fernandezc00842a2021-07-26 11:47:34792 {"wait-threshold-seconds-for-capabilities-api",
793 flag_descriptions::kWaitThresholdMillisecondsForCapabilitiesApiName,
794 flag_descriptions::kWaitThresholdMillisecondsForCapabilitiesApiDescription,
795 flags_ui::kOsIos,
796 MULTI_VALUE_TYPE(kWaitThresholdMillisecondsForCapabilitiesApiChoices)},
Jared Saul2188f762021-08-02 21:22:23797 {"autofill-fill-merchant-promo-code-fields",
798 flag_descriptions::kAutofillFillMerchantPromoCodeFieldsName,
799 flag_descriptions::kAutofillFillMerchantPromoCodeFieldsDescription,
800 flags_ui::kOsIos,
801 FEATURE_VALUE_TYPE(
802 autofill::features::kAutofillFillMerchantPromoCodeFields)},
Gauthier Ambarde813c07f2020-01-09 10:18:49803};
sdefresne14900ee2015-11-27 14:43:21804
Rohit Raobed794c2020-04-27 15:27:45805bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) {
806 return false;
807}
808
809flags_ui::FlagsState& GetGlobalFlagsState() {
810 static base::NoDestructor<flags_ui::FlagsState> flags_state(kFeatureEntries,
811 nullptr);
812 return *flags_state;
813}
814} // namespace
815
sdefresne14900ee2015-11-27 14:43:21816// Add all switches from experimental flags to |command_line|.
817void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) {
818 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
819
sdefresne14900ee2015-11-27 14:43:21820 // Set the UA flag if UseMobileSafariUA is enabled.
821 if ([defaults boolForKey:@"UseMobileSafariUA"]) {
822 // Safari uses "Vesion/", followed by the OS version excluding bugfix, where
823 // Chrome puts its product token.
avi571943672015-12-22 02:12:49824 int32_t major = 0;
825 int32_t minor = 0;
826 int32_t bugfix = 0;
sdefresne14900ee2015-11-27 14:43:21827 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
828 std::string product = base::StringPrintf("Version/%d.%d", major, minor);
829
Gauthier Ambardba163d42020-05-27 14:48:17830 command_line->AppendSwitchASCII(switches::kUserAgent,
831 web::BuildMobileUserAgent(product));
sdefresne14900ee2015-11-27 14:43:21832 }
833
Guillaume Jenkins25e9bd72020-08-27 17:39:06834 // Shared variables for all enterprise experimental flags.
Guillaume Jenkins57606d72020-08-13 17:32:55835 NSMutableDictionary* testing_policies = [[NSMutableDictionary alloc] init];
Guillaume Jenkins25e9bd72020-08-27 17:39:06836 NSMutableArray* allowed_experimental_policies = [[NSMutableArray alloc] init];
Guillaume Jenkins57606d72020-08-13 17:32:55837
Guillaume Jenkins25e9bd72020-08-27 17:39:06838 // Set some sample policy values for testing if EnableSamplePolicies is set to
839 // true.
Guillaume Jenkinseeb7007c2020-06-25 22:55:40840 if ([defaults boolForKey:@"EnableSamplePolicies"]) {
Guillaume Jenkins5b4d30a2021-02-17 22:13:35841 // Define sample policies to enable. If some of the sample policies are
842 // still marked as experimental (future_on), they must be explicitly
843 // allowed, otherwise they will be ignored in Beta and Stable. Add them to
844 // the |allowed_experimental_policies| array.
Gauthier Ambard21b23702021-04-16 16:11:27845 [allowed_experimental_policies addObjectsFromArray:@[
Gauthier Ambard21b23702021-04-16 16:11:27846 ]];
847
Guillaume Jenkins57606d72020-08-13 17:32:55848 [testing_policies addEntriesFromDictionary:@{
Tina Wang59d0b7e2020-08-11 04:41:01849 base::SysUTF8ToNSString(policy::key::kAutofillAddressEnabled) : @NO,
850
Guillaume Jenkinseeb7007c2020-06-25 22:55:40851 base::SysUTF8ToNSString(policy::key::kAutofillCreditCardEnabled) : @NO,
852
853 // 2 = Disable all variations
854 base::SysUTF8ToNSString(policy::key::kChromeVariations) : @2,
855
856 // 2 = Do not allow any site to show popups
857 base::SysUTF8ToNSString(policy::key::kDefaultPopupsSetting) : @2,
858
Tina Wang5abee802020-07-29 23:09:52859 // Set default search engine.
860 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderEnabled) :
861 @YES,
862 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderSearchURL) :
863 @"http://www.google.com/search?q={searchTerms}",
864 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderName) :
Tina Wang7cd0a062020-09-15 21:31:02865 @"TestEngine",
Tina Wang5abee802020-07-29 23:09:52866
Tina Wang89068c82020-10-29 15:51:50867 base::SysUTF8ToNSString(policy::key::kEditBookmarksEnabled) : @NO,
868
Gauthier Ambard21b23702021-04-16 16:11:27869 base::SysUTF8ToNSString(policy::key::kNTPContentSuggestionsEnabled) : @NO,
870
Guillaume Jenkinseeb7007c2020-06-25 22:55:40871 base::SysUTF8ToNSString(policy::key::kPasswordManagerEnabled) : @NO,
Tina Wang59d0b7e2020-08-11 04:41:01872
873 base::SysUTF8ToNSString(policy::key::kTranslateEnabled) : @NO,
Tina Wang54dddfc22020-08-20 22:34:53874
875 // 2 = Enhanced safe browsing protection
876 base::SysUTF8ToNSString(policy::key::kSafeBrowsingProtectionLevel) : @2,
877
878 base::SysUTF8ToNSString(policy::key::kSearchSuggestEnabled) : @YES,
Guillaume Jenkins72120b12021-02-19 20:08:56879
880 // 0 = browser sign-in disabled
881 base::SysUTF8ToNSString(policy::key::kBrowserSignin) : @0,
Guillaume Jenkins57606d72020-08-13 17:32:55882 }];
883 }
884
Ewann227a3c02021-04-19 12:04:54885 if ([defaults boolForKey:@"EnableSyncDisabledPolicy"]) {
886 [testing_policies addEntriesFromDictionary:@{
887 base::SysUTF8ToNSString(policy::key::kSyncDisabled) : @YES
888 }];
Guillaume Jenkinsfe46d3a2021-04-26 19:51:04889 NSString* sync_policy_key =
890 base::SysUTF8ToNSString(policy::key::kSyncDisabled);
891 [allowed_experimental_policies addObject:sync_policy_key];
Ewann227a3c02021-04-19 12:04:54892 }
Ewann227a3c02021-04-19 12:04:54893
Tina Wangc6bcf572021-01-27 18:15:52894 // If an incognito mode availability is set, add the policy key to the list of
895 // allowed experimental policies, and set the value.
896 NSString* incognito_policy_key =
897 base::SysUTF8ToNSString(policy::key::kIncognitoModeAvailability);
898 NSInteger incognito_mode_availability =
899 [defaults integerForKey:incognito_policy_key];
900 if (incognito_mode_availability) {
901 [allowed_experimental_policies addObject:incognito_policy_key];
902 [testing_policies addEntriesFromDictionary:@{
903 incognito_policy_key : @(incognito_mode_availability),
904 }];
905 }
906
Guillaume Jenkins57606d72020-08-13 17:32:55907 // If a CBCM enrollment token is provided, force Chrome Browser Cloud
Guillaume Jenkins5b4d30a2021-02-17 22:13:35908 // Management to enabled and add the token to the list of policies.
Guillaume Jenkins57606d72020-08-13 17:32:55909 NSString* token_key =
910 base::SysUTF8ToNSString(policy::key::kCloudManagementEnrollmentToken);
911 NSString* token = [defaults stringForKey:token_key];
912
913 if ([token length] > 0) {
914 command_line->AppendSwitch(switches::kEnableChromeBrowserCloudManagement);
915 [testing_policies setValue:token forKey:token_key];
916 }
917
Ewann40a8f8a2021-07-29 10:01:20918 NSString* restriction_pattern =
919 [defaults stringForKey:@"RestrictAccountsToPatterns"];
920 if ([restriction_pattern length] > 0) {
921 [testing_policies addEntriesFromDictionary:@{
922 base::SysUTF8ToNSString(policy::key::kRestrictAccountsToPatterns) :
923 @[ restriction_pattern ]
924 }];
925 }
926
Guillaume Jenkins25e9bd72020-08-27 17:39:06927 // If any experimental policy was allowed, set the EnableExperimentalPolicies
928 // policy.
929 if ([allowed_experimental_policies count] > 0) {
930 [testing_policies setValue:allowed_experimental_policies
931 forKey:base::SysUTF8ToNSString(
932 policy::key::kEnableExperimentalPolicies)];
933 }
934
Guillaume Jenkins57606d72020-08-13 17:32:55935 // If some policies were set, commit them to the app's registration defaults.
936 if ([testing_policies count] > 0) {
Guillaume Jenkinseeb7007c2020-06-25 22:55:40937 NSDictionary* registration_defaults =
938 @{kPolicyLoaderIOSConfigurationKey : testing_policies};
939 [defaults registerDefaults:registration_defaults];
940 }
941
sdefresne14900ee2015-11-27 14:43:21942 // Freeform commandline flags. These are added last, so that any flags added
943 // earlier in this function take precedence.
944 if ([defaults boolForKey:@"EnableFreeformCommandLineFlags"]) {
945 base::CommandLine::StringVector flags;
946 // Append an empty "program" argument.
947 flags.push_back("");
948
949 // The number of flags corresponds to the number of text fields in
950 // Experimental.plist.
951 const int kNumFreeformFlags = 5;
952 for (int i = 1; i <= kNumFreeformFlags; ++i) {
953 NSString* key =
954 [NSString stringWithFormat:@"FreeformCommandLineFlag%d", i];
955 NSString* flag = [defaults stringForKey:key];
956 if ([flag length]) {
Robbie Gibsonc91ce622019-05-20 14:44:33957 // iOS keyboard replaces -- with —, so undo that.
958 flag = [flag stringByReplacingOccurrencesOfString:@"—"
959 withString:@"--"
960 options:0
961 range:NSMakeRange(0, 1)];
962 // To make things easier, allow flags with no dashes by prepending them
963 // here. This also allows for flags that just have one dash if they
964 // exist.
965 if (![flag hasPrefix:@"-"]) {
966 flag = [@"--" stringByAppendingString:flag];
967 }
sdefresne14900ee2015-11-27 14:43:21968 flags.push_back(base::SysNSStringToUTF8(flag));
969 }
970 }
971
972 base::CommandLine temp_command_line(flags);
973 command_line->AppendArguments(temp_command_line, false);
974 }
msardafc76f662017-02-24 12:46:28975
justincohendacc85d2017-06-28 23:34:10976 // Populate command line flag for 3rd party keyboard omnibox workaround.
977 NSString* enableThirdPartyKeyboardWorkaround =
978 [defaults stringForKey:@"EnableThirdPartyKeyboardWorkaround"];
979 if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Enabled"]) {
980 command_line->AppendSwitch(switches::kEnableThirdPartyKeyboardWorkaround);
981 } else if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Disabled"]) {
982 command_line->AppendSwitch(switches::kDisableThirdPartyKeyboardWorkaround);
983 }
984
Sylvain Defresne25e69d22021-07-08 13:40:49985 ios::GetChromeBrowserProvider().AppendSwitchesFromExperimentalSettings(
msardafc76f662017-02-24 12:46:28986 defaults, command_line);
sdefresne14900ee2015-11-27 14:43:21987}
988
sdefresne14900ee2015-11-27 14:43:21989void ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage,
990 base::CommandLine* command_line) {
Sylvain Defresne8327a2f2019-01-17 14:19:18991 GetGlobalFlagsState().ConvertFlagsToSwitches(
sdefresnec9763902015-12-02 10:30:11992 flags_storage, command_line, flags_ui::kAddSentinels,
Gregory Chatzinofff6523722017-11-21 01:33:53993 switches::kEnableFeatures, switches::kDisableFeatures);
sdefresne14900ee2015-11-27 14:43:21994}
995
jkrcalbf073372016-07-29 07:21:31996std::vector<std::string> RegisterAllFeatureVariationParameters(
997 flags_ui::FlagsStorage* flags_storage,
998 base::FeatureList* feature_list) {
Justin Cohen2e2adb52019-10-25 17:00:02999 // Occasionally DCHECK crashes on canary can be very distuptive. An
1000 // experimental flag was added to aid in temporarily disabling this for
1001 // canary testers.
1002#if defined(DCHECK_IS_CONFIGURABLE)
1003 if (experimental_flags::AreDCHECKCrashesDisabled()) {
1004 std::vector<base::FeatureList::FeatureOverrideInfo> overrides;
1005 overrides.push_back(
1006 {std::cref(base::kDCheckIsFatalFeature),
1007 base::FeatureList::OverrideState::OVERRIDE_DISABLE_FEATURE});
1008 feature_list->RegisterExtraFeatureOverrides(std::move(overrides));
1009 }
1010#endif // defined(DCHECK_IS_CONFIGURABLE)
1011
Sylvain Defresne8327a2f2019-01-17 14:19:181012 return GetGlobalFlagsState().RegisterAllFeatureVariationParameters(
1013 flags_storage, feature_list);
jkrcalbf073372016-07-29 07:21:311014}
1015
sdefresne14900ee2015-11-27 14:43:211016void GetFlagFeatureEntries(flags_ui::FlagsStorage* flags_storage,
1017 flags_ui::FlagAccess access,
Morten Stenshorne7afa5802021-07-15 10:04:431018 base::Value::ListStorage& supported_entries,
1019 base::Value::ListStorage& unsupported_entries) {
Sylvain Defresne8327a2f2019-01-17 14:19:181020 GetGlobalFlagsState().GetFlagFeatureEntries(
sdefresne14900ee2015-11-27 14:43:211021 flags_storage, access, supported_entries, unsupported_entries,
Renjie Tang208c8192020-11-03 00:46:511022 base::BindRepeating(&SkipConditionalFeatureEntry));
sdefresne14900ee2015-11-27 14:43:211023}
1024
1025void SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage,
1026 const std::string& internal_name,
1027 bool enable) {
Sylvain Defresne8327a2f2019-01-17 14:19:181028 GetGlobalFlagsState().SetFeatureEntryEnabled(flags_storage, internal_name,
1029 enable);
sdefresne14900ee2015-11-27 14:43:211030}
1031
1032void ResetAllFlags(flags_ui::FlagsStorage* flags_storage) {
Sylvain Defresne8327a2f2019-01-17 14:19:181033 GetGlobalFlagsState().ResetAllFlags(flags_storage);
sdefresne14900ee2015-11-27 14:43:211034}
1035
1036namespace testing {
1037
1038const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) {
kokihoon189a4022018-10-13 02:43:441039 *count = base::size(kFeatureEntries);
sdefresne14900ee2015-11-27 14:43:211040 return kFeatureEntries;
1041}
1042
1043} // namespace testing