blob: c95697195d996756854800b2d21625a0b432802d [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"
Jared Sauld998539f2019-03-19 15:11:1724#include "components/autofill/core/common/autofill_payments_features.h"
Moe Ahmadid6d5d172018-06-20 17:20:2325#include "components/autofill/core/common/autofill_switches.h"
Olivier Robin3d60411622018-02-23 10:03:2226#include "components/autofill/ios/browser/autofill_switches.h"
sdefresne14900ee2015-11-27 14:43:2127#include "components/dom_distiller/core/dom_distiller_switches.h"
Tommy Nyquistc1d6dea12017-07-26 20:37:2328#include "components/feature_engagement/public/feature_constants.h"
29#include "components/feature_engagement/public/feature_list.h"
sdefresne14900ee2015-11-27 14:43:2130#include "components/flags_ui/feature_entry.h"
31#include "components/flags_ui/feature_entry_macros.h"
32#include "components/flags_ui/flags_storage.h"
33#include "components/flags_ui/flags_ui_switches.h"
Tanja Gornakb0985dd2018-10-11 17:24:4034#include "components/invalidation/impl/invalidation_switches.h"
noyau4cfb1332016-10-25 17:05:4235#include "components/ntp_tiles/switches.h"
Justin Donnelly33d712e2017-08-23 21:32:5136#include "components/omnibox/browser/omnibox_field_trial.h"
Tomasz Wiszkowskid938a1112019-03-06 18:01:5737#include "components/omnibox/common/omnibox_features.h"
Ioana Pandeled14ce9e2017-11-28 14:41:4638#include "components/password_manager/core/common/password_manager_features.h"
mathp9b4c11d2017-07-06 20:24:1339#include "components/payments/core/features.h"
Marc Treib5fc99e1f2017-11-08 12:19:1840#include "components/search_provider_logos/switches.h"
Emily Starkbafa9062017-12-27 15:22:4641#include "components/security_state/core/features.h"
Sébastien Séguin-Gagnondcb854b2019-04-10 16:36:4442#include "components/send_tab_to_self/features.h"
Valeriya Sinevicha79dc612018-09-25 14:49:0943#include "components/signin/core/browser/account_reconcilor.h"
David Rogera6c88122017-10-25 13:02:4644#include "components/signin/core/browser/signin_switches.h"
sdefresne36579782016-02-05 11:08:2545#include "components/strings/grit/components_strings.h"
Moe Ahmadid6d5d172018-06-20 17:20:2346#include "components/sync/driver/sync_driver_switches.h"
Moe Ahmadie4cce1f2018-12-18 23:48:0147#include "components/translate/core/browser/translate_prefs.h"
Chris Lu0683adf2019-02-26 15:56:4548#include "components/ukm/ios/features.h"
Mihai Sardarescu160ec662018-07-18 21:13:5149#include "components/unified_consent/feature.h"
mrefaat4539b032018-08-02 22:25:4550#include "ios/chrome/browser/app_launcher/app_launcher_flags.h"
Sylvain Defresneae6987e2018-03-01 13:21:4051#include "ios/chrome/browser/browsing_data/browsing_data_features.h"
sdefresne14900ee2015-11-27 14:43:2152#include "ios/chrome/browser/chrome_switches.h"
Olivier Robin2a898dc2018-10-31 14:37:0453#include "ios/chrome/browser/crash_report/crash_report_flags.h"
Jean-François Geyelin30be5912017-08-25 12:05:3854#include "ios/chrome/browser/drag_and_drop/drag_and_drop_flag.h"
Chris Lu77905ac2018-12-06 20:46:5155#include "ios/chrome/browser/find_in_page/features.h"
vabr0215a8e2017-03-28 12:47:3456#include "ios/chrome/browser/ios_chrome_flag_descriptions.h"
David Jean7d0bff12019-04-01 08:21:1457#include "ios/chrome/browser/passwords/password_manager_features.h"
Olivier Robin091319d2019-03-04 10:45:3458#include "ios/chrome/browser/reading_list/features.h"
Jérôme Lebelec282832018-09-18 08:34:1859#include "ios/chrome/browser/signin/feature_flags.h"
Gauthier Ambard33e03302019-02-21 13:28:5860#include "ios/chrome/browser/system_flags.h"
Kurt Horimoto9165404a2018-11-13 23:48:1261#import "ios/chrome/browser/ui/dialogs/dialog_features.h"
Kurt Horimoto4da682b022018-04-12 07:43:3562#import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
sczs80a6f462018-12-05 20:37:1863#import "ios/chrome/browser/ui/infobars/infobar_feature.h"
Mark Cogan02ed6c772018-05-31 17:00:5164#import "ios/chrome/browser/ui/toolbar/public/features.h"
Kurt Horimoto79d590b2018-09-12 19:09:2865#import "ios/chrome/browser/ui/toolbar_container/toolbar_container_features.h"
Justin Cohen2d81c582018-01-22 14:46:4466#include "ios/chrome/browser/ui/ui_feature_flags.h"
Yi Su392b3032018-06-05 07:26:4767#include "ios/chrome/browser/web/features.h"
sdefresne14900ee2015-11-27 14:43:2168#include "ios/chrome/grit/ios_strings.h"
msardafc76f662017-02-24 12:46:2869#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
Danyao Wang34da6ff2017-10-30 15:16:5670#include "ios/web/public/features.h"
sdefresne14900ee2015-11-27 14:43:2171#include "ios/web/public/user_agent.h"
72#include "ios/web/public/web_view_creation_util.h"
73
74#if !defined(OFFICIAL_BUILD)
75#include "components/variations/variations_switches.h"
vitaliii489217aa2017-01-30 14:50:2276#endif
stkhapuginc1be1792016-12-13 14:30:5377
78#if !defined(__has_feature) || !__has_feature(objc_arc)
79#error "This file requires ARC support."
80#endif
sdefresne14900ee2015-11-27 14:43:2181
elawrence816f6790e2017-06-16 18:19:2882using flags_ui::FeatureEntry;
83
sdefresne14900ee2015-11-27 14:43:2184namespace {
Emily Starkbafa9062017-12-27 15:22:4685
86const FeatureEntry::FeatureParam kMarkHttpAsDangerous[] = {
87 {security_state::features::kMarkHttpAsFeatureParameterName,
88 security_state::features::kMarkHttpAsParameterDangerous}};
Emily Starkbafa9062017-12-27 15:22:4689const FeatureEntry::FeatureParam kMarkHttpAsWarningAndDangerousOnFormEdits[] = {
90 {security_state::features::kMarkHttpAsFeatureParameterName,
91 security_state::features::
92 kMarkHttpAsParameterWarningAndDangerousOnFormEdits}};
Emily Starkbafa9062017-12-27 15:22:4693
94const FeatureEntry::FeatureVariation kMarkHttpAsFeatureVariations[] = {
95 {"(mark as actively dangerous)", kMarkHttpAsDangerous,
kokihoon189a4022018-10-13 02:43:4496 base::size(kMarkHttpAsDangerous), nullptr},
Emily Starkbafa9062017-12-27 15:22:4697 {"(mark with a Not Secure warning and dangerous on form edits)",
98 kMarkHttpAsWarningAndDangerousOnFormEdits,
Joe DeBlasio20e01fd2018-12-20 19:59:3099 base::size(kMarkHttpAsWarningAndDangerousOnFormEdits), nullptr}};
elawrence816f6790e2017-06-16 18:19:28100
Marc Treib5fc99e1f2017-11-08 12:19:18101const FeatureEntry::Choice kUseDdljsonApiChoices[] = {
102 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
103 {"(force test doodle 0)", search_provider_logos::switches::kGoogleDoodleUrl,
104 "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios0.json"},
105 {"(force test doodle 1)", search_provider_logos::switches::kGoogleDoodleUrl,
106 "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios1.json"},
107 {"(force test doodle 2)", search_provider_logos::switches::kGoogleDoodleUrl,
108 "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios2.json"},
109 {"(force test doodle 3)", search_provider_logos::switches::kGoogleDoodleUrl,
110 "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios3.json"},
111 {"(force test doodle 4)", search_provider_logos::switches::kGoogleDoodleUrl,
112 "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios4.json"},
113};
Marc Treib2752e8b2017-08-04 14:12:09114
Olivier Robin3d60411622018-02-23 10:03:22115const FeatureEntry::Choice kAutofillIOSDelayBetweenFieldsChoices[] = {
116 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
117 {"0", autofill::switches::kAutofillIOSDelayBetweenFields, "0"},
118 {"10", autofill::switches::kAutofillIOSDelayBetweenFields, "10"},
119 {"20", autofill::switches::kAutofillIOSDelayBetweenFields, "20"},
120 {"50", autofill::switches::kAutofillIOSDelayBetweenFields, "50"},
121 {"100", autofill::switches::kAutofillIOSDelayBetweenFields, "100"},
122 {"200", autofill::switches::kAutofillIOSDelayBetweenFields, "200"},
123 {"500", autofill::switches::kAutofillIOSDelayBetweenFields, "500"},
124 {"1000", autofill::switches::kAutofillIOSDelayBetweenFields, "1000"},
125};
126
Stepan Khapugincc4e9842019-01-23 13:38:13127const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches3[] = {
128 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "3"}};
129const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches4[] = {
130 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "4"}};
131const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches5[] = {
132 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "5"}};
133const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches6[] = {
134 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "6"}};
135const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches8[] = {
136 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "8"}};
137const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches10[] = {
138 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "10"}};
139const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches12[] = {
140 {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "12"}};
141
142const FeatureEntry::FeatureVariation
143 kOmniboxUIMaxAutocompleteMatchesVariations[] = {
144 {"3 matches", kOmniboxUIMaxAutocompleteMatches3,
145 base::size(kOmniboxUIMaxAutocompleteMatches3), nullptr},
146 {"4 matches", kOmniboxUIMaxAutocompleteMatches4,
147 base::size(kOmniboxUIMaxAutocompleteMatches4), nullptr},
148 {"5 matches", kOmniboxUIMaxAutocompleteMatches5,
149 base::size(kOmniboxUIMaxAutocompleteMatches5), nullptr},
150 {"6 matches", kOmniboxUIMaxAutocompleteMatches6,
151 base::size(kOmniboxUIMaxAutocompleteMatches6), nullptr},
152 {"8 matches", kOmniboxUIMaxAutocompleteMatches8,
153 base::size(kOmniboxUIMaxAutocompleteMatches8), nullptr},
154 {"10 matches", kOmniboxUIMaxAutocompleteMatches10,
155 base::size(kOmniboxUIMaxAutocompleteMatches10), nullptr},
156 {"12 matches", kOmniboxUIMaxAutocompleteMatches12,
157 base::size(kOmniboxUIMaxAutocompleteMatches12), nullptr}};
158
Gauthier Ambard2392f2a2018-10-24 16:33:27159const FeatureEntry::FeatureParam kIconForSearchButtonGrey[] = {
160 {kIconForSearchButtonFeatureParameterName,
161 kIconForSearchButtonParameterGrey}};
162const FeatureEntry::FeatureParam kIconForSearchButtonColorful[] = {
163 {kIconForSearchButtonFeatureParameterName,
164 kIconForSearchButtonParameterColorful}};
165const FeatureEntry::FeatureParam kIconForSearchButtonMagnifying[] = {
166 {kIconForSearchButtonFeatureParameterName,
167 kIconForSearchButtonParameterMagnifying}};
168
169const FeatureEntry::FeatureVariation kIconForSearchButtonVariations[] = {
170 {"Grey search engine logo", kIconForSearchButtonGrey,
171 base::size(kIconForSearchButtonGrey), nullptr},
172 {"Colorful search engine logo", kIconForSearchButtonColorful,
173 base::size(kIconForSearchButtonColorful), nullptr},
174 {"Magnifying glass", kIconForSearchButtonMagnifying,
175 base::size(kIconForSearchButtonMagnifying), nullptr}};
176
Olivier Robince9386ebd2018-11-29 09:07:38177const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout3s[] = {
178 {crash_report::kDetectMainThreadFreezeParameterName,
179 crash_report::kDetectMainThreadFreezeParameter3s}};
180const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout5s[] = {
181 {crash_report::kDetectMainThreadFreezeParameterName,
182 crash_report::kDetectMainThreadFreezeParameter5s}};
183const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout7s[] = {
184 {crash_report::kDetectMainThreadFreezeParameterName,
185 crash_report::kDetectMainThreadFreezeParameter7s}};
186const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout9s[] = {
187 {crash_report::kDetectMainThreadFreezeParameterName,
188 crash_report::kDetectMainThreadFreezeParameter9s}};
189
190const FeatureEntry::FeatureVariation kDetectMainThreadFreezeVariations[] = {
191 {"3s", kDetectMainThreadFreezeTimeout3s,
192 base::size(kDetectMainThreadFreezeTimeout3s), nullptr},
193 {"5s", kDetectMainThreadFreezeTimeout5s,
194 base::size(kDetectMainThreadFreezeTimeout5s), nullptr},
195 {"7s", kDetectMainThreadFreezeTimeout7s,
196 base::size(kDetectMainThreadFreezeTimeout7s), nullptr},
197 {"9s", kDetectMainThreadFreezeTimeout9s,
198 base::size(kDetectMainThreadFreezeTimeout9s), nullptr}};
199
Cooper Knaak1e026562017-07-26 05:22:28200// To add a new entry, add to the end of kFeatureEntries. There are four
sdefresne14900ee2015-11-27 14:43:21201// distinct types of entries:
Cooper Knaak1e026562017-07-26 05:22:28202// . ENABLE_DISABLE_VALUE: entry is either enabled, disabled, or uses the
203// default value for this feature. Use the ENABLE_DISABLE_VALUE_TYPE
sdefresne14900ee2015-11-27 14:43:21204// macro for this type supplying the command line to the macro.
205// . MULTI_VALUE: a list of choices, the first of which should correspond to a
206// deactivated state for this lab (i.e. no command line option). To specify
207// this type of entry use the macro MULTI_VALUE_TYPE supplying it the
208// array of choices.
Cooper Knaak1e026562017-07-26 05:22:28209// . FEATURE_VALUE: entry is associated with a base::Feature instance. Entry is
210// either enabled, disabled, or uses the default value of the associated
211// base::Feature instance. To specify this type of entry use the macro
212// FEATURE_VALUE_TYPE supplying it the base::Feature instance.
213// . FEATURE_WITH_PARAM_VALUES: a list of choices associated with a
214// base::Feature instance. Choices corresponding to the default state, a
215// universally enabled state, and a universally disabled state are
216// automatically included. To specify this type of entry use the macro
217// FEATURE_WITH_PARAMS_VALUE_TYPE supplying it the base::Feature instance and
218// the array of choices.
219//
sdefresne14900ee2015-11-27 14:43:21220// See the documentation of FeatureEntry for details on the fields.
221//
222// When adding a new choice, add it to the end of the list.
223const flags_ui::FeatureEntry kFeatureEntries[] = {
Emily Starkbafa9062017-12-27 15:22:46224 {"enable-mark-http-as", flag_descriptions::kMarkHttpAsName,
elawrence816f6790e2017-06-16 18:19:28225 flag_descriptions::kMarkHttpAsDescription, flags_ui::kOsIos,
Emily Starkbafa9062017-12-27 15:22:46226 FEATURE_WITH_PARAMS_VALUE_TYPE(
227 security_state::features::kMarkHttpAsFeature,
228 kMarkHttpAsFeatureVariations,
229 "MarkHttpAs")},
Cooper Knaak1e026562017-07-26 05:22:28230 {"in-product-help-demo-mode-choice",
231 flag_descriptions::kInProductHelpDemoModeName,
232 flag_descriptions::kInProductHelpDemoModeDescription, flags_ui::kOsIos,
233 FEATURE_WITH_PARAMS_VALUE_TYPE(
Tommy Nyquistc1d6dea12017-07-26 20:37:23234 feature_engagement::kIPHDemoMode,
235 feature_engagement::kIPHDemoModeChoiceVariations,
Marc Treib2752e8b2017-08-04 14:12:09236 "IPH_DemoMode")},
237 {"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)},
mrefaata6501d92017-12-11 19:50:50251 {"wk-http-system-cookie-store",
252 flag_descriptions::kWKHTTPSystemCookieStoreName,
253 flag_descriptions::kWKHTTPSystemCookieStoreName, flags_ui::kOsIos,
Mohamad Ahmadic4df81f2017-12-20 04:41:59254 FEATURE_VALUE_TYPE(web::features::kWKHTTPSystemCookieStore)},
Moe Ahmadic3fd7cd2018-05-11 21:40:22255 {"enable-autofill-credit-card-upload",
256 flag_descriptions::kAutofillCreditCardUploadName,
257 flag_descriptions::kAutofillCreditCardUploadDescription, flags_ui::kOsIos,
Anne Lim579b5732018-08-30 18:24:24258 FEATURE_VALUE_TYPE(autofill::features::kAutofillUpstream)},
Lakshmi Kumar Dabbiruee22004e2018-06-01 01:52:27259 {"enable-autofill-credit-card-downstream-google-pay-branding",
260 flag_descriptions::kAutofillDownstreamUseGooglePayBrandingOniOSName,
261 flag_descriptions::kAutofillDownstreamUseGooglePayBrandingOniOSDescription,
262 flags_ui::kOsIos,
263 FEATURE_VALUE_TYPE(
264 autofill::features::kAutofillDownstreamUseGooglePayBrandingOniOS)},
Jared Saul2e55e7f12018-10-26 20:44:43265 {"enable-autofill-save-credit-card-uses-strike-system",
266 flag_descriptions::kEnableAutofillSaveCreditCardUsesStrikeSystemName,
267 flag_descriptions::
268 kEnableAutofillSaveCreditCardUsesStrikeSystemDescription,
269 flags_ui::kOsIos,
270 FEATURE_VALUE_TYPE(
271 autofill::features::kAutofillSaveCreditCardUsesStrikeSystem)},
Anne Lim9d8f66a2019-01-07 23:49:21272 {"enable-autofill-save-credit-card-uses-strike-system-v2",
273 flag_descriptions::kEnableAutofillSaveCreditCardUsesStrikeSystemV2Name,
274 flag_descriptions::
275 kEnableAutofillSaveCreditCardUsesStrikeSystemV2Description,
276 flags_ui::kOsIos,
277 FEATURE_VALUE_TYPE(
278 autofill::features::kAutofillSaveCreditCardUsesStrikeSystemV2)},
Moe Ahmadid6d5d172018-06-20 17:20:23279 {"use-sync-sandbox", flag_descriptions::kSyncSandboxName,
280 flag_descriptions::kSyncSandboxDescription, flags_ui::kOsIos,
281 SINGLE_VALUE_TYPE_AND_VALUE(
282 switches::kSyncServiceURL,
283 "https://chrome-sync.sandbox.google.com/chrome-sync/alpha")},
284 {"wallet-service-use-sandbox",
285 flag_descriptions::kWalletServiceUseSandboxName,
286 flag_descriptions::kWalletServiceUseSandboxDescription, flags_ui::kOsIos,
287 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(
288 autofill::switches::kWalletServiceUseSandbox,
289 "1",
290 autofill::switches::kWalletServiceUseSandbox,
291 "0")},
Mohamad Ahmadic4df81f2017-12-20 04:41:59292 {"show-autofill-type-predictions",
293 flag_descriptions::kShowAutofillTypePredictionsName,
294 flag_descriptions::kShowAutofillTypePredictionsDescription,
295 flags_ui::kOsIos,
Gauthier Ambardcfd85182018-01-05 10:37:46296 FEATURE_VALUE_TYPE(autofill::features::kAutofillShowTypePredictions)},
Olivier Robin3d60411622018-02-23 10:03:22297 {"autofill-ios-delay-between-fields",
298 flag_descriptions::kAutofillIOSDelayBetweenFieldsName,
299 flag_descriptions::kAutofillIOSDelayBetweenFieldsDescription,
300 flags_ui::kOsIos, MULTI_VALUE_TYPE(kAutofillIOSDelayBetweenFieldsChoices)},
Sylvain Defresneae6987e2018-03-01 13:21:40301 {"new-clear-browsing-data-ui",
302 flag_descriptions::kNewClearBrowsingDataUIName,
303 flag_descriptions::kNewClearBrowsingDataUIDescription, flags_ui::kOsIos,
304 FEATURE_VALUE_TYPE(kNewClearBrowsingDataUI)},
Jérôme Lebelfa6c5ae2018-03-29 13:46:57305 {"unified-consent", flag_descriptions::kUnifiedConsentName,
306 flag_descriptions::kUnifiedConsentDescription, flags_ui::kOsIos,
Mihai Sardarescu160ec662018-07-18 21:13:51307 FEATURE_VALUE_TYPE(unified_consent::kUnifiedConsent)},
Olivier Robind81475b02018-06-20 21:30:11308 {"autofill-show-all-profiles-on-prefilled-forms",
309 flag_descriptions::kAutofillShowAllSuggestionsOnPrefilledFormsName,
310 flag_descriptions::kAutofillShowAllSuggestionsOnPrefilledFormsDescription,
311 flags_ui::kOsIos,
312 FEATURE_VALUE_TYPE(
313 autofill::features::kAutofillShowAllSuggestionsOnPrefilledForms)},
Moe Ahmadid3ddfcb2018-04-20 19:51:08314 {"autofill-restrict-formless-form-extraction",
315 flag_descriptions::kAutofillRestrictUnownedFieldsToFormlessCheckoutName,
316 flag_descriptions::
317 kAutofillRestrictUnownedFieldsToFormlessCheckoutDescription,
318 flags_ui::kOsIos,
319 FEATURE_VALUE_TYPE(
320 autofill::features::kAutofillRestrictUnownedFieldsToFormlessCheckout)},
Roger McFarlanee193ab122018-11-22 20:55:07321 {"autofill-rich-metadata-queries",
322 flag_descriptions::kAutofillRichMetadataQueriesName,
323 flag_descriptions::kAutofillRichMetadataQueriesDescription,
324 flags_ui::kOsIos,
325 FEATURE_VALUE_TYPE(autofill::features::kAutofillRichMetadataQueries)},
Kurt Horimotodc33af32018-05-01 01:39:14326 {"fullscreen-viewport-adjustment-experiment",
327 flag_descriptions::kFullscreenViewportAdjustmentExperimentName,
328 flag_descriptions::kFullscreenViewportAdjustmentExperimentDescription,
329 flags_ui::kOsIos,
330 MULTI_VALUE_TYPE(
331 fullscreen::features::kViewportAdjustmentExperimentChoices)},
Roger McFarlane1a37d7b2018-04-20 22:45:19332 {"autofill-enforce-min-required-fields-for-heuristics",
333 flag_descriptions::kAutofillEnforceMinRequiredFieldsForHeuristicsName,
334 flag_descriptions::
335 kAutofillEnforceMinRequiredFieldsForHeuristicsDescription,
336 flags_ui::kOsIos,
337 FEATURE_VALUE_TYPE(
338 autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics)},
339 {"autofill-enforce-min-required-fields-for-query",
340 flag_descriptions::kAutofillEnforceMinRequiredFieldsForQueryName,
341 flag_descriptions::kAutofillEnforceMinRequiredFieldsForQueryDescription,
342 flags_ui::kOsIos,
343 FEATURE_VALUE_TYPE(
344 autofill::features::kAutofillEnforceMinRequiredFieldsForQuery)},
345 {"autofill-enforce-min-required-fields-for-upload",
346 flag_descriptions::kAutofillEnforceMinRequiredFieldsForUploadName,
347 flag_descriptions::kAutofillEnforceMinRequiredFieldsForUploadDescription,
348 flags_ui::kOsIos,
349 FEATURE_VALUE_TYPE(
350 autofill::features::kAutofillEnforceMinRequiredFieldsForUpload)},
Roger McFarlane2eceba982018-05-18 01:37:11351 {"autofill-cache-query-responses",
352 flag_descriptions::kAutofillCacheQueryResponsesName,
353 flag_descriptions::kAutofillCacheQueryResponsesDescription,
354 flags_ui::kOsIos,
355 FEATURE_VALUE_TYPE(autofill::features::kAutofillCacheQueryResponses)},
Jeffrey Cohen05cdafa392018-08-15 20:49:17356 {"autofill-enable-company-name",
357 flag_descriptions::kAutofillEnableCompanyNameName,
358 flag_descriptions::kAutofillEnableCompanyNameDescription, flags_ui::kOsIos,
359 FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableCompanyName)},
Javier Ernesto Flores Robles23c71a7d2018-06-01 09:51:17360 {"autofill-manual-fallback", flag_descriptions::kAutofillManualFallbackName,
361 flag_descriptions::kAutofillManualFallbackDescription, flags_ui::kOsIos,
362 FEATURE_VALUE_TYPE(autofill::features::kAutofillManualFallback)},
Yi Su392b3032018-06-05 07:26:47363 {"webpage-text-accessibility",
364 flag_descriptions::kWebPageTextAccessibilityName,
365 flag_descriptions::kWebPageTextAccessibilityDescription, flags_ui::kOsIos,
366 FEATURE_VALUE_TYPE(web::kWebPageTextAccessibility)},
Vadym Doroshenkoa9a914942018-07-19 08:23:30367 {"new-password-form-parsing",
368 flag_descriptions::kNewPasswordFormParsingName,
369 flag_descriptions::kNewPasswordFormParsingDescription, flags_ui::kOsIos,
370 FEATURE_VALUE_TYPE(password_manager::features::kNewPasswordFormParsing)},
mrefaat4539b032018-08-02 22:25:45371 {"app-launcher-refresh", flag_descriptions::kAppLauncherRefreshName,
372 flag_descriptions::kAppLauncherRefreshDescription, flags_ui::kOsIos,
373 FEATURE_VALUE_TYPE(kAppLauncherRefresh)},
Marc Treib4bd95e72018-08-30 06:30:58374 {"sync-support-secondary-account",
375 flag_descriptions::kSyncSupportSecondaryAccountName,
376 flag_descriptions::kSyncSupportSecondaryAccountDescription,
377 flags_ui::kOsIos,
378 FEATURE_VALUE_TYPE(switches::kSyncSupportSecondaryAccount)},
Javier Ernesto Flores Robles8e66f732018-09-12 15:41:15379 {"autofill-manual-fallback-phase-two",
380 flag_descriptions::kAutofillManualFallbackPhaseTwoName,
381 flag_descriptions::kAutofillManualFallbackPhaseTwoDescription,
382 flags_ui::kOsIos,
383 FEATURE_VALUE_TYPE(autofill::features::kAutofillManualFallbackPhaseTwo)},
Kurt Horimoto79d590b2018-09-12 19:09:28384 {"toolbar-container", flag_descriptions::kToolbarContainerName,
385 flag_descriptions::kToolbarContainerDescription, flags_ui::kOsIos,
386 FEATURE_VALUE_TYPE(toolbar_container::kToolbarContainerEnabled)},
[email protected]5b899dc2018-10-02 09:20:01387 {"omnibox-popup-shortcuts",
388 flag_descriptions::kOmniboxPopupShortcutIconsInZeroStateName,
389 flag_descriptions::kOmniboxPopupShortcutIconsInZeroStateDescription,
390 flags_ui::kOsIos,
391 FEATURE_VALUE_TYPE(omnibox::kOmniboxPopupShortcutIconsInZeroState)},
Valeriya Sinevicha79dc612018-09-25 14:49:09392 {"use-multilogin-endpoint", flag_descriptions::kUseMultiloginEndpointName,
393 flag_descriptions::kUseMultiloginEndpointDescription, flags_ui::kOsIos,
394 FEATURE_VALUE_TYPE(kUseMultiloginEndpoint)},
edchin18a3e602018-10-08 23:39:35395 {"closing-last-incognito-tab",
396 flag_descriptions::kClosingLastIncognitoTabName,
397 flag_descriptions::kClosingLastIncognitoTabDescription, flags_ui::kOsIos,
398 FEATURE_VALUE_TYPE(kClosingLastIncognitoTab)},
Gauthier Ambardce7fd582018-10-09 08:37:05399 {"omnibox-tab-switch-suggestions",
400 flag_descriptions::kOmniboxTabSwitchSuggestionsName,
401 flag_descriptions::kOmniboxTabSwitchSuggestionsDescription,
402 flags_ui::kOsIos,
403 FEATURE_VALUE_TYPE(omnibox::kOmniboxTabSwitchSuggestions)},
Stepan Khapugincc4e9842019-01-23 13:38:13404 {"omnibox-ui-max-autocomplete-matches",
405 flag_descriptions::kOmniboxUIMaxAutocompleteMatchesName,
406 flag_descriptions::kOmniboxUIMaxAutocompleteMatchesDescription,
407 flags_ui::kOsIos,
408 FEATURE_WITH_PARAMS_VALUE_TYPE(
409 omnibox::kUIExperimentMaxAutocompleteMatches,
410 kOmniboxUIMaxAutocompleteMatchesVariations,
411 "OmniboxUIMaxAutocompleteVariations")},
Tanja Gornakb0985dd2018-10-11 17:24:40412 {"fcm-invalidations", flag_descriptions::kFCMInvalidationsName,
413 flag_descriptions::kFCMInvalidationsDescription, flags_ui::kOsIos,
414 FEATURE_VALUE_TYPE(invalidation::switches::kFCMInvalidations)},
Justin Cohen9a5023212018-10-15 14:32:37415 {"browser-container-contains-ntp",
416 flag_descriptions::kBrowserContainerContainsNTPName,
417 flag_descriptions::kBrowserContainerContainsNTPDescription,
418 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kBrowserContainerContainsNTP)},
Gauthier Ambard2392f2a2018-10-24 16:33:27419 {"search-icon-toggle", flag_descriptions::kSearchIconToggleName,
420 flag_descriptions::kSearchIconToggleDescription, flags_ui::kOsIos,
421 FEATURE_WITH_PARAMS_VALUE_TYPE(kIconForSearchButtonFeature,
422 kIconForSearchButtonVariations,
423 "ToggleSearchButtonIcon")},
Olivier Robin2a898dc2018-10-31 14:37:04424 {"enable-breakpad-upload-no-delay",
425 flag_descriptions::kBreakpadNoDelayInitialUploadName,
426 flag_descriptions::kBreakpadNoDelayInitialUploadDescription,
427 flags_ui::kOsIos,
428 FEATURE_VALUE_TYPE(crash_report::kBreakpadNoDelayInitialUpload)},
Moe Ahmadie4cce1f2018-12-18 23:48:01429 {"enable-compact-translate-infobar",
430 flag_descriptions::kCompactTranslateInfobarName,
431 flag_descriptions::kCompactTranslateInfobarDescription, flags_ui::kOsIos,
432 FEATURE_VALUE_TYPE(translate::kCompactTranslateInfobarIOS)},
Kurt Horimoto9165404a2018-11-13 23:48:12433 {"non-modal-dialogs", flag_descriptions::kNonModalDialogsName,
434 flag_descriptions::kNonModalDialogsDescription, flags_ui::kOsIos,
435 FEATURE_VALUE_TYPE(dialogs::kNonModalDialogs)},
Mikel Astizdb43c5652018-11-22 16:52:05436 {"sync-pseudo-uss-favicons", flag_descriptions::kSyncPseudoUSSFaviconsName,
437 flag_descriptions::kSyncPseudoUSSFaviconsDescription, flags_ui::kOsIos,
438 FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSFavicons)},
439 {"sync-pseudo-uss-history-delete-directives",
440 flag_descriptions::kSyncPseudoUSSHistoryDeleteDirectivesName,
441 flag_descriptions::kSyncPseudoUSSHistoryDeleteDirectivesDescription,
442 flags_ui::kOsIos,
443 FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSHistoryDeleteDirectives)},
Mikel Astizdb43c5652018-11-22 16:52:05444 {"sync-pseudo-uss-preferences",
445 flag_descriptions::kSyncPseudoUSSPreferencesName,
446 flag_descriptions::kSyncPseudoUSSPreferencesDescription, flags_ui::kOsIos,
447 FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSPreferences)},
448 {"sync-pseudo-uss-priority-preferences",
449 flag_descriptions::kSyncPseudoUSSPriorityPreferencesName,
450 flag_descriptions::kSyncPseudoUSSPriorityPreferencesDescription,
451 flags_ui::kOsIos,
452 FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSPriorityPreferences)},
Jérôme Lebel5717fa852018-12-19 12:11:13453 {"use-nsurlsession-for-signin",
454 flag_descriptions::kUseNSURLSessionForGaiaSigninRequestsName,
455 flag_descriptions::kUseNSURLSessionForGaiaSigninRequestsDescription,
456 flags_ui::kOsIos,
457 FEATURE_VALUE_TYPE(kUseNSURLSessionForGaiaSigninRequests)},
Mikel Astizdb43c5652018-11-22 16:52:05458 {"sync-pseudo-uss-supervised-users",
459 flag_descriptions::kSyncPseudoUSSSupervisedUsersName,
460 flag_descriptions::kSyncPseudoUSSSupervisedUsersDescription,
461 flags_ui::kOsIos,
462 FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSSupervisedUsers)},
Olivier Robince9386ebd2018-11-29 09:07:38463 {"detect-main-thread-freeze",
464 flag_descriptions::kDetectMainThreadFreezeName,
465 flag_descriptions::kDetectMainThreadFreezeDescription, flags_ui::kOsIos,
466 FEATURE_WITH_PARAMS_VALUE_TYPE(crash_report::kDetectMainThreadFreeze,
467 kDetectMainThreadFreezeVariations,
468 "DetectMainThreadFreeze")},
Mohamed Amir Yosef9e8a1f02018-12-03 21:41:14469 {"enable-sync-uss-bookmarks",
470 flag_descriptions::kEnableSyncUSSBookmarksName,
471 flag_descriptions::kEnableSyncUSSBookmarksDescription, flags_ui::kOsIos,
472 FEATURE_VALUE_TYPE(switches::kSyncUSSBookmarks)},
sczs80a6f462018-12-05 20:37:18473 {"infobar-ui-reboot", flag_descriptions::kInfobarUIRebootName,
474 flag_descriptions::kInfobarUIRebootDescription, flags_ui::kOsIos,
475 FEATURE_VALUE_TYPE(kInfobarUIReboot)},
Chris Lu77905ac2018-12-06 20:46:51476 {"find-in-page-iframe", flag_descriptions::kFindInPageiFrameName,
477 flag_descriptions::kFindInPageiFrameDescription, flags_ui::kOsIos,
478 FEATURE_VALUE_TYPE(kFindInPageiFrame)},
Robbie Gibson80d732e2019-01-10 10:42:49479 {"enable-clipboard-provider-text-suggestions",
480 flag_descriptions::kEnableClipboardProviderTextSuggestionsName,
481 flag_descriptions::kEnableClipboardProviderTextSuggestionsDescription,
482 flags_ui::kOsIos,
483 FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProviderTextSuggestions)},
484 {"enable-clipboard-provider-image-suggestions",
485 flag_descriptions::kEnableClipboardProviderImageSuggestionsName,
486 flag_descriptions::kEnableClipboardProviderImageSuggestionsDescription,
487 flags_ui::kOsIos,
488 FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProviderImageSuggestions)},
489 {"copied-content-behavior", flag_descriptions::kCopiedContentBehaviorName,
490 flag_descriptions::kCopiedContentBehaviorName, flags_ui::kOsIos,
491 FEATURE_VALUE_TYPE(kCopiedContentBehavior)},
Vadym Doroshenkod178ff3f2019-01-02 14:59:23492 {"new-password-form-parsing-for-saving",
493 flag_descriptions::kNewPasswordFormParsingForSavingName,
494 flag_descriptions::kNewPasswordFormParsingForSavingDescription,
495 flags_ui::kOsIos,
496 FEATURE_VALUE_TYPE(
497 password_manager::features::kNewPasswordFormParsingForSaving)},
498 {"only-new-password-form-parsing",
499 flag_descriptions::kOnlyNewPasswordFormParsingName,
500 flag_descriptions::kOnlyNewPasswordFormParsingDescription,
501 flags_ui::kOsIos,
502 FEATURE_VALUE_TYPE(password_manager::features::kOnlyNewParser)},
edchin5ae0b4c2019-01-06 06:52:28503 {"snapshot-draw-view", flag_descriptions::kSnapshotDrawViewName,
504 flag_descriptions::kSnapshotDrawViewDescription, flags_ui::kOsIos,
505 FEATURE_VALUE_TYPE(kSnapshotDrawView)},
Sebastien Lalancette5daaf4a2019-01-11 22:09:25506 {"enable-autocomplete-data-retention-policy",
507 flag_descriptions::kEnableAutocompleteDataRetentionPolicyName,
508 flag_descriptions::kEnableAutocompleteDataRetentionPolicyDescription,
509 flags_ui::kOsIos,
510 FEATURE_VALUE_TYPE(
511 autofill::features::kAutocompleteRetentionPolicyEnabled)},
Justin Cohen20b6f072019-01-16 01:38:50512#if defined(DCHECK_IS_CONFIGURABLE)
513 {"dcheck-is-fatal", flag_descriptions::kDcheckIsFatalName,
514 flag_descriptions::kDcheckIsFatalDescription, flags_ui::kOsIos,
515 FEATURE_VALUE_TYPE(base::kDCheckIsFatalFeature)},
516#endif // defined(DCHECK_IS_CONFIGURABLE)
Gauthier Ambard5f610862019-01-17 11:43:55517 {"settings-refresh", flag_descriptions::kSettingsRefreshName,
518 flag_descriptions::kSettingsRefreshDescription, flags_ui::kOsIos,
519 FEATURE_VALUE_TYPE(kSettingsRefresh)},
Justin Cohencd633af2019-01-29 20:19:00520 {"browser-container-keeps-content-view",
521 flag_descriptions::kBrowserContainerKeepsContentViewName,
522 flag_descriptions::kBrowserContainerKeepsContentViewDescription,
523 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kBrowserContainerKeepsContentView)},
Gauthier Ambardef4442a2019-02-15 11:14:42524 {"web-clear-browsing-data", flag_descriptions::kWebClearBrowsingDataName,
525 flag_descriptions::kWebClearBrowsingDataDescription, flags_ui::kOsIos,
Gauthier Ambard33e03302019-02-21 13:28:58526 FEATURE_VALUE_TYPE(kWebClearBrowsingData)},
Gauthier Ambardce6f0bf2019-02-21 10:39:13527 {"web-ui-scheme-handling", flag_descriptions::kWebUISchemeHandlingName,
528 flag_descriptions::kWebUISchemeHandlingDescription, flags_ui::kOsIos,
529 FEATURE_VALUE_TYPE(web::features::kWebUISchemeHandling)},
Chris Lu8153e6e2019-03-26 16:28:21530 {"send-uma-cellular", flag_descriptions::kSendUmaOverAnyNetwork,
531 flag_descriptions::kSendUmaOverAnyNetworkDescription, flags_ui::kOsIos,
Chris Lu0683adf2019-02-26 15:56:45532 FEATURE_VALUE_TYPE(kUmaCellular)},
Mohamed Amir Yosef79feb7752019-03-04 09:49:37533 {"enable-sync-uss-passwords",
534 flag_descriptions::kEnableSyncUSSPasswordsName,
535 flag_descriptions::kEnableSyncUSSPasswordsDescription, flags_ui::kOsIos,
536 FEATURE_VALUE_TYPE(switches::kSyncUSSPasswords)},
Olivier Robin091319d2019-03-04 10:45:34537 {"offline-page-without-native-content",
538 flag_descriptions::kOfflineVersionWithoutNativeContentName,
539 flag_descriptions::kOfflineVersionWithoutNativeContentDescription,
540 flags_ui::kOsIos,
541 FEATURE_VALUE_TYPE(reading_list::kOfflineVersionWithoutNativeContent)},
Eugene Butc1aa2c22019-03-05 14:24:40542 {"store-pending-item-in-context",
543 flag_descriptions::kStorePendingItemInContextName,
544 flag_descriptions::kStorePendingItemInContextDescription, flags_ui::kOsIos,
545 FEATURE_VALUE_TYPE(web::features::kStorePendingItemInContext)},
Jared Saul8c224932019-03-12 15:01:18546 {"autofill-no-local-save-on-upload-success",
547 flag_descriptions::kAutofillNoLocalSaveOnUploadSuccessName,
548 flag_descriptions::kAutofillNoLocalSaveOnUploadSuccessDescription,
549 flags_ui::kOsIos,
550 FEATURE_VALUE_TYPE(
551 autofill::features::kAutofillNoLocalSaveOnUploadSuccess)},
Yi Su8b1172042019-03-19 10:16:56552 {"display-search-engine-favicon",
553 flag_descriptions::kDisplaySearchEngineFaviconName,
554 flag_descriptions::kDisplaySearchEngineFaviconDescription,
555 flags_ui::kOsIos, FEATURE_VALUE_TYPE(kDisplaySearchEngineFavicon)},
Jared Saul63f598a12019-03-22 23:40:26556 {"autofill-no-local-save-on-unmask-success",
557 flag_descriptions::kAutofillNoLocalSaveOnUnmaskSuccessName,
558 flag_descriptions::kAutofillNoLocalSaveOnUnmaskSuccessDescription,
559 flags_ui::kOsIos,
560 FEATURE_VALUE_TYPE(
561 autofill::features::kAutofillNoLocalSaveOnUnmaskSuccess)},
David Jean7d0bff12019-04-01 08:21:14562 {"password-generation-suggestion",
563 flag_descriptions::kPasswordGenerationName,
564 flag_descriptions::kPasswordGenerationDescription, flags_ui::kOsIos,
565 FEATURE_VALUE_TYPE(features::kPasswordGeneration)},
Stepan Khapugin13b7427a2019-04-02 13:17:54566 {"new-omnibox-popup-layout", flag_descriptions::kNewOmniboxPopupLayoutName,
567 flag_descriptions::kNewOmniboxPopupLayoutDescription, flags_ui::kOsIos,
568 FEATURE_VALUE_TYPE(kNewOmniboxPopupLayout)},
jdoerrieb37f22c2019-04-02 15:50:06569 {"fill-on-account-select-http",
570 flag_descriptions::kFillOnAccountSelectHttpName,
571 flag_descriptions::kFillOnAccountSelectHttpDescription, flags_ui::kOsIos,
572 FEATURE_VALUE_TYPE(password_manager::features::kFillOnAccountSelectHttp)},
Sébastien Séguin-Gagnondcb854b2019-04-10 16:36:44573 {"enable-send-tab-to-self", flag_descriptions::kSendTabToSelfName,
574 flag_descriptions::kSendTabToSelfDescription, flags_ui::kOsIos,
575 FEATURE_VALUE_TYPE(switches::kSyncSendTabToSelf)},
576 {"enable-send-tab-to-self-show-sending-ui",
577 flag_descriptions::kSendTabToSelfShowSendingUIName,
578 flag_descriptions::kSendTabToSelfShowSendingUIDescription,
579 flags_ui::kOsIos,
580 FEATURE_VALUE_TYPE(send_tab_to_self::kSendTabToSelfShowSendingUI)},
Moe Ahmadi32290192019-04-10 19:29:28581 {"translate-manual-trigger", flag_descriptions::kTranslateManualTriggerName,
582 flag_descriptions::kTranslateManualTriggerDescription, flags_ui::kOsIos,
583 FEATURE_VALUE_TYPE(translate::kTranslateMobileManualTrigger)},
Gauthier Ambardcfd85182018-01-05 10:37:46584};
sdefresne14900ee2015-11-27 14:43:21585
586// Add all switches from experimental flags to |command_line|.
587void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) {
588 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
589
sdefresne14900ee2015-11-27 14:43:21590 // Set the UA flag if UseMobileSafariUA is enabled.
591 if ([defaults boolForKey:@"UseMobileSafariUA"]) {
592 // Safari uses "Vesion/", followed by the OS version excluding bugfix, where
593 // Chrome puts its product token.
avi571943672015-12-22 02:12:49594 int32_t major = 0;
595 int32_t minor = 0;
596 int32_t bugfix = 0;
sdefresne14900ee2015-11-27 14:43:21597 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
598 std::string product = base::StringPrintf("Version/%d.%d", major, minor);
599
600 command_line->AppendSwitchASCII(switches::kUserAgent,
601 web::BuildUserAgentFromProduct(product));
602 }
603
604 // Freeform commandline flags. These are added last, so that any flags added
605 // earlier in this function take precedence.
606 if ([defaults boolForKey:@"EnableFreeformCommandLineFlags"]) {
607 base::CommandLine::StringVector flags;
608 // Append an empty "program" argument.
609 flags.push_back("");
610
611 // The number of flags corresponds to the number of text fields in
612 // Experimental.plist.
613 const int kNumFreeformFlags = 5;
614 for (int i = 1; i <= kNumFreeformFlags; ++i) {
615 NSString* key =
616 [NSString stringWithFormat:@"FreeformCommandLineFlag%d", i];
617 NSString* flag = [defaults stringForKey:key];
618 if ([flag length]) {
619 flags.push_back(base::SysNSStringToUTF8(flag));
620 }
621 }
622
623 base::CommandLine temp_command_line(flags);
624 command_line->AppendArguments(temp_command_line, false);
625 }
msardafc76f662017-02-24 12:46:28626
justincohendacc85d2017-06-28 23:34:10627 // Populate command line flag for 3rd party keyboard omnibox workaround.
628 NSString* enableThirdPartyKeyboardWorkaround =
629 [defaults stringForKey:@"EnableThirdPartyKeyboardWorkaround"];
630 if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Enabled"]) {
631 command_line->AppendSwitch(switches::kEnableThirdPartyKeyboardWorkaround);
632 } else if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Disabled"]) {
633 command_line->AppendSwitch(switches::kDisableThirdPartyKeyboardWorkaround);
634 }
635
msardafc76f662017-02-24 12:46:28636 ios::GetChromeBrowserProvider()->AppendSwitchesFromExperimentalSettings(
637 defaults, command_line);
sdefresne14900ee2015-11-27 14:43:21638}
639
640bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) {
641 return false;
642}
643
Sylvain Defresne8327a2f2019-01-17 14:19:18644flags_ui::FlagsState& GetGlobalFlagsState() {
645 static base::NoDestructor<flags_ui::FlagsState> flags_state(
646 kFeatureEntries, base::size(kFeatureEntries));
647 return *flags_state;
648}
sdefresne14900ee2015-11-27 14:43:21649} // namespace
650
651void ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage,
652 base::CommandLine* command_line) {
Gregory Chatzinoff31305112017-12-20 21:56:02653 AppendSwitchesFromExperimentalSettings(command_line);
Sylvain Defresne8327a2f2019-01-17 14:19:18654 GetGlobalFlagsState().ConvertFlagsToSwitches(
sdefresnec9763902015-12-02 10:30:11655 flags_storage, command_line, flags_ui::kAddSentinels,
Gregory Chatzinofff6523722017-11-21 01:33:53656 switches::kEnableFeatures, switches::kDisableFeatures);
sdefresne14900ee2015-11-27 14:43:21657}
658
jkrcalbf073372016-07-29 07:21:31659std::vector<std::string> RegisterAllFeatureVariationParameters(
660 flags_ui::FlagsStorage* flags_storage,
661 base::FeatureList* feature_list) {
Sylvain Defresne8327a2f2019-01-17 14:19:18662 return GetGlobalFlagsState().RegisterAllFeatureVariationParameters(
663 flags_storage, feature_list);
jkrcalbf073372016-07-29 07:21:31664}
665
sdefresne14900ee2015-11-27 14:43:21666void GetFlagFeatureEntries(flags_ui::FlagsStorage* flags_storage,
667 flags_ui::FlagAccess access,
668 base::ListValue* supported_entries,
669 base::ListValue* unsupported_entries) {
Sylvain Defresne8327a2f2019-01-17 14:19:18670 GetGlobalFlagsState().GetFlagFeatureEntries(
sdefresne14900ee2015-11-27 14:43:21671 flags_storage, access, supported_entries, unsupported_entries,
672 base::Bind(&SkipConditionalFeatureEntry));
673}
674
675void SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage,
676 const std::string& internal_name,
677 bool enable) {
Sylvain Defresne8327a2f2019-01-17 14:19:18678 GetGlobalFlagsState().SetFeatureEntryEnabled(flags_storage, internal_name,
679 enable);
sdefresne14900ee2015-11-27 14:43:21680}
681
682void ResetAllFlags(flags_ui::FlagsStorage* flags_storage) {
Sylvain Defresne8327a2f2019-01-17 14:19:18683 GetGlobalFlagsState().ResetAllFlags(flags_storage);
sdefresne14900ee2015-11-27 14:43:21684}
685
686namespace testing {
687
688const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) {
kokihoon189a4022018-10-13 02:43:44689 *count = base::size(kFeatureEntries);
sdefresne14900ee2015-11-27 14:43:21690 return kFeatureEntries;
691}
692
693} // namespace testing