blob: 3523871482d6b44c57ed42631660e43c8e13d6d6 [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"
Sylvain Defresne8327a2f2019-01-17 14:19:1819#include "base/no_destructor.h"
kokihoon189a4022018-10-13 02:43:4420#include "base/stl_util.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"
Robbie Gibson5e3436632020-04-27 15:48:0428#include "components/content_settings/core/common/features.h"
sdefresne14900ee2015-11-27 14:43:2129#include "components/dom_distiller/core/dom_distiller_switches.h"
Guillaume Jenkins4e6ac1e2020-11-11 16:57:4030#include "components/enterprise/browser/enterprise_switches.h"
Tommy Nyquistc1d6dea12017-07-26 20:37:2331#include "components/feature_engagement/public/feature_constants.h"
32#include "components/feature_engagement/public/feature_list.h"
sdefresne14900ee2015-11-27 14:43:2133#include "components/flags_ui/feature_entry.h"
34#include "components/flags_ui/feature_entry_macros.h"
35#include "components/flags_ui/flags_storage.h"
36#include "components/flags_ui/flags_ui_switches.h"
sczs27e389e2020-01-15 15:19:1837#include "components/infobars/core/infobar_feature.h"
Tanja Gornakb0985dd2018-10-11 17:24:4038#include "components/invalidation/impl/invalidation_switches.h"
noyau4cfb1332016-10-25 17:05:4239#include "components/ntp_tiles/switches.h"
Justin Donnelly33d712e2017-08-23 21:32:5140#include "components/omnibox/browser/omnibox_field_trial.h"
Tomasz Wiszkowskid938a1112019-03-06 18:01:5741#include "components/omnibox/common/omnibox_features.h"
Ioana Pandeled14ce9e2017-11-28 14:41:4642#include "components/password_manager/core/common/password_manager_features.h"
mathp9b4c11d2017-07-06 20:24:1343#include "components/payments/core/features.h"
Guillaume Jenkinseeb7007c2020-06-25 22:55:4044#import "components/policy/core/common/policy_loader_ios_constants.h"
45#include "components/policy/policy_constants.h"
Emily Starkbafa9062017-12-27 15:22:4646#include "components/security_state/core/features.h"
Sébastien Séguin-Gagnondcb854b2019-04-10 16:36:4447#include "components/send_tab_to_self/features.h"
Valeriya Sinevicha79dc612018-09-25 14:49:0948#include "components/signin/core/browser/account_reconcilor.h"
Jérôme Lebelc374fdd2019-09-27 10:36:4849#include "components/signin/ios/browser/features.h"
Nohemi Fernandez983d6d52020-09-09 09:46:1950#include "components/signin/public/base/account_consistency_method.h"
Colin Blundell3517170e2019-07-11 08:16:3451#include "components/signin/public/base/signin_switches.h"
sdefresne36579782016-02-05 11:08:2552#include "components/strings/grit/components_strings.h"
Rushan Suleymanov988ad372020-07-26 19:10:0853#include "components/sync/base/sync_base_switches.h"
Moe Ahmadid6d5d172018-06-20 17:20:2354#include "components/sync/driver/sync_driver_switches.h"
Moe Ahmadie4cce1f2018-12-18 23:48:0155#include "components/translate/core/browser/translate_prefs.h"
Chris Lu0683adf2019-02-26 15:56:4556#include "components/ukm/ios/features.h"
Sylvain Defresneae6987e2018-03-01 13:21:4057#include "ios/chrome/browser/browsing_data/browsing_data_features.h"
sdefresne14900ee2015-11-27 14:43:2158#include "ios/chrome/browser/chrome_switches.h"
Mike Doughertyb6c770d2019-09-13 22:56:4659#include "ios/chrome/browser/crash_report/breadcrumbs/features.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"
Ewann163e3952020-08-21 12:34:4962#import "ios/chrome/browser/open_in/features.h"
edchin68696842020-04-09 17:19:3163#include "ios/chrome/browser/policy/policy_features.h"
Sylvain Defresne9c107082020-10-27 16:39:1364#include "ios/chrome/browser/screen_time/screen_time_buildflags.h"
Gauthier Ambard33e03302019-02-21 13:28:5865#include "ios/chrome/browser/system_flags.h"
adamta22a4d502020-05-21 03:12:2166#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h"
Kurt Horimoto4da682b022018-04-12 07:43:3567#import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
sczs80a6f462018-12-05 20:37:1868#import "ios/chrome/browser/ui/infobars/infobar_feature.h"
adamta273568472020-12-04 23:53:5769#import "ios/chrome/browser/ui/ntp/new_tab_page_feature.h"
Nazerke0bf10c42020-11-12 11:17:3270#import "ios/chrome/browser/ui/tab_switcher/tab_grid/features.h"
sczs76b9ba02019-07-23 23:34:3071#import "ios/chrome/browser/ui/table_view/feature_flags.h"
Kurt Horimoto79d590b2018-09-12 19:09:2872#import "ios/chrome/browser/ui/toolbar_container/toolbar_container_features.h"
Justin Cohen2d81c582018-01-22 14:46:4473#include "ios/chrome/browser/ui/ui_feature_flags.h"
Yi Su392b3032018-06-05 07:26:4774#include "ios/chrome/browser/web/features.h"
sdefresne14900ee2015-11-27 14:43:2175#include "ios/chrome/grit/ios_strings.h"
msardafc76f662017-02-24 12:46:2876#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
Eugene But61818bc2019-04-15 21:04:0777#include "ios/web/common/features.h"
Eugene Bute79f2742019-07-26 17:07:2278#include "ios/web/common/user_agent.h"
Eugene Butb1416232019-07-22 17:31:5879#include "ios/web/common/web_view_creation_util.h"
sdefresne14900ee2015-11-27 14:43:2180
Sylvain Defresne9c107082020-10-27 16:39:1381#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
82#include "ios/chrome/browser/screen_time/features.h"
83#endif
84
sdefresne14900ee2015-11-27 14:43:2185#if !defined(OFFICIAL_BUILD)
86#include "components/variations/variations_switches.h"
vitaliii489217aa2017-01-30 14:50:2287#endif
stkhapuginc1be1792016-12-13 14:30:5388
89#if !defined(__has_feature) || !__has_feature(objc_arc)
90#error "This file requires ARC support."
91#endif
sdefresne14900ee2015-11-27 14:43:2192
elawrence816f6790e2017-06-16 18:19:2893using flags_ui::FeatureEntry;
94
sdefresne14900ee2015-11-27 14:43:2195namespace {
Emily Starkbafa9062017-12-27 15:22:4696
Olivier Robin3d60411622018-02-23 10:03:2297const FeatureEntry::Choice kAutofillIOSDelayBetweenFieldsChoices[] = {
98 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
99 {"0", autofill::switches::kAutofillIOSDelayBetweenFields, "0"},
100 {"10", autofill::switches::kAutofillIOSDelayBetweenFields, "10"},
101 {"20", autofill::switches::kAutofillIOSDelayBetweenFields, "20"},
102 {"50", autofill::switches::kAutofillIOSDelayBetweenFields, "50"},
103 {"100", autofill::switches::kAutofillIOSDelayBetweenFields, "100"},
104 {"200", autofill::switches::kAutofillIOSDelayBetweenFields, "200"},
105 {"500", autofill::switches::kAutofillIOSDelayBetweenFields, "500"},
106 {"1000", autofill::switches::kAutofillIOSDelayBetweenFields, "1000"},
107};
108
Nohemi Fernandez222d6d42020-09-30 20:35:57109const FeatureEntry::Choice kDelayThresholdMinutesToUpdateGaiaCookieChoices[] = {
110 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
111 {"0", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "0"},
112 {"10", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "10"},
113 {"60", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "60"},
114};
115
Ce Chenc8d803a2020-04-27 09:31:33116const FeatureEntry::FeatureVariation
Ce Chenc8d803a2020-04-27 09:31:33117 kOmniboxOnDeviceHeadSuggestNonIncognitoExperimentVariations[] = {
118 {
119 "relevance-1000",
120 (FeatureEntry::FeatureParam[]){
121 {OmniboxFieldTrial::kOnDeviceHeadSuggestMaxScoreForNonUrlInput,
122 "1000"},
123 {OmniboxFieldTrial::kOnDeviceHeadSuggestDemoteMode,
124 "decrease-relevances"}},
125 2,
126 nullptr,
127 },
128 {
129 "request-delay-100ms",
130 (FeatureEntry::FeatureParam[]){
131 {OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs,
132 "100"}},
133 1,
134 nullptr,
135 },
136 {
137 "delay-100ms-relevance-1000",
138 (FeatureEntry::FeatureParam[]){
139 {OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs,
140 "100"},
141 {OmniboxFieldTrial::kOnDeviceHeadSuggestMaxScoreForNonUrlInput,
142 "1000"},
143 {OmniboxFieldTrial::kOnDeviceHeadSuggestDemoteMode,
144 "decrease-relevances"}},
145 3,
146 nullptr,
147 },
148 {
149 "request-delay-200ms",
150 (FeatureEntry::FeatureParam[]){
151 {OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs,
152 "200"}},
153 1,
154 nullptr,
155 },
156 {
157 "delay-200ms-relevance-1000",
158 (FeatureEntry::FeatureParam[]){
159 {OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs,
160 "200"},
161 {OmniboxFieldTrial::kOnDeviceHeadSuggestMaxScoreForNonUrlInput,
162 "1000"},
163 {OmniboxFieldTrial::kOnDeviceHeadSuggestDemoteMode,
164 "decrease-relevances"}},
165 3,
166 nullptr,
167 }};
Ce Chen104a5382019-12-10 01:09:05168
Stepan Khapugincc4e9842019-01-23 13:38:13169const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches3[] = {
170 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "3"}};
171const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches4[] = {
172 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "4"}};
173const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches5[] = {
174 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "5"}};
175const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches6[] = {
176 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "6"}};
177const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches8[] = {
178 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "8"}};
179const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches10[] = {
180 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "10"}};
181const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches12[] = {
182 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "12"}};
183
184const FeatureEntry::FeatureVariation
185 kOmniboxUIMaxAutocompleteMatchesVariations[] = {
186 {"3 matches", kOmniboxUIMaxAutocompleteMatches3,
187 base::size(kOmniboxUIMaxAutocompleteMatches3), nullptr},
188 {"4 matches", kOmniboxUIMaxAutocompleteMatches4,
189 base::size(kOmniboxUIMaxAutocompleteMatches4), nullptr},
190 {"5 matches", kOmniboxUIMaxAutocompleteMatches5,
191 base::size(kOmniboxUIMaxAutocompleteMatches5), nullptr},
192 {"6 matches", kOmniboxUIMaxAutocompleteMatches6,
193 base::size(kOmniboxUIMaxAutocompleteMatches6), nullptr},
194 {"8 matches", kOmniboxUIMaxAutocompleteMatches8,
195 base::size(kOmniboxUIMaxAutocompleteMatches8), nullptr},
196 {"10 matches", kOmniboxUIMaxAutocompleteMatches10,
197 base::size(kOmniboxUIMaxAutocompleteMatches10), nullptr},
198 {"12 matches", kOmniboxUIMaxAutocompleteMatches12,
199 base::size(kOmniboxUIMaxAutocompleteMatches12), nullptr}};
200
Caitlin Fischer37e01232019-05-24 13:05:45201const FeatureEntry::FeatureParam
202 kAutofillUseMobileLabelDisambiguationShowAll[] = {
203 {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName,
204 autofill::features::
205 kAutofillUseMobileLabelDisambiguationParameterShowAll}};
206const FeatureEntry::FeatureParam
207 kAutofillUseMobileLabelDisambiguationShowOne[] = {
208 {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName,
209 autofill::features::
210 kAutofillUseMobileLabelDisambiguationParameterShowOne}};
211
212const FeatureEntry::FeatureVariation
213 kAutofillUseMobileLabelDisambiguationVariations[] = {
214 {"(show all)", kAutofillUseMobileLabelDisambiguationShowAll,
215 base::size(kAutofillUseMobileLabelDisambiguationShowAll), nullptr},
216 {"(show one)", kAutofillUseMobileLabelDisambiguationShowOne,
217 base::size(kAutofillUseMobileLabelDisambiguationShowOne), nullptr}};
218
gogeralddb0d8ae2020-11-13 03:56:58219const FeatureEntry::FeatureParam kDiscoverFeedInNtpEnableNativeUI[] = {
220 {kDiscoverFeedIsNativeUIEnabled, "true"}};
221const FeatureEntry::FeatureVariation kDiscoverFeedInNtpVariations[] = {
222 {"Native UI", kDiscoverFeedInNtpEnableNativeUI,
223 base::size(kDiscoverFeedInNtpEnableNativeUI), nullptr}};
224
Cooper Knaak1e026562017-07-26 05:22:28225// To add a new entry, add to the end of kFeatureEntries. There are four
sdefresne14900ee2015-11-27 14:43:21226// distinct types of entries:
Cooper Knaak1e026562017-07-26 05:22:28227// . ENABLE_DISABLE_VALUE: entry is either enabled, disabled, or uses the
228// default value for this feature. Use the ENABLE_DISABLE_VALUE_TYPE
sdefresne14900ee2015-11-27 14:43:21229// macro for this type supplying the command line to the macro.
230// . MULTI_VALUE: a list of choices, the first of which should correspond to a
231// deactivated state for this lab (i.e. no command line option). To specify
232// this type of entry use the macro MULTI_VALUE_TYPE supplying it the
233// array of choices.
Cooper Knaak1e026562017-07-26 05:22:28234// . FEATURE_VALUE: entry is associated with a base::Feature instance. Entry is
235// either enabled, disabled, or uses the default value of the associated
236// base::Feature instance. To specify this type of entry use the macro
237// FEATURE_VALUE_TYPE supplying it the base::Feature instance.
238// . FEATURE_WITH_PARAM_VALUES: a list of choices associated with a
239// base::Feature instance. Choices corresponding to the default state, a
240// universally enabled state, and a universally disabled state are
241// automatically included. To specify this type of entry use the macro
242// FEATURE_WITH_PARAMS_VALUE_TYPE supplying it the base::Feature instance and
243// the array of choices.
244//
sdefresne14900ee2015-11-27 14:43:21245// See the documentation of FeatureEntry for details on the fields.
246//
247// When adding a new choice, add it to the end of the list.
248const flags_ui::FeatureEntry kFeatureEntries[] = {
Cooper Knaak1e026562017-07-26 05:22:28249 {"in-product-help-demo-mode-choice",
250 flag_descriptions::kInProductHelpDemoModeName,
251 flag_descriptions::kInProductHelpDemoModeDescription, flags_ui::kOsIos,
252 FEATURE_WITH_PARAMS_VALUE_TYPE(
Tommy Nyquistc1d6dea12017-07-26 20:37:23253 feature_engagement::kIPHDemoMode,
254 feature_engagement::kIPHDemoModeChoiceVariations,
Marc Treib2752e8b2017-08-04 14:12:09255 "IPH_DemoMode")},
Moe Ahmadic3fd7cd2018-05-11 21:40:22256 {"enable-autofill-credit-card-upload",
257 flag_descriptions::kAutofillCreditCardUploadName,
258 flag_descriptions::kAutofillCreditCardUploadDescription, flags_ui::kOsIos,
Anne Lim579b5732018-08-30 18:24:24259 FEATURE_VALUE_TYPE(autofill::features::kAutofillUpstream)},
Moe Ahmadid6d5d172018-06-20 17:20:23260 {"use-sync-sandbox", flag_descriptions::kSyncSandboxName,
261 flag_descriptions::kSyncSandboxDescription, flags_ui::kOsIos,
262 SINGLE_VALUE_TYPE_AND_VALUE(
263 switches::kSyncServiceURL,
264 "https://chrome-sync.sandbox.google.com/chrome-sync/alpha")},
265 {"wallet-service-use-sandbox",
266 flag_descriptions::kWalletServiceUseSandboxName,
267 flag_descriptions::kWalletServiceUseSandboxDescription, flags_ui::kOsIos,
268 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(
269 autofill::switches::kWalletServiceUseSandbox,
270 "1",
271 autofill::switches::kWalletServiceUseSandbox,
272 "0")},
Mohamad Ahmadic4df81f2017-12-20 04:41:59273 {"show-autofill-type-predictions",
274 flag_descriptions::kShowAutofillTypePredictionsName,
275 flag_descriptions::kShowAutofillTypePredictionsDescription,
276 flags_ui::kOsIos,
Gauthier Ambardcfd85182018-01-05 10:37:46277 FEATURE_VALUE_TYPE(autofill::features::kAutofillShowTypePredictions)},
Olivier Robin3d60411622018-02-23 10:03:22278 {"autofill-ios-delay-between-fields",
279 flag_descriptions::kAutofillIOSDelayBetweenFieldsName,
280 flag_descriptions::kAutofillIOSDelayBetweenFieldsDescription,
281 flags_ui::kOsIos, MULTI_VALUE_TYPE(kAutofillIOSDelayBetweenFieldsChoices)},
Moe Ahmadid3ddfcb2018-04-20 19:51:08282 {"autofill-restrict-formless-form-extraction",
283 flag_descriptions::kAutofillRestrictUnownedFieldsToFormlessCheckoutName,
284 flag_descriptions::
285 kAutofillRestrictUnownedFieldsToFormlessCheckoutDescription,
286 flags_ui::kOsIos,
287 FEATURE_VALUE_TYPE(
288 autofill::features::kAutofillRestrictUnownedFieldsToFormlessCheckout)},
Roger McFarlanee193ab122018-11-22 20:55:07289 {"autofill-rich-metadata-queries",
290 flag_descriptions::kAutofillRichMetadataQueriesName,
291 flag_descriptions::kAutofillRichMetadataQueriesDescription,
292 flags_ui::kOsIos,
293 FEATURE_VALUE_TYPE(autofill::features::kAutofillRichMetadataQueries)},
Kurt Horimotodc33af32018-05-01 01:39:14294 {"fullscreen-viewport-adjustment-experiment",
Chris Lu481a9322019-09-25 22:16:53295 flag_descriptions::kFullscreenSmoothScrollingName,
296 flag_descriptions::kFullscreenSmoothScrollingDescription, flags_ui::kOsIos,
297 FEATURE_VALUE_TYPE(fullscreen::features::kSmoothScrollingDefault)},
Roger McFarlane2eceba982018-05-18 01:37:11298 {"autofill-cache-query-responses",
299 flag_descriptions::kAutofillCacheQueryResponsesName,
300 flag_descriptions::kAutofillCacheQueryResponsesDescription,
301 flags_ui::kOsIos,
302 FEATURE_VALUE_TYPE(autofill::features::kAutofillCacheQueryResponses)},
Robbie Gibson1f37a5e2020-08-06 17:03:06303 {"webpage-default-zoom-from-dynamic-type",
304 flag_descriptions::kWebPageDefaultZoomFromDynamicTypeName,
305 flag_descriptions::kWebPageDefaultZoomFromDynamicTypeDescription,
306 flags_ui::kOsIos,
307 FEATURE_VALUE_TYPE(web::kWebPageDefaultZoomFromDynamicType)},
Yi Su392b3032018-06-05 07:26:47308 {"webpage-text-accessibility",
309 flag_descriptions::kWebPageTextAccessibilityName,
310 flag_descriptions::kWebPageTextAccessibilityDescription, flags_ui::kOsIos,
311 FEATURE_VALUE_TYPE(web::kWebPageTextAccessibility)},
Robbie Gibson88f23962020-09-28 14:35:56312 {"webpage-alternative-text-zoom",
313 flag_descriptions::kWebPageAlternativeTextZoomName,
314 flag_descriptions::kWebPageAlternativeTextZoomDescription,
315 flags_ui::kOsIos, FEATURE_VALUE_TYPE(web::kWebPageAlternativeTextZoom)},
Kurt Horimoto79d590b2018-09-12 19:09:28316 {"toolbar-container", flag_descriptions::kToolbarContainerName,
317 flag_descriptions::kToolbarContainerDescription, flags_ui::kOsIos,
318 FEATURE_VALUE_TYPE(toolbar_container::kToolbarContainerEnabled)},
Ce Chenc8d803a2020-04-27 09:31:33319 {"omnibox-on-device-head-suggestions-incognito",
320 flag_descriptions::kOmniboxOnDeviceHeadSuggestionsIncognitoName,
321 flag_descriptions::kOmniboxOnDeviceHeadSuggestionsIncognitoDescription,
Ce Chen104a5382019-12-10 01:09:05322 flags_ui::kOsIos,
Ce Chend565f71f2020-08-12 01:15:53323 FEATURE_VALUE_TYPE(omnibox::kOnDeviceHeadProviderIncognito)},
Ce Chenc8d803a2020-04-27 09:31:33324 {"omnibox-on-device-head-suggestions-non-incognito",
325 flag_descriptions::kOmniboxOnDeviceHeadSuggestionsNonIncognitoName,
326 flag_descriptions::kOmniboxOnDeviceHeadSuggestionsNonIncognitoDescription,
327 flags_ui::kOsIos,
328 FEATURE_WITH_PARAMS_VALUE_TYPE(
329 omnibox::kOnDeviceHeadProviderNonIncognito,
330 kOmniboxOnDeviceHeadSuggestNonIncognitoExperimentVariations,
331 "OmniboxOnDeviceHeadSuggestNonIncognitoIOS")},
Stepan Khapugincc4e9842019-01-23 13:38:13332 {"omnibox-ui-max-autocomplete-matches",
333 flag_descriptions::kOmniboxUIMaxAutocompleteMatchesName,
334 flag_descriptions::kOmniboxUIMaxAutocompleteMatchesDescription,
335 flags_ui::kOsIos,
336 FEATURE_WITH_PARAMS_VALUE_TYPE(
337 omnibox::kUIExperimentMaxAutocompleteMatches,
338 kOmniboxUIMaxAutocompleteMatchesVariations,
339 "OmniboxUIMaxAutocompleteVariations")},
Robbie Gibson84f1ddc2020-12-10 21:41:28340 {"omnibox-local-history-zero-suggest",
341 flag_descriptions::kOmniboxLocalHistoryZeroSuggestName,
342 flag_descriptions::kOmniboxLocalHistoryZeroSuggestDescription,
343 flags_ui::kOsIos, FEATURE_VALUE_TYPE(omnibox::kLocalHistoryZeroSuggest)},
sczs80a6f462018-12-05 20:37:18344 {"infobar-ui-reboot", flag_descriptions::kInfobarUIRebootName,
345 flag_descriptions::kInfobarUIRebootDescription, flags_ui::kOsIos,
sczs27e389e2020-01-15 15:19:18346 FEATURE_VALUE_TYPE(kIOSInfobarUIReboot)},
edchin5ae0b4c2019-01-06 06:52:28347 {"snapshot-draw-view", flag_descriptions::kSnapshotDrawViewName,
348 flag_descriptions::kSnapshotDrawViewDescription, flags_ui::kOsIos,
349 FEATURE_VALUE_TYPE(kSnapshotDrawView)},
Justin Cohen20b6f072019-01-16 01:38:50350#if defined(DCHECK_IS_CONFIGURABLE)
351 {"dcheck-is-fatal", flag_descriptions::kDcheckIsFatalName,
352 flag_descriptions::kDcheckIsFatalDescription, flags_ui::kOsIos,
353 FEATURE_VALUE_TYPE(base::kDCheckIsFatalFeature)},
354#endif // defined(DCHECK_IS_CONFIGURABLE)
Gauthier Ambard5f610862019-01-17 11:43:55355 {"settings-refresh", flag_descriptions::kSettingsRefreshName,
356 flag_descriptions::kSettingsRefreshDescription, flags_ui::kOsIos,
357 FEATURE_VALUE_TYPE(kSettingsRefresh)},
Chris Lu8153e6e2019-03-26 16:28:21358 {"send-uma-cellular", flag_descriptions::kSendUmaOverAnyNetwork,
359 flag_descriptions::kSendUmaOverAnyNetworkDescription, flags_ui::kOsIos,
Chris Lu0683adf2019-02-26 15:56:45360 FEATURE_VALUE_TYPE(kUmaCellular)},
Caitlin Fischer43edd90a2019-05-01 13:24:30361 {"autofill-use-mobile-label-disambiguation",
362 flag_descriptions::kAutofillUseMobileLabelDisambiguationName,
363 flag_descriptions::kAutofillUseMobileLabelDisambiguationDescription,
364 flags_ui::kOsIos,
Caitlin Fischer37e01232019-05-24 13:05:45365 FEATURE_WITH_PARAMS_VALUE_TYPE(
366 autofill::features::kAutofillUseMobileLabelDisambiguation,
367 kAutofillUseMobileLabelDisambiguationVariations,
368 "AutofillUseMobileLabelDisambiguation")},
edchinb5d92582020-03-11 15:26:11369 {"autofill-prune-suggestions",
Caitlin Fischer6d609542019-05-01 21:59:21370 flag_descriptions::kAutofillPruneSuggestionsName,
371 flag_descriptions::kAutofillPruneSuggestionsDescription, flags_ui::kOsIos,
372 FEATURE_VALUE_TYPE(autofill::features::kAutofillPruneSuggestions)},
sczs76b9ba02019-07-23 23:34:30373 {"collections-card-presentation-style",
374 flag_descriptions::kCollectionsCardPresentationStyleName,
375 flag_descriptions::kCollectionsCardPresentationStyleDescription,
376 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kCollectionsCardPresentationStyle)},
Mike Doughertyb6c770d2019-09-13 22:56:46377 {"ios-breadcrumbs", flag_descriptions::kLogBreadcrumbsName,
378 flag_descriptions::kLogBreadcrumbsDescription, flags_ui::kOsIos,
379 FEATURE_VALUE_TYPE(kLogBreadcrumbs)},
Eugene But2823dc7e2020-07-21 18:10:37380 {"ios-synthetic-crash-reports",
381 flag_descriptions::kSyntheticCrashReportsForUteName,
382 flag_descriptions::kSyntheticCrashReportsForUteDescription,
383 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kSyntheticCrashReportsForUte)},
Jérôme Lebelc374fdd2019-09-27 10:36:48384 {"force-startup-signin-promo",
385 flag_descriptions::kForceStartupSigninPromoName,
386 flag_descriptions::kForceStartupSigninPromoDescription, flags_ui::kOsIos,
387 FEATURE_VALUE_TYPE(signin::kForceStartupSigninPromo)},
Justin Cohenc57413a2019-09-30 19:42:29388 {"embedder-block-restore-url",
389 flag_descriptions::kEmbedderBlockRestoreUrlName,
390 flag_descriptions::kEmbedderBlockRestoreUrlDescription, flags_ui::kOsIos,
391 FEATURE_VALUE_TYPE(kEmbedderBlockRestoreUrl)},
sczs004fa6c2019-10-18 17:22:52392 {"messages-save-card-infobar",
393 flag_descriptions::kSaveCardInfobarMessagesUIName,
394 flag_descriptions::kSaveCardInfobarMessagesUIDescription, flags_ui::kOsIos,
395 FEATURE_VALUE_TYPE(kSaveCardInfobarMessagesUI)},
Chris Lu4cc111b452019-10-18 22:18:48396 {"messages-translate-infobar",
397 flag_descriptions::kTranslateInfobarMessagesUIName,
398 flag_descriptions::kTranslateInfobarMessagesUIDescription,
399 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kTranslateInfobarMessagesUI)},
sczs4622e6e2019-11-06 01:17:59400 {"autofill-save-card-dismiss-on-navigation",
401 flag_descriptions::kAutofillSaveCardDismissOnNavigationName,
402 flag_descriptions::kAutofillSaveCardDismissOnNavigationDescription,
403 flags_ui::kOsIos,
404 FEATURE_VALUE_TYPE(
405 autofill::features::kAutofillSaveCardDismissOnNavigation)},
Rohit Raoe7b489312019-11-12 12:28:55406 {"force-unstacked-tabstrip", flag_descriptions::kForceUnstackedTabstripName,
407 flag_descriptions::kForceUnstackedTabstripDescription, flags_ui::kOsIos,
408 FEATURE_VALUE_TYPE(kForceUnstackedTabstrip)},
Gauthier Ambard93914002019-11-14 12:56:12409 {"use-js-error-page", flag_descriptions::kUseJSForErrorPageName,
410 flag_descriptions::kUseJSForErrorPageDescription, flags_ui::kOsIos,
411 FEATURE_VALUE_TYPE(web::features::kUseJSForErrorPage)},
Gauthier Ambardbde9def2019-11-19 18:04:33412 {"desktop-version-default", flag_descriptions::kDefaultToDesktopOnIPadName,
413 flag_descriptions::kDefaultToDesktopOnIPadDescription, flags_ui::kOsIos,
Gauthier Ambard054175f2019-12-16 11:54:09414 FEATURE_VALUE_TYPE(web::features::kUseDefaultUserAgentInWebClient)},
Gauthier Ambardbde9def2019-11-19 18:04:33415 {"mobile-google-srp", flag_descriptions::kMobileGoogleSRPName,
416 flag_descriptions::kMobileGoogleSRPDescription, flags_ui::kOsIos,
417 FEATURE_VALUE_TYPE(web::kMobileGoogleSRP)},
Kurt Horimotod754e8ec2019-12-03 20:54:02418 {"infobar-overlay-ui", flag_descriptions::kInfobarOverlayUIName,
419 flag_descriptions::kInfobarOverlayUIDescription, flags_ui::kOsIos,
420 FEATURE_VALUE_TYPE(kInfobarOverlayUI)},
sczs391ebba2019-12-05 06:59:30421 {"autofill-save-card-infobar-edit-support",
422 flag_descriptions::kAutofillSaveCardInfobarEditSupportName,
423 flag_descriptions::kAutofillSaveCardInfobarEditSupportDescription,
424 flags_ui::kOsIos,
425 FEATURE_VALUE_TYPE(
426 autofill::features::kAutofillSaveCardInfobarEditSupport)},
edchin68696842020-04-09 17:19:31427 {"managed-bookmarks-ios", flag_descriptions::kManagedBookmarksIOSName,
428 flag_descriptions::kManagedBookmarksIOSDescription, flags_ui::kOsIos,
429 FEATURE_VALUE_TYPE(kManagedBookmarksIOS)},
sczs5b8ac5f2020-04-17 16:23:20430 {"infobar-ui-reboot-only-ios13",
431 flag_descriptions::kInfobarUIRebootOnlyiOS13Name,
432 flag_descriptions::kInfobarUIRebootOnlyiOS13Description, flags_ui::kOsIos,
433 FEATURE_VALUE_TYPE(kInfobarUIRebootOnlyiOS13)},
edchin39d08d62020-04-20 13:11:24434 {"edit-bookmarks-ios", flag_descriptions::kEditBookmarksIOSName,
435 flag_descriptions::kEditBookmarksIOSDescription, flags_ui::kOsIos,
436 FEATURE_VALUE_TYPE(kEditBookmarksIOS)},
Mike Dougherty768389502020-04-21 08:28:35437 {"url-blocklist-ios", flag_descriptions::kURLBlocklistIOSName,
438 flag_descriptions::kURLBlocklistIOSDescription, flags_ui::kOsIos,
439 FEATURE_VALUE_TYPE(kURLBlocklistIOS)},
siashah0a386222020-04-23 03:31:35440 {"autofill-enable-google-issued-card",
441 flag_descriptions::kAutofillEnableGoogleIssuedCardName,
442 flag_descriptions::kAutofillEnableGoogleIssuedCardDescription,
443 flags_ui::kOsIos,
444 FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableGoogleIssuedCard)},
Siyu And1f86e22020-05-13 20:35:16445 {"autofill-enable-card-nickname-management",
446 flag_descriptions::kAutofillEnableCardNicknameManagementName,
447 flag_descriptions::kAutofillEnableCardNicknameManagementDescription,
448 flags_ui::kOsIos,
449 FEATURE_VALUE_TYPE(
450 autofill::features::kAutofillEnableCardNicknameManagement)},
Tina Wang52aea19d2020-05-15 16:47:33451 {"enable-ios-managed-settings-ui",
452 flag_descriptions::kEnableIOSManagedSettingsUIName,
453 flag_descriptions::kEnableIOSManagedSettingsUIDescription,
454 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableIOSManagedSettingsUI)},
Sean Harrison0ada3b082020-05-18 19:07:51455 {"safety-check-ios", flag_descriptions::kSafetyCheckIOSName,
456 flag_descriptions::kSafetyCheckIOSDescription, flags_ui::kOsIos,
457 FEATURE_VALUE_TYPE(kSafetyCheckIOS)},
sczs37d9c132020-07-18 06:06:33458 {"new-content-suggestions-feed", flag_descriptions::kDiscoverFeedInNtpName,
adamta22a4d502020-05-21 03:12:21459 flag_descriptions::kDiscoverFeedInNtpDescription, flags_ui::kOsIos,
gogeralddb0d8ae2020-11-13 03:56:58460 FEATURE_WITH_PARAMS_VALUE_TYPE(kDiscoverFeedInNtp,
461 kDiscoverFeedInNtpVariations,
462 "IOSDiscoverFeed")},
adamta273568472020-12-04 23:53:57463 {"refactored-ntp", flag_descriptions::kRefactoredNTPName,
464 flag_descriptions::kRefactoredNTPDescription, flags_ui::kOsIos,
465 FEATURE_VALUE_TYPE(kRefactoredNTP)},
Siyu An6ca4cdb2020-05-29 20:56:17466 {"autofill-enable-card-nickname-upstream",
467 flag_descriptions::kAutofillEnableCardNicknameUpstreamName,
468 flag_descriptions::kAutofillEnableCardNicknameUpstreamDescription,
469 flags_ui::kOsIos,
470 FEATURE_VALUE_TYPE(
471 autofill::features::kAutofillEnableCardNicknameUpstream)},
Maxime Charland425d9b42020-06-01 19:47:21472 {"illustrated-empty-states", flag_descriptions::kIllustratedEmptyStatesName,
473 flag_descriptions::kIllustratedEmptyStatesDescription, flags_ui::kOsIos,
474 FEATURE_VALUE_TYPE(kIllustratedEmptyStates)},
Sebastien Lalancette414fc1ce2020-06-11 14:43:06475 {"enable-native-context-menus",
476 flag_descriptions::kEnableNativeContextMenusName,
477 flag_descriptions::kEnableNativeContextMenusDescription, flags_ui::kOsIos,
478 FEATURE_VALUE_TYPE(kEnableNativeContextMenus)},
Roberto Mourab87b9722020-06-17 17:12:09479 {"expanded-tab-strip", flag_descriptions::kExpandedTabStripName,
480 flag_descriptions::kExpandedTabStripDescription, flags_ui::kOsIos,
481 FEATURE_VALUE_TYPE(kExpandedTabStrip)},
Ben Blake14592fe2020-06-16 15:34:38482 {"autofill-enable-offers-in-downstream",
483 flag_descriptions::kAutofillEnableOffersInDownstreamName,
484 flag_descriptions::kAutofillEnableOffersInDownstreamDescription,
485 flags_ui::kOsIos,
486 FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableOffersInDownstream)},
Tommy Martino6b4eb7e2020-06-25 18:25:41487 {"shared-highlighting-ios", flag_descriptions::kSharedHighlightingIOSName,
488 flag_descriptions::kSharedHighlightingIOSDescription, flags_ui::kOsIos,
489 FEATURE_VALUE_TYPE(kSharedHighlightingIOS)},
Julian Mentasti-Meza4c0a4162020-07-20 18:51:41490 {"enable-fullpage-screenshot",
491 flag_descriptions::kEnableFullPageScreenshotName,
492 flag_descriptions::kEnableFullPageScreenshotDescription, flags_ui::kOsIos,
493 FEATURE_VALUE_TYPE(kEnableFullPageScreenshot)},
Tommy Martino40124672020-07-31 17:29:44494 {"scroll-to-text-ios", flag_descriptions::kScrollToTextIOSName,
495 flag_descriptions::kScrollToTextIOSDescription, flags_ui::kOsIos,
496 FEATURE_VALUE_TYPE(web::features::kScrollToTextIOS)},
Chris Thompson40cbb162020-08-04 23:22:15497 {"legacy-tls-interstitial",
498 flag_descriptions::kIOSLegacyTLSInterstitialsName,
499 flag_descriptions::kIOSLegacyTLSInterstitialsDescription, flags_ui::kOsIos,
500 FEATURE_VALUE_TYPE(web::features::kIOSLegacyTLSInterstitial)},
Ewann163e3952020-08-21 12:34:49501 {"extend-open-in-files-support",
502 flag_descriptions::kExtendOpenInFilesSupportName,
503 flag_descriptions::kExtendOpenInFilesSupportDescription, flags_ui::kOsIos,
504 FEATURE_VALUE_TYPE(kExtendOpenInFilesSupport)},
Ewanne1ffc6d2020-09-01 07:56:13505 {"enable-close-all-tabs-confirmation",
506 flag_descriptions::kEnableCloseAllTabsConfirmationName,
507 flag_descriptions::kEnableCloseAllTabsConfirmationDescription,
508 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableCloseAllTabsConfirmation)},
Sylvain Defresne9c107082020-10-27 16:39:13509#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
edchin81467b82020-09-03 19:31:45510 {"screen-time-integration-ios",
511 flag_descriptions::kScreenTimeIntegrationName,
512 flag_descriptions::kScreenTimeIntegrationDescription, flags_ui::kOsIos,
513 FEATURE_VALUE_TYPE(kScreenTimeIntegration)},
Sylvain Defresne9c107082020-10-27 16:39:13514#endif
Nohemi Fernandez983d6d52020-09-09 09:46:19515 {"mobile-identity-consistency",
516 flag_descriptions::kMobileIdentityConsistencyName,
517 flag_descriptions::kMobileIdentityConsistencyDescription, flags_ui::kOsIos,
518 FEATURE_VALUE_TYPE(signin::kMobileIdentityConsistency)},
Gauthier Ambarda1d88a02020-09-14 11:46:37519 {"default-browser-setting", flag_descriptions::kDefaultBrowserSettingsName,
520 flag_descriptions::kDefaultBrowserSettingsDescription, flags_ui::kOsIos,
521 FEATURE_VALUE_TYPE(kDefaultBrowserSettings)},
Nazerke3e993f72020-09-21 13:00:06522 {"modern-tab-strip", flag_descriptions::kModernTabStripName,
523 flag_descriptions::kModernTabStripDescription, flags_ui::kOsIos,
524 FEATURE_VALUE_TYPE(kModernTabStrip)},
Maria Kazinovad4e2ed72020-09-22 17:40:50525 {"autofill-use-renderer-ids",
526 flag_descriptions::kAutofillUseRendererIDsName,
527 flag_descriptions::kAutofillUseRendererIDsDescription, flags_ui::kOsIos,
528 FEATURE_VALUE_TYPE(
529 autofill::features::kAutofillUseUniqueRendererIDsOnIOS)},
Nohemi Fernandez704527492020-09-23 14:00:08530 {"restore-gaia-cookies-if-deleted",
531 flag_descriptions::kRestoreGaiaCookiesIfDeletedName,
532 flag_descriptions::kRestoreGaiaCookiesIfDeletedDescription,
533 flags_ui::kOsIos,
534 FEATURE_VALUE_TYPE(signin::kRestoreGaiaCookiesIfDeleted)},
Nohemi Fernandez7af63ca22020-12-11 13:06:40535 {"restore-gaia-cookies-on-user-action",
536 flag_descriptions::kRestoreGaiaCookiesOnUserActionName,
537 flag_descriptions::kRestoreGaiaCookiesOnUserActionDescription,
538 flags_ui::kOsIos,
539 FEATURE_VALUE_TYPE(signin::kRestoreGaiaCookiesOnUserAction)},
Nohemi Fernandez14a80f72020-11-09 13:01:04540 {"use-username-for-signin-notification-infobar-title",
541 flag_descriptions::kSigninNotificationInfobarUsernameInTitleName,
542 flag_descriptions::kSigninNotificationInfobarUsernameInTitleDescription,
543 flags_ui::kOsIos,
544 FEATURE_VALUE_TYPE(signin::kSigninNotificationInfobarUsernameInTitle)},
Nohemi Fernandez222d6d42020-09-30 20:35:57545 {"minutes-delay-to-restore-gaia-cookies-if-deleted",
546 flag_descriptions::kDelayThresholdMinutesToUpdateGaiaCookieName,
547 flag_descriptions::kDelayThresholdMinutesToUpdateGaiaCookieDescription,
548 flags_ui::kOsIos,
549 MULTI_VALUE_TYPE(kDelayThresholdMinutesToUpdateGaiaCookieChoices)},
Viktor Semeniukd932ff52020-10-13 13:10:17550 {"edit-passwords-in-settings",
551 flag_descriptions::kEditPasswordsInSettingsName,
552 flag_descriptions::kEditPasswordsInSettingsDescription, flags_ui::kOsIos,
553 FEATURE_VALUE_TYPE(password_manager::features::kEditPasswordsInSettings)},
Stepan Khapuginddb85962020-10-21 11:49:58554 {"enable-incognito-authentication-ios",
555 flag_descriptions::kIncognitoAuthenticationName,
556 flag_descriptions::kIncognitoAuthenticationDescription, flags_ui::kOsIos,
557 FEATURE_VALUE_TYPE(kIncognitoAuthentication)},
Tina Wangff4ac852020-11-24 18:46:46558 {"enable-incognito-mode-availability-ios",
559 flag_descriptions::kEnableIncognitoModeAvailabilityIOSName,
560 flag_descriptions::kEnableIncognitoModeAvailabilityIOSDescription,
561 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableIncognitoModeAvailabilityIOS)},
Gauthier Ambardcb6a0ccc2020-10-30 13:12:00562 {"web-view-native-context-menu",
563 flag_descriptions::kWebViewNativeContextMenuName,
564 flag_descriptions::kWebViewNativeContextMenuDescription, flags_ui::kOsIos,
565 FEATURE_VALUE_TYPE(web::features::kWebViewNativeContextMenu)},
Chris Lu4b15abc2020-11-09 20:19:19566 {"location-permissions-prompt",
567 flag_descriptions::kLocationPermissionsPromptName,
568 flag_descriptions::kLocationPermissionsPromptDescription, flags_ui::kOsIos,
569 FEATURE_VALUE_TYPE(kLocationPermissionsPrompt)},
Eugene Butf869bff2020-12-10 01:16:55570 {"record-snapshot-size", flag_descriptions::kRecordSnapshotSizeName,
571 flag_descriptions::kRecordSnapshotSizeDescription, flags_ui::kOsIos,
572 FEATURE_VALUE_TYPE(web::features::kRecordSnapshotSize)},
Chris Lub17195f2020-12-10 20:49:14573 {"default-browser-fullscreen-promo-experiment",
574 flag_descriptions::kDefaultBrowserFullscreenPromoExperimentName,
575 flag_descriptions::kDefaultBrowserFullscreenPromoExperimentDescription,
576 flags_ui::kOsIos,
577 FEATURE_VALUE_TYPE(kDefaultBrowserFullscreenPromoExperiment)},
Cheick Cisse76ade3d2020-12-16 00:15:11578 {"ios-shared-highlighting-color-change",
579 flag_descriptions::kIOSSharedHighlightingColorChangeName,
580 flag_descriptions::kIOSSharedHighlightingColorChangeDescription,
581 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kIOSSharedHighlightingColorChange)},
Chris Lu07e32772020-12-30 01:54:44582 {"ios-persist-crash-restore-infobar",
583 flag_descriptions::kIOSPersistCrashRestoreName,
584 flag_descriptions::kIOSPersistCrashRestoreDescription, flags_ui::kOsIos,
585 FEATURE_VALUE_TYPE(kIOSPersistCrashRestore)},
Viktor Semeniuk61177b332021-01-05 12:48:19586 {"change-password-affiliation",
587 flag_descriptions::kChangePasswordAffiliationInfoName,
588 flag_descriptions::kChangePasswordAffiliationInfoDescription,
589 flags_ui::kOsIos,
590 FEATURE_VALUE_TYPE(
591 password_manager::features::kChangePasswordAffiliationInfo)},
592 {"use-of-hash-affiliation-fetcher",
593 flag_descriptions::kUseOfHashAffiliationFetcherName,
594 flag_descriptions::kUseOfHashAffiliationFetcherDescription,
595 flags_ui::kOsIos,
596 FEATURE_VALUE_TYPE(
597 password_manager::features::kUseOfHashAffiliationFetcher)},
Stepan Khapugin04341202021-01-07 12:22:45598 {"omnibox-new-textfield-implementation",
599 flag_descriptions::kOmniboxNewImplementationName,
600 flag_descriptions::kOmniboxNewImplementationDescription, flags_ui::kOsIos,
601 FEATURE_VALUE_TYPE(kIOSNewOmniboxImplementation)},
Gauthier Ambarde813c07f2020-01-09 10:18:49602};
sdefresne14900ee2015-11-27 14:43:21603
Rohit Raobed794c2020-04-27 15:27:45604bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) {
605 return false;
606}
607
608flags_ui::FlagsState& GetGlobalFlagsState() {
609 static base::NoDestructor<flags_ui::FlagsState> flags_state(kFeatureEntries,
610 nullptr);
611 return *flags_state;
612}
613} // namespace
614
sdefresne14900ee2015-11-27 14:43:21615// Add all switches from experimental flags to |command_line|.
616void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) {
617 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
618
sdefresne14900ee2015-11-27 14:43:21619 // Set the UA flag if UseMobileSafariUA is enabled.
620 if ([defaults boolForKey:@"UseMobileSafariUA"]) {
621 // Safari uses "Vesion/", followed by the OS version excluding bugfix, where
622 // Chrome puts its product token.
avi571943672015-12-22 02:12:49623 int32_t major = 0;
624 int32_t minor = 0;
625 int32_t bugfix = 0;
sdefresne14900ee2015-11-27 14:43:21626 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
627 std::string product = base::StringPrintf("Version/%d.%d", major, minor);
628
Gauthier Ambardba163d42020-05-27 14:48:17629 command_line->AppendSwitchASCII(switches::kUserAgent,
630 web::BuildMobileUserAgent(product));
sdefresne14900ee2015-11-27 14:43:21631 }
632
Guillaume Jenkins25e9bd72020-08-27 17:39:06633 // Shared variables for all enterprise experimental flags.
Guillaume Jenkins57606d72020-08-13 17:32:55634 NSMutableDictionary* testing_policies = [[NSMutableDictionary alloc] init];
Guillaume Jenkins25e9bd72020-08-27 17:39:06635 NSMutableArray* allowed_experimental_policies = [[NSMutableArray alloc] init];
Guillaume Jenkins57606d72020-08-13 17:32:55636
Guillaume Jenkins25e9bd72020-08-27 17:39:06637 // Set some sample policy values for testing if EnableSamplePolicies is set to
638 // true.
Guillaume Jenkinseeb7007c2020-06-25 22:55:40639 if ([defaults boolForKey:@"EnableSamplePolicies"]) {
Guillaume Jenkins25e9bd72020-08-27 17:39:06640 // Some of the sample policies are still marked as experimental and must be
641 // explicitly allowed, otherwise they will be ignored in Beta and Stable.
642 [allowed_experimental_policies addObjectsFromArray:@[
Tina Wang59d0b7e2020-08-11 04:41:01643 base::SysUTF8ToNSString(policy::key::kAutofillAddressEnabled),
Sébastien Séguin-Gagnonc107b1f2020-07-02 21:43:58644 base::SysUTF8ToNSString(policy::key::kAutofillCreditCardEnabled),
645 base::SysUTF8ToNSString(policy::key::kChromeVariations),
646 base::SysUTF8ToNSString(policy::key::kDefaultPopupsSetting),
Tina Wang5abee802020-07-29 23:09:52647 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderEnabled),
648 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderName),
649 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderSearchURL),
Tina Wang89068c82020-10-29 15:51:50650 base::SysUTF8ToNSString(policy::key::kEditBookmarksEnabled),
Tina Wang59d0b7e2020-08-11 04:41:01651 base::SysUTF8ToNSString(policy::key::kPasswordManagerEnabled),
Tina Wang54dddfc22020-08-20 22:34:53652 base::SysUTF8ToNSString(policy::key::kSafeBrowsingProtectionLevel),
653 base::SysUTF8ToNSString(policy::key::kSearchSuggestEnabled),
Tina Wang59d0b7e2020-08-11 04:41:01654 base::SysUTF8ToNSString(policy::key::kTranslateEnabled)
Guillaume Jenkins25e9bd72020-08-27 17:39:06655 ]];
Sébastien Séguin-Gagnonc107b1f2020-07-02 21:43:58656
657 // Define sample policies to enable.
Guillaume Jenkins57606d72020-08-13 17:32:55658 [testing_policies addEntriesFromDictionary:@{
Tina Wang59d0b7e2020-08-11 04:41:01659 base::SysUTF8ToNSString(policy::key::kAutofillAddressEnabled) : @NO,
660
Guillaume Jenkinseeb7007c2020-06-25 22:55:40661 base::SysUTF8ToNSString(policy::key::kAutofillCreditCardEnabled) : @NO,
662
663 // 2 = Disable all variations
664 base::SysUTF8ToNSString(policy::key::kChromeVariations) : @2,
665
666 // 2 = Do not allow any site to show popups
667 base::SysUTF8ToNSString(policy::key::kDefaultPopupsSetting) : @2,
668
Tina Wang5abee802020-07-29 23:09:52669 // Set default search engine.
670 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderEnabled) :
671 @YES,
672 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderSearchURL) :
673 @"http://www.google.com/search?q={searchTerms}",
674 base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderName) :
Tina Wang7cd0a062020-09-15 21:31:02675 @"TestEngine",
Tina Wang5abee802020-07-29 23:09:52676
Tina Wang89068c82020-10-29 15:51:50677 base::SysUTF8ToNSString(policy::key::kEditBookmarksEnabled) : @NO,
678
Guillaume Jenkinseeb7007c2020-06-25 22:55:40679 base::SysUTF8ToNSString(policy::key::kPasswordManagerEnabled) : @NO,
Tina Wang59d0b7e2020-08-11 04:41:01680
681 base::SysUTF8ToNSString(policy::key::kTranslateEnabled) : @NO,
Tina Wang54dddfc22020-08-20 22:34:53682
683 // 2 = Enhanced safe browsing protection
684 base::SysUTF8ToNSString(policy::key::kSafeBrowsingProtectionLevel) : @2,
685
686 base::SysUTF8ToNSString(policy::key::kSearchSuggestEnabled) : @YES,
Guillaume Jenkins57606d72020-08-13 17:32:55687 }];
688 }
689
690 // If a CBCM enrollment token is provided, force Chrome Browser Cloud
Guillaume Jenkins25e9bd72020-08-27 17:39:06691 // Management to enabled, add the token to the list of policies, and allow
692 // the CloudReportingEnabled experimental policy.
Guillaume Jenkins57606d72020-08-13 17:32:55693 NSString* token_key =
694 base::SysUTF8ToNSString(policy::key::kCloudManagementEnrollmentToken);
695 NSString* token = [defaults stringForKey:token_key];
696
697 if ([token length] > 0) {
698 command_line->AppendSwitch(switches::kEnableChromeBrowserCloudManagement);
Guillaume Jenkins25e9bd72020-08-27 17:39:06699 [allowed_experimental_policies
700 addObject:base::SysUTF8ToNSString(policy::key::kCloudReportingEnabled)];
Guillaume Jenkins57606d72020-08-13 17:32:55701 [testing_policies setValue:token forKey:token_key];
702 }
703
Guillaume Jenkins25e9bd72020-08-27 17:39:06704 // If any experimental policy was allowed, set the EnableExperimentalPolicies
705 // policy.
706 if ([allowed_experimental_policies count] > 0) {
707 [testing_policies setValue:allowed_experimental_policies
708 forKey:base::SysUTF8ToNSString(
709 policy::key::kEnableExperimentalPolicies)];
710 }
711
Guillaume Jenkins57606d72020-08-13 17:32:55712 // If some policies were set, commit them to the app's registration defaults.
713 if ([testing_policies count] > 0) {
Guillaume Jenkinseeb7007c2020-06-25 22:55:40714 NSDictionary* registration_defaults =
715 @{kPolicyLoaderIOSConfigurationKey : testing_policies};
716 [defaults registerDefaults:registration_defaults];
717 }
718
sdefresne14900ee2015-11-27 14:43:21719 // Freeform commandline flags. These are added last, so that any flags added
720 // earlier in this function take precedence.
721 if ([defaults boolForKey:@"EnableFreeformCommandLineFlags"]) {
722 base::CommandLine::StringVector flags;
723 // Append an empty "program" argument.
724 flags.push_back("");
725
726 // The number of flags corresponds to the number of text fields in
727 // Experimental.plist.
728 const int kNumFreeformFlags = 5;
729 for (int i = 1; i <= kNumFreeformFlags; ++i) {
730 NSString* key =
731 [NSString stringWithFormat:@"FreeformCommandLineFlag%d", i];
732 NSString* flag = [defaults stringForKey:key];
733 if ([flag length]) {
Robbie Gibsonc91ce622019-05-20 14:44:33734 // iOS keyboard replaces -- with —, so undo that.
735 flag = [flag stringByReplacingOccurrencesOfString:@"—"
736 withString:@"--"
737 options:0
738 range:NSMakeRange(0, 1)];
739 // To make things easier, allow flags with no dashes by prepending them
740 // here. This also allows for flags that just have one dash if they
741 // exist.
742 if (![flag hasPrefix:@"-"]) {
743 flag = [@"--" stringByAppendingString:flag];
744 }
sdefresne14900ee2015-11-27 14:43:21745 flags.push_back(base::SysNSStringToUTF8(flag));
746 }
747 }
748
749 base::CommandLine temp_command_line(flags);
750 command_line->AppendArguments(temp_command_line, false);
751 }
msardafc76f662017-02-24 12:46:28752
justincohendacc85d2017-06-28 23:34:10753 // Populate command line flag for 3rd party keyboard omnibox workaround.
754 NSString* enableThirdPartyKeyboardWorkaround =
755 [defaults stringForKey:@"EnableThirdPartyKeyboardWorkaround"];
756 if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Enabled"]) {
757 command_line->AppendSwitch(switches::kEnableThirdPartyKeyboardWorkaround);
758 } else if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Disabled"]) {
759 command_line->AppendSwitch(switches::kDisableThirdPartyKeyboardWorkaround);
760 }
761
msardafc76f662017-02-24 12:46:28762 ios::GetChromeBrowserProvider()->AppendSwitchesFromExperimentalSettings(
763 defaults, command_line);
sdefresne14900ee2015-11-27 14:43:21764}
765
sdefresne14900ee2015-11-27 14:43:21766void ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage,
767 base::CommandLine* command_line) {
Sylvain Defresne8327a2f2019-01-17 14:19:18768 GetGlobalFlagsState().ConvertFlagsToSwitches(
sdefresnec9763902015-12-02 10:30:11769 flags_storage, command_line, flags_ui::kAddSentinels,
Gregory Chatzinofff6523722017-11-21 01:33:53770 switches::kEnableFeatures, switches::kDisableFeatures);
sdefresne14900ee2015-11-27 14:43:21771}
772
jkrcalbf073372016-07-29 07:21:31773std::vector<std::string> RegisterAllFeatureVariationParameters(
774 flags_ui::FlagsStorage* flags_storage,
775 base::FeatureList* feature_list) {
Justin Cohen2e2adb52019-10-25 17:00:02776 // Occasionally DCHECK crashes on canary can be very distuptive. An
777 // experimental flag was added to aid in temporarily disabling this for
778 // canary testers.
779#if defined(DCHECK_IS_CONFIGURABLE)
780 if (experimental_flags::AreDCHECKCrashesDisabled()) {
781 std::vector<base::FeatureList::FeatureOverrideInfo> overrides;
782 overrides.push_back(
783 {std::cref(base::kDCheckIsFatalFeature),
784 base::FeatureList::OverrideState::OVERRIDE_DISABLE_FEATURE});
785 feature_list->RegisterExtraFeatureOverrides(std::move(overrides));
786 }
787#endif // defined(DCHECK_IS_CONFIGURABLE)
788
Sylvain Defresne8327a2f2019-01-17 14:19:18789 return GetGlobalFlagsState().RegisterAllFeatureVariationParameters(
790 flags_storage, feature_list);
jkrcalbf073372016-07-29 07:21:31791}
792
sdefresne14900ee2015-11-27 14:43:21793void GetFlagFeatureEntries(flags_ui::FlagsStorage* flags_storage,
794 flags_ui::FlagAccess access,
795 base::ListValue* supported_entries,
796 base::ListValue* unsupported_entries) {
Sylvain Defresne8327a2f2019-01-17 14:19:18797 GetGlobalFlagsState().GetFlagFeatureEntries(
sdefresne14900ee2015-11-27 14:43:21798 flags_storage, access, supported_entries, unsupported_entries,
Renjie Tang208c8192020-11-03 00:46:51799 base::BindRepeating(&SkipConditionalFeatureEntry));
sdefresne14900ee2015-11-27 14:43:21800}
801
802void SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage,
803 const std::string& internal_name,
804 bool enable) {
Sylvain Defresne8327a2f2019-01-17 14:19:18805 GetGlobalFlagsState().SetFeatureEntryEnabled(flags_storage, internal_name,
806 enable);
sdefresne14900ee2015-11-27 14:43:21807}
808
809void ResetAllFlags(flags_ui::FlagsStorage* flags_storage) {
Sylvain Defresne8327a2f2019-01-17 14:19:18810 GetGlobalFlagsState().ResetAllFlags(flags_storage);
sdefresne14900ee2015-11-27 14:43:21811}
812
813namespace testing {
814
815const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) {
kokihoon189a4022018-10-13 02:43:44816 *count = base::size(kFeatureEntries);
sdefresne14900ee2015-11-27 14:43:21817 return kFeatureEntries;
818}
819
820} // namespace testing