blob: 2ad2b151140675c590489c8cb39004fb3136bcae [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
8#include "ios/chrome/browser/about_flags.h"
9
avi571943672015-12-22 02:12:4910#include <stddef.h>
11#include <stdint.h>
sdefresne14900ee2015-11-27 14:43:2112#import <UIKit/UIKit.h>
13
Gregory Chatzinofff6523722017-11-21 01:33:5314#include "base/base_switches.h"
sdefresne14900ee2015-11-27 14:43:2115#include "base/bind.h"
16#include "base/command_line.h"
17#include "base/logging.h"
Sylvain Defresne8327a2f2019-01-17 14:19:1818#include "base/no_destructor.h"
kokihoon189a4022018-10-13 02:43:4419#include "base/stl_util.h"
sdefresne14900ee2015-11-27 14:43:2120#include "base/strings/stringprintf.h"
21#include "base/strings/sys_string_conversions.h"
Sebastien Marchand75a7cdf2018-11-13 23:47:0322#include "base/system/sys_info.h"
Mohamad Ahmadic4df81f2017-12-20 04:41:5923#include "components/autofill/core/common/autofill_features.h"
Moe Ahmadid6d5d172018-06-20 17:20:2324#include "components/autofill/core/common/autofill_switches.h"
Olivier Robin3d60411622018-02-23 10:03:2225#include "components/autofill/ios/browser/autofill_switches.h"
sdefresne14900ee2015-11-27 14:43:2126#include "components/dom_distiller/core/dom_distiller_switches.h"
Tommy Nyquistc1d6dea12017-07-26 20:37:2327#include "components/feature_engagement/public/feature_constants.h"
28#include "components/feature_engagement/public/feature_list.h"
sdefresne14900ee2015-11-27 14:43:2129#include "components/flags_ui/feature_entry.h"
30#include "components/flags_ui/feature_entry_macros.h"
31#include "components/flags_ui/flags_storage.h"
32#include "components/flags_ui/flags_ui_switches.h"
Tanja Gornakb0985dd2018-10-11 17:24:4033#include "components/invalidation/impl/invalidation_switches.h"
noyau4cfb1332016-10-25 17:05:4234#include "components/ntp_tiles/switches.h"
Justin Donnelly33d712e2017-08-23 21:32:5135#include "components/omnibox/browser/omnibox_field_trial.h"
Ioana Pandeled14ce9e2017-11-28 14:41:4636#include "components/password_manager/core/common/password_manager_features.h"
mathp9b4c11d2017-07-06 20:24:1337#include "components/payments/core/features.h"
Marc Treib5fc99e1f2017-11-08 12:19:1838#include "components/search_provider_logos/switches.h"
Emily Starkbafa9062017-12-27 15:22:4639#include "components/security_state/core/features.h"
Valeriya Sinevicha79dc612018-09-25 14:49:0940#include "components/signin/core/browser/account_reconcilor.h"
David Rogera6c88122017-10-25 13:02:4641#include "components/signin/core/browser/signin_switches.h"
sdefresne36579782016-02-05 11:08:2542#include "components/strings/grit/components_strings.h"
Moe Ahmadid6d5d172018-06-20 17:20:2343#include "components/sync/driver/sync_driver_switches.h"
Moe Ahmadie4cce1f2018-12-18 23:48:0144#include "components/translate/core/browser/translate_prefs.h"
Mihai Sardarescu160ec662018-07-18 21:13:5145#include "components/unified_consent/feature.h"
mrefaat4539b032018-08-02 22:25:4546#include "ios/chrome/browser/app_launcher/app_launcher_flags.h"
Sylvain Defresneae6987e2018-03-01 13:21:4047#include "ios/chrome/browser/browsing_data/browsing_data_features.h"
sdefresne14900ee2015-11-27 14:43:2148#include "ios/chrome/browser/chrome_switches.h"
Olivier Robin2a898dc2018-10-31 14:37:0449#include "ios/chrome/browser/crash_report/crash_report_flags.h"
Moe Ahmadi2d4c8452018-11-30 04:44:2650#include "ios/chrome/browser/download/features.h"
Jean-François Geyelin30be5912017-08-25 12:05:3851#include "ios/chrome/browser/drag_and_drop/drag_and_drop_flag.h"
Eugene But66e917002019-01-07 23:38:5252#include "ios/chrome/browser/experimental_flags.h"
Chris Lu77905ac2018-12-06 20:46:5153#include "ios/chrome/browser/find_in_page/features.h"
vabr0215a8e2017-03-28 12:47:3454#include "ios/chrome/browser/ios_chrome_flag_descriptions.h"
mrefaat390f99c0d2018-05-10 19:44:2455#include "ios/chrome/browser/itunes_urls/itunes_urls_flag.h"
Yi Sua3d55f3d2018-09-24 17:49:4156#include "ios/chrome/browser/search_engines/feature_flags.h"
Jérôme Lebelec282832018-09-18 08:34:1857#include "ios/chrome/browser/signin/feature_flags.h"
Kurt Horimoto9165404a2018-11-13 23:48:1258#import "ios/chrome/browser/ui/dialogs/dialog_features.h"
Kurt Horimoto4da682b022018-04-12 07:43:3559#import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
sczs80a6f462018-12-05 20:37:1860#import "ios/chrome/browser/ui/infobars/infobar_feature.h"
Mark Cogan02ed6c772018-05-31 17:00:5161#import "ios/chrome/browser/ui/toolbar/public/features.h"
Kurt Horimoto79d590b2018-09-12 19:09:2862#import "ios/chrome/browser/ui/toolbar_container/toolbar_container_features.h"
Justin Cohen2d81c582018-01-22 14:46:4463#include "ios/chrome/browser/ui/ui_feature_flags.h"
Yi Su392b3032018-06-05 07:26:4764#include "ios/chrome/browser/web/features.h"
sdefresne14900ee2015-11-27 14:43:2165#include "ios/chrome/grit/ios_strings.h"
msardafc76f662017-02-24 12:46:2866#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
Danyao Wang34da6ff2017-10-30 15:16:5667#include "ios/web/public/features.h"
sdefresne14900ee2015-11-27 14:43:2168#include "ios/web/public/user_agent.h"
69#include "ios/web/public/web_view_creation_util.h"
70
71#if !defined(OFFICIAL_BUILD)
72#include "components/variations/variations_switches.h"
vitaliii489217aa2017-01-30 14:50:2273#endif
stkhapuginc1be1792016-12-13 14:30:5374
75#if !defined(__has_feature) || !__has_feature(objc_arc)
76#error "This file requires ARC support."
77#endif
sdefresne14900ee2015-11-27 14:43:2178
elawrence816f6790e2017-06-16 18:19:2879using flags_ui::FeatureEntry;
80
sdefresne14900ee2015-11-27 14:43:2181namespace {
Emily Starkbafa9062017-12-27 15:22:4682
83const FeatureEntry::FeatureParam kMarkHttpAsDangerous[] = {
84 {security_state::features::kMarkHttpAsFeatureParameterName,
85 security_state::features::kMarkHttpAsParameterDangerous}};
Emily Starkbafa9062017-12-27 15:22:4686const FeatureEntry::FeatureParam kMarkHttpAsWarningAndDangerousOnFormEdits[] = {
87 {security_state::features::kMarkHttpAsFeatureParameterName,
88 security_state::features::
89 kMarkHttpAsParameterWarningAndDangerousOnFormEdits}};
Emily Starkbafa9062017-12-27 15:22:4690
91const FeatureEntry::FeatureVariation kMarkHttpAsFeatureVariations[] = {
92 {"(mark as actively dangerous)", kMarkHttpAsDangerous,
kokihoon189a4022018-10-13 02:43:4493 base::size(kMarkHttpAsDangerous), nullptr},
Emily Starkbafa9062017-12-27 15:22:4694 {"(mark with a Not Secure warning and dangerous on form edits)",
95 kMarkHttpAsWarningAndDangerousOnFormEdits,
Joe DeBlasio20e01fd2018-12-20 19:59:3096 base::size(kMarkHttpAsWarningAndDangerousOnFormEdits), nullptr}};
elawrence816f6790e2017-06-16 18:19:2897
Marc Treib5fc99e1f2017-11-08 12:19:1898const FeatureEntry::Choice kUseDdljsonApiChoices[] = {
99 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
100 {"(force test doodle 0)", search_provider_logos::switches::kGoogleDoodleUrl,
101 "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios0.json"},
102 {"(force test doodle 1)", search_provider_logos::switches::kGoogleDoodleUrl,
103 "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios1.json"},
104 {"(force test doodle 2)", search_provider_logos::switches::kGoogleDoodleUrl,
105 "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios2.json"},
106 {"(force test doodle 3)", search_provider_logos::switches::kGoogleDoodleUrl,
107 "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios3.json"},
108 {"(force test doodle 4)", search_provider_logos::switches::kGoogleDoodleUrl,
109 "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios4.json"},
110};
Marc Treib2752e8b2017-08-04 14:12:09111
Olivier Robin3d60411622018-02-23 10:03:22112const FeatureEntry::Choice kAutofillIOSDelayBetweenFieldsChoices[] = {
113 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
114 {"0", autofill::switches::kAutofillIOSDelayBetweenFields, "0"},
115 {"10", autofill::switches::kAutofillIOSDelayBetweenFields, "10"},
116 {"20", autofill::switches::kAutofillIOSDelayBetweenFields, "20"},
117 {"50", autofill::switches::kAutofillIOSDelayBetweenFields, "50"},
118 {"100", autofill::switches::kAutofillIOSDelayBetweenFields, "100"},
119 {"200", autofill::switches::kAutofillIOSDelayBetweenFields, "200"},
120 {"500", autofill::switches::kAutofillIOSDelayBetweenFields, "500"},
121 {"1000", autofill::switches::kAutofillIOSDelayBetweenFields, "1000"},
122};
123
Stepan Khapugincc4e9842019-01-23 13:38:13124const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches3[] = {
125 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "3"}};
126const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches4[] = {
127 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "4"}};
128const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches5[] = {
129 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "5"}};
130const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches6[] = {
131 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "6"}};
132const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches8[] = {
133 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "8"}};
134const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches10[] = {
135 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "10"}};
136const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches12[] = {
137 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "12"}};
138
139const FeatureEntry::FeatureVariation
140 kOmniboxUIMaxAutocompleteMatchesVariations[] = {
141 {"3 matches", kOmniboxUIMaxAutocompleteMatches3,
142 base::size(kOmniboxUIMaxAutocompleteMatches3), nullptr},
143 {"4 matches", kOmniboxUIMaxAutocompleteMatches4,
144 base::size(kOmniboxUIMaxAutocompleteMatches4), nullptr},
145 {"5 matches", kOmniboxUIMaxAutocompleteMatches5,
146 base::size(kOmniboxUIMaxAutocompleteMatches5), nullptr},
147 {"6 matches", kOmniboxUIMaxAutocompleteMatches6,
148 base::size(kOmniboxUIMaxAutocompleteMatches6), nullptr},
149 {"8 matches", kOmniboxUIMaxAutocompleteMatches8,
150 base::size(kOmniboxUIMaxAutocompleteMatches8), nullptr},
151 {"10 matches", kOmniboxUIMaxAutocompleteMatches10,
152 base::size(kOmniboxUIMaxAutocompleteMatches10), nullptr},
153 {"12 matches", kOmniboxUIMaxAutocompleteMatches12,
154 base::size(kOmniboxUIMaxAutocompleteMatches12), nullptr}};
155
Gauthier Ambard2392f2a2018-10-24 16:33:27156const FeatureEntry::FeatureParam kIconForSearchButtonGrey[] = {
157 {kIconForSearchButtonFeatureParameterName,
158 kIconForSearchButtonParameterGrey}};
159const FeatureEntry::FeatureParam kIconForSearchButtonColorful[] = {
160 {kIconForSearchButtonFeatureParameterName,
161 kIconForSearchButtonParameterColorful}};
162const FeatureEntry::FeatureParam kIconForSearchButtonMagnifying[] = {
163 {kIconForSearchButtonFeatureParameterName,
164 kIconForSearchButtonParameterMagnifying}};
165
166const FeatureEntry::FeatureVariation kIconForSearchButtonVariations[] = {
167 {"Grey search engine logo", kIconForSearchButtonGrey,
168 base::size(kIconForSearchButtonGrey), nullptr},
169 {"Colorful search engine logo", kIconForSearchButtonColorful,
170 base::size(kIconForSearchButtonColorful), nullptr},
171 {"Magnifying glass", kIconForSearchButtonMagnifying,
172 base::size(kIconForSearchButtonMagnifying), nullptr}};
173
Olivier Robince9386ebd2018-11-29 09:07:38174const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout3s[] = {
175 {crash_report::kDetectMainThreadFreezeParameterName,
176 crash_report::kDetectMainThreadFreezeParameter3s}};
177const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout5s[] = {
178 {crash_report::kDetectMainThreadFreezeParameterName,
179 crash_report::kDetectMainThreadFreezeParameter5s}};
180const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout7s[] = {
181 {crash_report::kDetectMainThreadFreezeParameterName,
182 crash_report::kDetectMainThreadFreezeParameter7s}};
183const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout9s[] = {
184 {crash_report::kDetectMainThreadFreezeParameterName,
185 crash_report::kDetectMainThreadFreezeParameter9s}};
186
187const FeatureEntry::FeatureVariation kDetectMainThreadFreezeVariations[] = {
188 {"3s", kDetectMainThreadFreezeTimeout3s,
189 base::size(kDetectMainThreadFreezeTimeout3s), nullptr},
190 {"5s", kDetectMainThreadFreezeTimeout5s,
191 base::size(kDetectMainThreadFreezeTimeout5s), nullptr},
192 {"7s", kDetectMainThreadFreezeTimeout7s,
193 base::size(kDetectMainThreadFreezeTimeout7s), nullptr},
194 {"9s", kDetectMainThreadFreezeTimeout9s,
195 base::size(kDetectMainThreadFreezeTimeout9s), nullptr}};
196
Cooper Knaak1e026562017-07-26 05:22:28197// To add a new entry, add to the end of kFeatureEntries. There are four
sdefresne14900ee2015-11-27 14:43:21198// distinct types of entries:
Cooper Knaak1e026562017-07-26 05:22:28199// . ENABLE_DISABLE_VALUE: entry is either enabled, disabled, or uses the
200// default value for this feature. Use the ENABLE_DISABLE_VALUE_TYPE
sdefresne14900ee2015-11-27 14:43:21201// macro for this type supplying the command line to the macro.
202// . MULTI_VALUE: a list of choices, the first of which should correspond to a
203// deactivated state for this lab (i.e. no command line option). To specify
204// this type of entry use the macro MULTI_VALUE_TYPE supplying it the
205// array of choices.
Cooper Knaak1e026562017-07-26 05:22:28206// . FEATURE_VALUE: entry is associated with a base::Feature instance. Entry is
207// either enabled, disabled, or uses the default value of the associated
208// base::Feature instance. To specify this type of entry use the macro
209// FEATURE_VALUE_TYPE supplying it the base::Feature instance.
210// . FEATURE_WITH_PARAM_VALUES: a list of choices associated with a
211// base::Feature instance. Choices corresponding to the default state, a
212// universally enabled state, and a universally disabled state are
213// automatically included. To specify this type of entry use the macro
214// FEATURE_WITH_PARAMS_VALUE_TYPE supplying it the base::Feature instance and
215// the array of choices.
216//
sdefresne14900ee2015-11-27 14:43:21217// See the documentation of FeatureEntry for details on the fields.
218//
219// When adding a new choice, add it to the end of the list.
220const flags_ui::FeatureEntry kFeatureEntries[] = {
Emily Starkbafa9062017-12-27 15:22:46221 {"enable-mark-http-as", flag_descriptions::kMarkHttpAsName,
elawrence816f6790e2017-06-16 18:19:28222 flag_descriptions::kMarkHttpAsDescription, flags_ui::kOsIos,
Emily Starkbafa9062017-12-27 15:22:46223 FEATURE_WITH_PARAMS_VALUE_TYPE(
224 security_state::features::kMarkHttpAsFeature,
225 kMarkHttpAsFeatureVariations,
226 "MarkHttpAs")},
Cooper Knaak1e026562017-07-26 05:22:28227 {"in-product-help-demo-mode-choice",
228 flag_descriptions::kInProductHelpDemoModeName,
229 flag_descriptions::kInProductHelpDemoModeDescription, flags_ui::kOsIos,
230 FEATURE_WITH_PARAMS_VALUE_TYPE(
Tommy Nyquistc1d6dea12017-07-26 20:37:23231 feature_engagement::kIPHDemoMode,
232 feature_engagement::kIPHDemoModeChoiceVariations,
Marc Treib2752e8b2017-08-04 14:12:09233 "IPH_DemoMode")},
Moe Ahmadi2d4c8452018-11-30 04:44:26234 {"preview-usdz", flag_descriptions::kUsdzPreviewName,
235 flag_descriptions::kUsdzPreviewDescription, flags_ui::kOsIos,
236 FEATURE_VALUE_TYPE(download::kUsdzPreview)},
Marc Treib2752e8b2017-08-04 14:12:09237 {"use-ddljson-api", flag_descriptions::kUseDdljsonApiName,
238 flag_descriptions::kUseDdljsonApiDescription, flags_ui::kOsIos,
Marc Treib5fc99e1f2017-11-08 12:19:18239 MULTI_VALUE_TYPE(kUseDdljsonApiChoices)},
Jean-François Geyelin30be5912017-08-25 12:05:38240 {"drag_and_drop", flag_descriptions::kDragAndDropName,
241 flag_descriptions::kDragAndDropDescription, flags_ui::kOsIos,
Rohit Rao6a3a481d2017-09-25 19:31:41242 FEATURE_VALUE_TYPE(kDragAndDrop)},
Eugene But468b6d5f02018-10-18 21:17:45243 {"ignores-viewport-scale-limits",
244 flag_descriptions::kIgnoresViewportScaleLimitsName,
245 flag_descriptions::kIgnoresViewportScaleLimitsDescription,
246 flags_ui::kOsIos,
247 FEATURE_VALUE_TYPE(web::features::kIgnoresViewportScaleLimits)},
Danyao Wang34da6ff2017-10-30 15:16:56248 {"slim-navigation-manager", flag_descriptions::kSlimNavigationManagerName,
249 flag_descriptions::kSlimNavigationManagerDescription, flags_ui::kOsIos,
250 FEATURE_VALUE_TYPE(web::features::kSlimNavigationManager)},
sczsdc2e8e02018-01-09 18:39:32251 {"memex-tab-switcher", flag_descriptions::kMemexTabSwitcherName,
252 flag_descriptions::kMemexTabSwitcherDescription, flags_ui::kOsIos,
253 FEATURE_VALUE_TYPE(kMemexTabSwitcher)},
mrefaata6501d92017-12-11 19:50:50254 {"wk-http-system-cookie-store",
255 flag_descriptions::kWKHTTPSystemCookieStoreName,
256 flag_descriptions::kWKHTTPSystemCookieStoreName, flags_ui::kOsIos,
Mohamad Ahmadic4df81f2017-12-20 04:41:59257 FEATURE_VALUE_TYPE(web::features::kWKHTTPSystemCookieStore)},
Moe Ahmadic3fd7cd2018-05-11 21:40:22258 {"enable-autofill-credit-card-upload",
259 flag_descriptions::kAutofillCreditCardUploadName,
260 flag_descriptions::kAutofillCreditCardUploadDescription, flags_ui::kOsIos,
Anne Lim579b5732018-08-30 18:24:24261 FEATURE_VALUE_TYPE(autofill::features::kAutofillUpstream)},
Lakshmi Kumar Dabbiruee22004e2018-06-01 01:52:27262 {"enable-autofill-credit-card-downstream-google-pay-branding",
263 flag_descriptions::kAutofillDownstreamUseGooglePayBrandingOniOSName,
264 flag_descriptions::kAutofillDownstreamUseGooglePayBrandingOniOSDescription,
265 flags_ui::kOsIos,
266 FEATURE_VALUE_TYPE(
267 autofill::features::kAutofillDownstreamUseGooglePayBrandingOniOS)},
Jared Saul2e55e7f12018-10-26 20:44:43268 {"enable-autofill-save-credit-card-uses-strike-system",
269 flag_descriptions::kEnableAutofillSaveCreditCardUsesStrikeSystemName,
270 flag_descriptions::
271 kEnableAutofillSaveCreditCardUsesStrikeSystemDescription,
272 flags_ui::kOsIos,
273 FEATURE_VALUE_TYPE(
274 autofill::features::kAutofillSaveCreditCardUsesStrikeSystem)},
Anne Lim9d8f66a2019-01-07 23:49:21275 {"enable-autofill-save-credit-card-uses-strike-system-v2",
276 flag_descriptions::kEnableAutofillSaveCreditCardUsesStrikeSystemV2Name,
277 flag_descriptions::
278 kEnableAutofillSaveCreditCardUsesStrikeSystemV2Description,
279 flags_ui::kOsIos,
280 FEATURE_VALUE_TYPE(
281 autofill::features::kAutofillSaveCreditCardUsesStrikeSystemV2)},
Moe Ahmadid6d5d172018-06-20 17:20:23282 {"use-sync-sandbox", flag_descriptions::kSyncSandboxName,
283 flag_descriptions::kSyncSandboxDescription, flags_ui::kOsIos,
284 SINGLE_VALUE_TYPE_AND_VALUE(
285 switches::kSyncServiceURL,
286 "https://chrome-sync.sandbox.google.com/chrome-sync/alpha")},
287 {"wallet-service-use-sandbox",
288 flag_descriptions::kWalletServiceUseSandboxName,
289 flag_descriptions::kWalletServiceUseSandboxDescription, flags_ui::kOsIos,
290 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(
291 autofill::switches::kWalletServiceUseSandbox,
292 "1",
293 autofill::switches::kWalletServiceUseSandbox,
294 "0")},
Mohamad Ahmadic4df81f2017-12-20 04:41:59295 {"show-autofill-type-predictions",
296 flag_descriptions::kShowAutofillTypePredictionsName,
297 flag_descriptions::kShowAutofillTypePredictionsDescription,
298 flags_ui::kOsIos,
Gauthier Ambardcfd85182018-01-05 10:37:46299 FEATURE_VALUE_TYPE(autofill::features::kAutofillShowTypePredictions)},
Olivier Robin3d60411622018-02-23 10:03:22300 {"autofill-ios-delay-between-fields",
301 flag_descriptions::kAutofillIOSDelayBetweenFieldsName,
302 flag_descriptions::kAutofillIOSDelayBetweenFieldsDescription,
303 flags_ui::kOsIos, MULTI_VALUE_TYPE(kAutofillIOSDelayBetweenFieldsChoices)},
Sylvain Defresneae6987e2018-03-01 13:21:40304 {"new-clear-browsing-data-ui",
305 flag_descriptions::kNewClearBrowsingDataUIName,
306 flag_descriptions::kNewClearBrowsingDataUIDescription, flags_ui::kOsIos,
307 FEATURE_VALUE_TYPE(kNewClearBrowsingDataUI)},
mrefaat390f99c0d2018-05-10 19:44:24308 {"itunes-urls-store-kit-handling",
309 flag_descriptions::kITunesUrlsStoreKitHandlingName,
310 flag_descriptions::kITunesUrlsStoreKitHandlingDescription,
311 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kITunesUrlsStoreKitHandling)},
Jérôme Lebelfa6c5ae2018-03-29 13:46:57312 {"unified-consent", flag_descriptions::kUnifiedConsentName,
313 flag_descriptions::kUnifiedConsentDescription, flags_ui::kOsIos,
Mihai Sardarescu160ec662018-07-18 21:13:51314 FEATURE_VALUE_TYPE(unified_consent::kUnifiedConsent)},
sebsg93dc01c2018-04-05 16:42:48315 {"autofill-dynamic-forms", flag_descriptions::kAutofillDynamicFormsName,
316 flag_descriptions::kAutofillDynamicFormsDescription, flags_ui::kOsIos,
317 FEATURE_VALUE_TYPE(autofill::features::kAutofillDynamicForms)},
Olivier Robin081912dd2018-06-11 09:14:26318 {"autofill-prefilled-fields",
319 flag_descriptions::kAutofillPrefilledFieldsName,
320 flag_descriptions::kAutofillPrefilledFieldsDescription, flags_ui::kOsIos,
321 FEATURE_VALUE_TYPE(autofill::features::kAutofillPrefilledFields)},
Olivier Robind81475b02018-06-20 21:30:11322 {"autofill-show-all-profiles-on-prefilled-forms",
323 flag_descriptions::kAutofillShowAllSuggestionsOnPrefilledFormsName,
324 flag_descriptions::kAutofillShowAllSuggestionsOnPrefilledFormsDescription,
325 flags_ui::kOsIos,
326 FEATURE_VALUE_TYPE(
327 autofill::features::kAutofillShowAllSuggestionsOnPrefilledForms)},
Moe Ahmadid3ddfcb2018-04-20 19:51:08328 {"autofill-restrict-formless-form-extraction",
329 flag_descriptions::kAutofillRestrictUnownedFieldsToFormlessCheckoutName,
330 flag_descriptions::
331 kAutofillRestrictUnownedFieldsToFormlessCheckoutDescription,
332 flags_ui::kOsIos,
333 FEATURE_VALUE_TYPE(
334 autofill::features::kAutofillRestrictUnownedFieldsToFormlessCheckout)},
Roger McFarlanee193ab122018-11-22 20:55:07335 {"autofill-rich-metadata-queries",
336 flag_descriptions::kAutofillRichMetadataQueriesName,
337 flag_descriptions::kAutofillRichMetadataQueriesDescription,
338 flags_ui::kOsIos,
339 FEATURE_VALUE_TYPE(autofill::features::kAutofillRichMetadataQueries)},
Kurt Horimotodc33af32018-05-01 01:39:14340 {"fullscreen-viewport-adjustment-experiment",
341 flag_descriptions::kFullscreenViewportAdjustmentExperimentName,
342 flag_descriptions::kFullscreenViewportAdjustmentExperimentDescription,
343 flags_ui::kOsIos,
344 MULTI_VALUE_TYPE(
345 fullscreen::features::kViewportAdjustmentExperimentChoices)},
Roger McFarlane1a37d7b2018-04-20 22:45:19346 {"autofill-enforce-min-required-fields-for-heuristics",
347 flag_descriptions::kAutofillEnforceMinRequiredFieldsForHeuristicsName,
348 flag_descriptions::
349 kAutofillEnforceMinRequiredFieldsForHeuristicsDescription,
350 flags_ui::kOsIos,
351 FEATURE_VALUE_TYPE(
352 autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics)},
353 {"autofill-enforce-min-required-fields-for-query",
354 flag_descriptions::kAutofillEnforceMinRequiredFieldsForQueryName,
355 flag_descriptions::kAutofillEnforceMinRequiredFieldsForQueryDescription,
356 flags_ui::kOsIos,
357 FEATURE_VALUE_TYPE(
358 autofill::features::kAutofillEnforceMinRequiredFieldsForQuery)},
359 {"autofill-enforce-min-required-fields-for-upload",
360 flag_descriptions::kAutofillEnforceMinRequiredFieldsForUploadName,
361 flag_descriptions::kAutofillEnforceMinRequiredFieldsForUploadDescription,
362 flags_ui::kOsIos,
363 FEATURE_VALUE_TYPE(
364 autofill::features::kAutofillEnforceMinRequiredFieldsForUpload)},
Gauthier Ambard4417f852018-04-26 14:24:32365 {"browser-container-fullscreen",
366 flag_descriptions::kBrowserContainerFullscreenName,
367 flag_descriptions::kBrowserContainerFullscreenDescription,
Gauthier Ambard5d7627282018-05-18 08:20:07368 flags_ui::kOsIos,
369 FEATURE_VALUE_TYPE(web::features::kBrowserContainerFullscreen)},
Roger McFarlane2eceba982018-05-18 01:37:11370 {"autofill-cache-query-responses",
371 flag_descriptions::kAutofillCacheQueryResponsesName,
372 flag_descriptions::kAutofillCacheQueryResponsesDescription,
373 flags_ui::kOsIos,
374 FEATURE_VALUE_TYPE(autofill::features::kAutofillCacheQueryResponses)},
Jeffrey Cohen05cdafa392018-08-15 20:49:17375 {"autofill-enable-company-name",
376 flag_descriptions::kAutofillEnableCompanyNameName,
377 flag_descriptions::kAutofillEnableCompanyNameDescription, flags_ui::kOsIos,
378 FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableCompanyName)},
Javier Ernesto Flores Robles23c71a7d2018-06-01 09:51:17379 {"autofill-manual-fallback", flag_descriptions::kAutofillManualFallbackName,
380 flag_descriptions::kAutofillManualFallbackDescription, flags_ui::kOsIos,
381 FEATURE_VALUE_TYPE(autofill::features::kAutofillManualFallback)},
Yi Su392b3032018-06-05 07:26:47382 {"webpage-text-accessibility",
383 flag_descriptions::kWebPageTextAccessibilityName,
384 flag_descriptions::kWebPageTextAccessibilityDescription, flags_ui::kOsIos,
385 FEATURE_VALUE_TYPE(web::kWebPageTextAccessibility)},
Mike Dougherty39d36b02018-06-19 19:21:40386 {"web-frame-messaging", flag_descriptions::kWebFrameMessagingName,
387 flag_descriptions::kWebFrameMessagingDescription, flags_ui::kOsIos,
388 FEATURE_VALUE_TYPE(web::features::kWebFrameMessaging)},
Vadym Doroshenkoa9a914942018-07-19 08:23:30389 {"new-password-form-parsing",
390 flag_descriptions::kNewPasswordFormParsingName,
391 flag_descriptions::kNewPasswordFormParsingDescription, flags_ui::kOsIos,
392 FEATURE_VALUE_TYPE(password_manager::features::kNewPasswordFormParsing)},
mrefaat4539b032018-08-02 22:25:45393 {"app-launcher-refresh", flag_descriptions::kAppLauncherRefreshName,
394 flag_descriptions::kAppLauncherRefreshDescription, flags_ui::kOsIos,
395 FEATURE_VALUE_TYPE(kAppLauncherRefresh)},
Marc Treib6f0bbd22018-08-28 10:07:19396 {"sync-standalone-transport",
397 flag_descriptions::kSyncStandaloneTransportName,
398 flag_descriptions::kSyncStandaloneTransportDescription, flags_ui::kOsIos,
399 FEATURE_VALUE_TYPE(switches::kSyncStandaloneTransport)},
Marc Treib4bd95e72018-08-30 06:30:58400 {"sync-support-secondary-account",
401 flag_descriptions::kSyncSupportSecondaryAccountName,
402 flag_descriptions::kSyncSupportSecondaryAccountDescription,
403 flags_ui::kOsIos,
404 FEATURE_VALUE_TYPE(switches::kSyncSupportSecondaryAccount)},
Gauthier Ambard66de93d2018-08-30 15:58:19405 {"out-of-web-fullscreen", flag_descriptions::kOutOfWebFullscreenName,
406 flag_descriptions::kOutOfWebFullscreenDescription, flags_ui::kOsIos,
407 FEATURE_VALUE_TYPE(web::features::kOutOfWebFullscreen)},
Javier Ernesto Flores Robles8e66f732018-09-12 15:41:15408 {"autofill-manual-fallback-phase-two",
409 flag_descriptions::kAutofillManualFallbackPhaseTwoName,
410 flag_descriptions::kAutofillManualFallbackPhaseTwoDescription,
411 flags_ui::kOsIos,
412 FEATURE_VALUE_TYPE(autofill::features::kAutofillManualFallbackPhaseTwo)},
Kurt Horimoto79d590b2018-09-12 19:09:28413 {"toolbar-container", flag_descriptions::kToolbarContainerName,
414 flag_descriptions::kToolbarContainerDescription, flags_ui::kOsIos,
415 FEATURE_VALUE_TYPE(toolbar_container::kToolbarContainerEnabled)},
[email protected]5b899dc2018-10-02 09:20:01416 {"omnibox-popup-shortcuts",
417 flag_descriptions::kOmniboxPopupShortcutIconsInZeroStateName,
418 flag_descriptions::kOmniboxPopupShortcutIconsInZeroStateDescription,
419 flags_ui::kOsIos,
420 FEATURE_VALUE_TYPE(omnibox::kOmniboxPopupShortcutIconsInZeroState)},
Yi Sua3d55f3d2018-09-24 17:49:41421 {"custom-search-engines", flag_descriptions::kCustomSearchEnginesName,
422 flag_descriptions::kCustomSearchEnginesDescription, flags_ui::kOsIos,
423 FEATURE_VALUE_TYPE(kCustomSearchEngines)},
Valeriya Sinevicha79dc612018-09-25 14:49:09424 {"use-multilogin-endpoint", flag_descriptions::kUseMultiloginEndpointName,
425 flag_descriptions::kUseMultiloginEndpointDescription, flags_ui::kOsIos,
426 FEATURE_VALUE_TYPE(kUseMultiloginEndpoint)},
edchin18a3e602018-10-08 23:39:35427 {"closing-last-incognito-tab",
428 flag_descriptions::kClosingLastIncognitoTabName,
429 flag_descriptions::kClosingLastIncognitoTabDescription, flags_ui::kOsIos,
430 FEATURE_VALUE_TYPE(kClosingLastIncognitoTab)},
Gauthier Ambardce7fd582018-10-09 08:37:05431 {"omnibox-tab-switch-suggestions",
432 flag_descriptions::kOmniboxTabSwitchSuggestionsName,
433 flag_descriptions::kOmniboxTabSwitchSuggestionsDescription,
434 flags_ui::kOsIos,
435 FEATURE_VALUE_TYPE(omnibox::kOmniboxTabSwitchSuggestions)},
Stepan Khapugincc4e9842019-01-23 13:38:13436 {"omnibox-ui-max-autocomplete-matches",
437 flag_descriptions::kOmniboxUIMaxAutocompleteMatchesName,
438 flag_descriptions::kOmniboxUIMaxAutocompleteMatchesDescription,
439 flags_ui::kOsIos,
440 FEATURE_WITH_PARAMS_VALUE_TYPE(
441 omnibox::kUIExperimentMaxAutocompleteMatches,
442 kOmniboxUIMaxAutocompleteMatchesVariations,
443 "OmniboxUIMaxAutocompleteVariations")},
Tanja Gornakb0985dd2018-10-11 17:24:40444 {"fcm-invalidations", flag_descriptions::kFCMInvalidationsName,
445 flag_descriptions::kFCMInvalidationsDescription, flags_ui::kOsIos,
446 FEATURE_VALUE_TYPE(invalidation::switches::kFCMInvalidations)},
Justin Cohen9a5023212018-10-15 14:32:37447 {"browser-container-contains-ntp",
448 flag_descriptions::kBrowserContainerContainsNTPName,
449 flag_descriptions::kBrowserContainerContainsNTPDescription,
450 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kBrowserContainerContainsNTP)},
Eugene But66e917002019-01-07 23:38:52451 {"external-files-loaded-in-web-state",
452 flag_descriptions::kExternalFilesLoadedInWebStateName,
453 flag_descriptions::kExternalFilesLoadedInWebStateDescription,
454 flags_ui::kOsIos,
455 FEATURE_VALUE_TYPE(experimental_flags::kExternalFilesLoadedInWebState)},
Gauthier Ambard2392f2a2018-10-24 16:33:27456 {"search-icon-toggle", flag_descriptions::kSearchIconToggleName,
457 flag_descriptions::kSearchIconToggleDescription, flags_ui::kOsIos,
458 FEATURE_WITH_PARAMS_VALUE_TYPE(kIconForSearchButtonFeature,
459 kIconForSearchButtonVariations,
460 "ToggleSearchButtonIcon")},
Olivier Robin2a898dc2018-10-31 14:37:04461 {"enable-breakpad-upload-no-delay",
462 flag_descriptions::kBreakpadNoDelayInitialUploadName,
463 flag_descriptions::kBreakpadNoDelayInitialUploadDescription,
464 flags_ui::kOsIos,
465 FEATURE_VALUE_TYPE(crash_report::kBreakpadNoDelayInitialUpload)},
Moe Ahmadie4cce1f2018-12-18 23:48:01466 {"enable-compact-translate-infobar",
467 flag_descriptions::kCompactTranslateInfobarName,
468 flag_descriptions::kCompactTranslateInfobarDescription, flags_ui::kOsIos,
469 FEATURE_VALUE_TYPE(translate::kCompactTranslateInfobarIOS)},
Kurt Horimoto9165404a2018-11-13 23:48:12470 {"non-modal-dialogs", flag_descriptions::kNonModalDialogsName,
471 flag_descriptions::kNonModalDialogsDescription, flags_ui::kOsIos,
472 FEATURE_VALUE_TYPE(dialogs::kNonModalDialogs)},
Mikel Astizdb43c5652018-11-22 16:52:05473 {"sync-pseudo-uss-favicons", flag_descriptions::kSyncPseudoUSSFaviconsName,
474 flag_descriptions::kSyncPseudoUSSFaviconsDescription, flags_ui::kOsIos,
475 FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSFavicons)},
476 {"sync-pseudo-uss-history-delete-directives",
477 flag_descriptions::kSyncPseudoUSSHistoryDeleteDirectivesName,
478 flag_descriptions::kSyncPseudoUSSHistoryDeleteDirectivesDescription,
479 flags_ui::kOsIos,
480 FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSHistoryDeleteDirectives)},
Mikel Astizdb43c5652018-11-22 16:52:05481 {"sync-pseudo-uss-preferences",
482 flag_descriptions::kSyncPseudoUSSPreferencesName,
483 flag_descriptions::kSyncPseudoUSSPreferencesDescription, flags_ui::kOsIos,
484 FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSPreferences)},
485 {"sync-pseudo-uss-priority-preferences",
486 flag_descriptions::kSyncPseudoUSSPriorityPreferencesName,
487 flag_descriptions::kSyncPseudoUSSPriorityPreferencesDescription,
488 flags_ui::kOsIos,
489 FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSPriorityPreferences)},
Jérôme Lebel5717fa852018-12-19 12:11:13490 {"use-nsurlsession-for-signin",
491 flag_descriptions::kUseNSURLSessionForGaiaSigninRequestsName,
492 flag_descriptions::kUseNSURLSessionForGaiaSigninRequestsDescription,
493 flags_ui::kOsIos,
494 FEATURE_VALUE_TYPE(kUseNSURLSessionForGaiaSigninRequests)},
Mikel Astizdb43c5652018-11-22 16:52:05495 {"sync-pseudo-uss-supervised-users",
496 flag_descriptions::kSyncPseudoUSSSupervisedUsersName,
497 flag_descriptions::kSyncPseudoUSSSupervisedUsersDescription,
498 flags_ui::kOsIos,
499 FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSSupervisedUsers)},
Olivier Robince9386ebd2018-11-29 09:07:38500 {"detect-main-thread-freeze",
501 flag_descriptions::kDetectMainThreadFreezeName,
502 flag_descriptions::kDetectMainThreadFreezeDescription, flags_ui::kOsIos,
503 FEATURE_WITH_PARAMS_VALUE_TYPE(crash_report::kDetectMainThreadFreeze,
504 kDetectMainThreadFreezeVariations,
505 "DetectMainThreadFreeze")},
Mohamed Amir Yosef9e8a1f02018-12-03 21:41:14506 {"enable-sync-uss-bookmarks",
507 flag_descriptions::kEnableSyncUSSBookmarksName,
508 flag_descriptions::kEnableSyncUSSBookmarksDescription, flags_ui::kOsIos,
509 FEATURE_VALUE_TYPE(switches::kSyncUSSBookmarks)},
sczs80a6f462018-12-05 20:37:18510 {"infobar-ui-reboot", flag_descriptions::kInfobarUIRebootName,
511 flag_descriptions::kInfobarUIRebootDescription, flags_ui::kOsIos,
512 FEATURE_VALUE_TYPE(kInfobarUIReboot)},
Chris Lu77905ac2018-12-06 20:46:51513 {"find-in-page-iframe", flag_descriptions::kFindInPageiFrameName,
514 flag_descriptions::kFindInPageiFrameDescription, flags_ui::kOsIos,
515 FEATURE_VALUE_TYPE(kFindInPageiFrame)},
Robbie Gibson80d732e2019-01-10 10:42:49516 {"enable-clipboard-provider-text-suggestions",
517 flag_descriptions::kEnableClipboardProviderTextSuggestionsName,
518 flag_descriptions::kEnableClipboardProviderTextSuggestionsDescription,
519 flags_ui::kOsIos,
520 FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProviderTextSuggestions)},
521 {"enable-clipboard-provider-image-suggestions",
522 flag_descriptions::kEnableClipboardProviderImageSuggestionsName,
523 flag_descriptions::kEnableClipboardProviderImageSuggestionsDescription,
524 flags_ui::kOsIos,
525 FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProviderImageSuggestions)},
526 {"copied-content-behavior", flag_descriptions::kCopiedContentBehaviorName,
527 flag_descriptions::kCopiedContentBehaviorName, flags_ui::kOsIos,
528 FEATURE_VALUE_TYPE(kCopiedContentBehavior)},
Vadym Doroshenkod178ff3f2019-01-02 14:59:23529 {"new-password-form-parsing-for-saving",
530 flag_descriptions::kNewPasswordFormParsingForSavingName,
531 flag_descriptions::kNewPasswordFormParsingForSavingDescription,
532 flags_ui::kOsIos,
533 FEATURE_VALUE_TYPE(
534 password_manager::features::kNewPasswordFormParsingForSaving)},
535 {"only-new-password-form-parsing",
536 flag_descriptions::kOnlyNewPasswordFormParsingName,
537 flag_descriptions::kOnlyNewPasswordFormParsingDescription,
538 flags_ui::kOsIos,
539 FEATURE_VALUE_TYPE(password_manager::features::kOnlyNewParser)},
edchin5ae0b4c2019-01-06 06:52:28540 {"snapshot-draw-view", flag_descriptions::kSnapshotDrawViewName,
541 flag_descriptions::kSnapshotDrawViewDescription, flags_ui::kOsIos,
542 FEATURE_VALUE_TYPE(kSnapshotDrawView)},
Sebastien Lalancette5daaf4a2019-01-11 22:09:25543 {"enable-autocomplete-data-retention-policy",
544 flag_descriptions::kEnableAutocompleteDataRetentionPolicyName,
545 flag_descriptions::kEnableAutocompleteDataRetentionPolicyDescription,
546 flags_ui::kOsIos,
547 FEATURE_VALUE_TYPE(
548 autofill::features::kAutocompleteRetentionPolicyEnabled)},
Justin Cohen20b6f072019-01-16 01:38:50549#if defined(DCHECK_IS_CONFIGURABLE)
550 {"dcheck-is-fatal", flag_descriptions::kDcheckIsFatalName,
551 flag_descriptions::kDcheckIsFatalDescription, flags_ui::kOsIos,
552 FEATURE_VALUE_TYPE(base::kDCheckIsFatalFeature)},
553#endif // defined(DCHECK_IS_CONFIGURABLE)
Gauthier Ambard5f610862019-01-17 11:43:55554 {"settings-refresh", flag_descriptions::kSettingsRefreshName,
555 flag_descriptions::kSettingsRefreshDescription, flags_ui::kOsIos,
556 FEATURE_VALUE_TYPE(kSettingsRefresh)},
Justin Cohencd633af2019-01-29 20:19:00557 {"browser-container-keeps-content-view",
558 flag_descriptions::kBrowserContainerKeepsContentViewName,
559 flag_descriptions::kBrowserContainerKeepsContentViewDescription,
560 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kBrowserContainerKeepsContentView)},
Gauthier Ambardef4442a2019-02-15 11:14:42561 {"web-clear-browsing-data", flag_descriptions::kWebClearBrowsingDataName,
562 flag_descriptions::kWebClearBrowsingDataDescription, flags_ui::kOsIos,
563 FEATURE_VALUE_TYPE(experimental_flags::kWebClearBrowsingData)},
Gauthier Ambardce6f0bf2019-02-21 10:39:13564 {"web-ui-scheme-handling", flag_descriptions::kWebUISchemeHandlingName,
565 flag_descriptions::kWebUISchemeHandlingDescription, flags_ui::kOsIos,
566 FEATURE_VALUE_TYPE(web::features::kWebUISchemeHandling)},
Gauthier Ambardcfd85182018-01-05 10:37:46567};
sdefresne14900ee2015-11-27 14:43:21568
569// Add all switches from experimental flags to |command_line|.
570void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) {
571 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
572
sdefresne14900ee2015-11-27 14:43:21573 // Set the UA flag if UseMobileSafariUA is enabled.
574 if ([defaults boolForKey:@"UseMobileSafariUA"]) {
575 // Safari uses "Vesion/", followed by the OS version excluding bugfix, where
576 // Chrome puts its product token.
avi571943672015-12-22 02:12:49577 int32_t major = 0;
578 int32_t minor = 0;
579 int32_t bugfix = 0;
sdefresne14900ee2015-11-27 14:43:21580 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
581 std::string product = base::StringPrintf("Version/%d.%d", major, minor);
582
583 command_line->AppendSwitchASCII(switches::kUserAgent,
584 web::BuildUserAgentFromProduct(product));
585 }
586
587 // Freeform commandline flags. These are added last, so that any flags added
588 // earlier in this function take precedence.
589 if ([defaults boolForKey:@"EnableFreeformCommandLineFlags"]) {
590 base::CommandLine::StringVector flags;
591 // Append an empty "program" argument.
592 flags.push_back("");
593
594 // The number of flags corresponds to the number of text fields in
595 // Experimental.plist.
596 const int kNumFreeformFlags = 5;
597 for (int i = 1; i <= kNumFreeformFlags; ++i) {
598 NSString* key =
599 [NSString stringWithFormat:@"FreeformCommandLineFlag%d", i];
600 NSString* flag = [defaults stringForKey:key];
601 if ([flag length]) {
602 flags.push_back(base::SysNSStringToUTF8(flag));
603 }
604 }
605
606 base::CommandLine temp_command_line(flags);
607 command_line->AppendArguments(temp_command_line, false);
608 }
msardafc76f662017-02-24 12:46:28609
justincohendacc85d2017-06-28 23:34:10610 // Populate command line flag for 3rd party keyboard omnibox workaround.
611 NSString* enableThirdPartyKeyboardWorkaround =
612 [defaults stringForKey:@"EnableThirdPartyKeyboardWorkaround"];
613 if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Enabled"]) {
614 command_line->AppendSwitch(switches::kEnableThirdPartyKeyboardWorkaround);
615 } else if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Disabled"]) {
616 command_line->AppendSwitch(switches::kDisableThirdPartyKeyboardWorkaround);
617 }
618
msardafc76f662017-02-24 12:46:28619 ios::GetChromeBrowserProvider()->AppendSwitchesFromExperimentalSettings(
620 defaults, command_line);
sdefresne14900ee2015-11-27 14:43:21621}
622
623bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) {
624 return false;
625}
626
Sylvain Defresne8327a2f2019-01-17 14:19:18627flags_ui::FlagsState& GetGlobalFlagsState() {
628 static base::NoDestructor<flags_ui::FlagsState> flags_state(
629 kFeatureEntries, base::size(kFeatureEntries));
630 return *flags_state;
631}
sdefresne14900ee2015-11-27 14:43:21632} // namespace
633
634void ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage,
635 base::CommandLine* command_line) {
Gregory Chatzinoff31305112017-12-20 21:56:02636 AppendSwitchesFromExperimentalSettings(command_line);
Sylvain Defresne8327a2f2019-01-17 14:19:18637 GetGlobalFlagsState().ConvertFlagsToSwitches(
sdefresnec9763902015-12-02 10:30:11638 flags_storage, command_line, flags_ui::kAddSentinels,
Gregory Chatzinofff6523722017-11-21 01:33:53639 switches::kEnableFeatures, switches::kDisableFeatures);
sdefresne14900ee2015-11-27 14:43:21640}
641
jkrcalbf073372016-07-29 07:21:31642std::vector<std::string> RegisterAllFeatureVariationParameters(
643 flags_ui::FlagsStorage* flags_storage,
644 base::FeatureList* feature_list) {
Sylvain Defresne8327a2f2019-01-17 14:19:18645 return GetGlobalFlagsState().RegisterAllFeatureVariationParameters(
646 flags_storage, feature_list);
jkrcalbf073372016-07-29 07:21:31647}
648
sdefresne14900ee2015-11-27 14:43:21649void GetFlagFeatureEntries(flags_ui::FlagsStorage* flags_storage,
650 flags_ui::FlagAccess access,
651 base::ListValue* supported_entries,
652 base::ListValue* unsupported_entries) {
Sylvain Defresne8327a2f2019-01-17 14:19:18653 GetGlobalFlagsState().GetFlagFeatureEntries(
sdefresne14900ee2015-11-27 14:43:21654 flags_storage, access, supported_entries, unsupported_entries,
655 base::Bind(&SkipConditionalFeatureEntry));
656}
657
658void SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage,
659 const std::string& internal_name,
660 bool enable) {
Sylvain Defresne8327a2f2019-01-17 14:19:18661 GetGlobalFlagsState().SetFeatureEntryEnabled(flags_storage, internal_name,
662 enable);
sdefresne14900ee2015-11-27 14:43:21663}
664
665void ResetAllFlags(flags_ui::FlagsStorage* flags_storage) {
Sylvain Defresne8327a2f2019-01-17 14:19:18666 GetGlobalFlagsState().ResetAllFlags(flags_storage);
sdefresne14900ee2015-11-27 14:43:21667}
668
669namespace testing {
670
671const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) {
kokihoon189a4022018-10-13 02:43:44672 *count = base::size(kFeatureEntries);
sdefresne14900ee2015-11-27 14:43:21673 return kFeatureEntries;
674}
675
676} // namespace testing