sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 1 | // 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 | |
Nazerke | 9c25905 | 2019-06-26 15:30:10 | [diff] [blame] | 8 | #include "ios/chrome/browser/flags/about_flags.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 9 | |
Nazerke | 9c25905 | 2019-06-26 15:30:10 | [diff] [blame] | 10 | #import <UIKit/UIKit.h> |
avi | 57194367 | 2015-12-22 02:12:49 | [diff] [blame] | 11 | #include <stddef.h> |
| 12 | #include <stdint.h> |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 13 | |
Gregory Chatzinoff | f652372 | 2017-11-21 01:33:53 | [diff] [blame] | 14 | #include "base/base_switches.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 15 | #include "base/bind.h" |
Elly Fong-Jones | c3e9aea | 2019-10-24 19:44:19 | [diff] [blame] | 16 | #include "base/bind_helpers.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 17 | #include "base/command_line.h" |
| 18 | #include "base/logging.h" |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 19 | #include "base/no_destructor.h" |
kokihoon | 189a402 | 2018-10-13 02:43:44 | [diff] [blame] | 20 | #include "base/stl_util.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 21 | #include "base/strings/stringprintf.h" |
| 22 | #include "base/strings/sys_string_conversions.h" |
Sebastien Marchand | 75a7cdf | 2018-11-13 23:47:03 | [diff] [blame] | 23 | #include "base/system/sys_info.h" |
Mohamad Ahmadi | c4df81f | 2017-12-20 04:41:59 | [diff] [blame] | 24 | #include "components/autofill/core/common/autofill_features.h" |
Jared Saul | d998539f | 2019-03-19 15:11:17 | [diff] [blame] | 25 | #include "components/autofill/core/common/autofill_payments_features.h" |
Moe Ahmadi | d6d5d17 | 2018-06-20 17:20:23 | [diff] [blame] | 26 | #include "components/autofill/core/common/autofill_switches.h" |
Olivier Robin | 3d6041162 | 2018-02-23 10:03:22 | [diff] [blame] | 27 | #include "components/autofill/ios/browser/autofill_switches.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 28 | #include "components/dom_distiller/core/dom_distiller_switches.h" |
Tommy Nyquist | c1d6dea1 | 2017-07-26 20:37:23 | [diff] [blame] | 29 | #include "components/feature_engagement/public/feature_constants.h" |
| 30 | #include "components/feature_engagement/public/feature_list.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 31 | #include "components/flags_ui/feature_entry.h" |
| 32 | #include "components/flags_ui/feature_entry_macros.h" |
| 33 | #include "components/flags_ui/flags_storage.h" |
| 34 | #include "components/flags_ui/flags_ui_switches.h" |
sczs | 27e389e | 2020-01-15 15:19:18 | [diff] [blame] | 35 | #include "components/infobars/core/infobar_feature.h" |
Tanja Gornak | b0985dd | 2018-10-11 17:24:40 | [diff] [blame] | 36 | #include "components/invalidation/impl/invalidation_switches.h" |
noyau | 4cfb133 | 2016-10-25 17:05:42 | [diff] [blame] | 37 | #include "components/ntp_tiles/switches.h" |
Justin Donnelly | 33d712e | 2017-08-23 21:32:51 | [diff] [blame] | 38 | #include "components/omnibox/browser/omnibox_field_trial.h" |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 39 | #include "components/omnibox/common/omnibox_features.h" |
Ioana Pandele | d14ce9e | 2017-11-28 14:41:46 | [diff] [blame] | 40 | #include "components/password_manager/core/common/password_manager_features.h" |
mathp | 9b4c11d | 2017-07-06 20:24:13 | [diff] [blame] | 41 | #include "components/payments/core/features.h" |
Marc Treib | 5fc99e1f | 2017-11-08 12:19:18 | [diff] [blame] | 42 | #include "components/search_provider_logos/switches.h" |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 43 | #include "components/security_state/core/features.h" |
Sébastien Séguin-Gagnon | dcb854b | 2019-04-10 16:36:44 | [diff] [blame] | 44 | #include "components/send_tab_to_self/features.h" |
Valeriya Sinevich | a79dc61 | 2018-09-25 14:49:09 | [diff] [blame] | 45 | #include "components/signin/core/browser/account_reconcilor.h" |
Jérôme Lebel | c374fdd | 2019-09-27 10:36:48 | [diff] [blame] | 46 | #include "components/signin/ios/browser/features.h" |
Colin Blundell | 3517170e | 2019-07-11 08:16:34 | [diff] [blame] | 47 | #include "components/signin/public/base/signin_switches.h" |
sdefresne | 3657978 | 2016-02-05 11:08:25 | [diff] [blame] | 48 | #include "components/strings/grit/components_strings.h" |
Moe Ahmadi | d6d5d17 | 2018-06-20 17:20:23 | [diff] [blame] | 49 | #include "components/sync/driver/sync_driver_switches.h" |
Moe Ahmadi | e4cce1f | 2018-12-18 23:48:01 | [diff] [blame] | 50 | #include "components/translate/core/browser/translate_prefs.h" |
Chris Lu | 0683adf | 2019-02-26 15:56:45 | [diff] [blame] | 51 | #include "components/ukm/ios/features.h" |
Sylvain Defresne | ae6987e | 2018-03-01 13:21:40 | [diff] [blame] | 52 | #include "ios/chrome/browser/browsing_data/browsing_data_features.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 53 | #include "ios/chrome/browser/chrome_switches.h" |
Mike Dougherty | b6c770d | 2019-09-13 22:56:46 | [diff] [blame] | 54 | #include "ios/chrome/browser/crash_report/breadcrumbs/features.h" |
Olivier Robin | 2a898dc | 2018-10-31 14:37:04 | [diff] [blame] | 55 | #include "ios/chrome/browser/crash_report/crash_report_flags.h" |
Jean-François Geyelin | 30be591 | 2017-08-25 12:05:38 | [diff] [blame] | 56 | #include "ios/chrome/browser/drag_and_drop/drag_and_drop_flag.h" |
Chris Lu | 77905ac | 2018-12-06 20:46:51 | [diff] [blame] | 57 | #include "ios/chrome/browser/find_in_page/features.h" |
Nazerke | 21bdc45a | 2019-07-11 09:02:05 | [diff] [blame] | 58 | #include "ios/chrome/browser/flags/ios_chrome_flag_descriptions.h" |
David Jean | 7d0bff1 | 2019-04-01 08:21:14 | [diff] [blame] | 59 | #include "ios/chrome/browser/passwords/password_manager_features.h" |
Gauthier Ambard | 33e0330 | 2019-02-21 13:28:58 | [diff] [blame] | 60 | #include "ios/chrome/browser/system_flags.h" |
Kurt Horimoto | 9165404a | 2018-11-13 23:48:12 | [diff] [blame] | 61 | #import "ios/chrome/browser/ui/dialogs/dialog_features.h" |
Kurt Horimoto | 4da682b02 | 2018-04-12 07:43:35 | [diff] [blame] | 62 | #import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h" |
sczs | 80a6f46 | 2018-12-05 20:37:18 | [diff] [blame] | 63 | #import "ios/chrome/browser/ui/infobars/infobar_feature.h" |
Gauthier Ambard | f2247baa | 2020-01-06 19:16:34 | [diff] [blame] | 64 | #import "ios/chrome/browser/ui/page_info/features.h" |
Tanisha Mandre | 549612ea | 2019-07-17 11:36:15 | [diff] [blame] | 65 | #include "ios/chrome/browser/ui/settings/autofill/features.h" |
sczs | 76b9ba0 | 2019-07-23 23:34:30 | [diff] [blame] | 66 | #import "ios/chrome/browser/ui/table_view/feature_flags.h" |
Mark Cogan | 02ed6c77 | 2018-05-31 17:00:51 | [diff] [blame] | 67 | #import "ios/chrome/browser/ui/toolbar/public/features.h" |
Kurt Horimoto | 79d590b | 2018-09-12 19:09:28 | [diff] [blame] | 68 | #import "ios/chrome/browser/ui/toolbar_container/toolbar_container_features.h" |
Justin Cohen | 2d81c58 | 2018-01-22 14:46:44 | [diff] [blame] | 69 | #include "ios/chrome/browser/ui/ui_feature_flags.h" |
Yi Su | 392b303 | 2018-06-05 07:26:47 | [diff] [blame] | 70 | #include "ios/chrome/browser/web/features.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 71 | #include "ios/chrome/grit/ios_strings.h" |
msarda | fc76f66 | 2017-02-24 12:46:28 | [diff] [blame] | 72 | #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
Eugene But | 61818bc | 2019-04-15 21:04:07 | [diff] [blame] | 73 | #include "ios/web/common/features.h" |
Eugene But | e79f274 | 2019-07-26 17:07:22 | [diff] [blame] | 74 | #include "ios/web/common/user_agent.h" |
Eugene But | b141623 | 2019-07-22 17:31:58 | [diff] [blame] | 75 | #include "ios/web/common/web_view_creation_util.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 76 | |
| 77 | #if !defined(OFFICIAL_BUILD) |
| 78 | #include "components/variations/variations_switches.h" |
vitaliii | 489217aa | 2017-01-30 14:50:22 | [diff] [blame] | 79 | #endif |
stkhapugin | c1be179 | 2016-12-13 14:30:53 | [diff] [blame] | 80 | |
| 81 | #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 82 | #error "This file requires ARC support." |
| 83 | #endif |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 84 | |
elawrence | 816f6790e | 2017-06-16 18:19:28 | [diff] [blame] | 85 | using flags_ui::FeatureEntry; |
| 86 | |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 87 | namespace { |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 88 | |
| 89 | const FeatureEntry::FeatureParam kMarkHttpAsDangerous[] = { |
| 90 | {security_state::features::kMarkHttpAsFeatureParameterName, |
| 91 | security_state::features::kMarkHttpAsParameterDangerous}}; |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 92 | const FeatureEntry::FeatureParam kMarkHttpAsWarningAndDangerousOnFormEdits[] = { |
| 93 | {security_state::features::kMarkHttpAsFeatureParameterName, |
| 94 | security_state::features:: |
| 95 | kMarkHttpAsParameterWarningAndDangerousOnFormEdits}}; |
Livvie Lin | c8a9ed46 | 2019-10-29 01:06:50 | [diff] [blame] | 96 | const FeatureEntry::FeatureParam kMarkHttpAsDangerWarning[] = { |
| 97 | {security_state::features::kMarkHttpAsFeatureParameterName, |
| 98 | security_state::features::kMarkHttpAsParameterDangerWarning}}; |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 99 | |
| 100 | const FeatureEntry::FeatureVariation kMarkHttpAsFeatureVariations[] = { |
| 101 | {"(mark as actively dangerous)", kMarkHttpAsDangerous, |
kokihoon | 189a402 | 2018-10-13 02:43:44 | [diff] [blame] | 102 | base::size(kMarkHttpAsDangerous), nullptr}, |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 103 | {"(mark with a Not Secure warning and dangerous on form edits)", |
| 104 | kMarkHttpAsWarningAndDangerousOnFormEdits, |
Livvie Lin | c8a9ed46 | 2019-10-29 01:06:50 | [diff] [blame] | 105 | base::size(kMarkHttpAsWarningAndDangerousOnFormEdits), nullptr}, |
| 106 | {"(mark with a grey triangle icon)", kMarkHttpAsDangerWarning, |
| 107 | base::size(kMarkHttpAsDangerWarning), nullptr}}; |
elawrence | 816f6790e | 2017-06-16 18:19:28 | [diff] [blame] | 108 | |
Marc Treib | 5fc99e1f | 2017-11-08 12:19:18 | [diff] [blame] | 109 | const FeatureEntry::Choice kUseDdljsonApiChoices[] = { |
| 110 | {flags_ui::kGenericExperimentChoiceDefault, "", ""}, |
| 111 | {"(force test doodle 0)", search_provider_logos::switches::kGoogleDoodleUrl, |
| 112 | "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios0.json"}, |
| 113 | {"(force test doodle 1)", search_provider_logos::switches::kGoogleDoodleUrl, |
| 114 | "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios1.json"}, |
| 115 | {"(force test doodle 2)", search_provider_logos::switches::kGoogleDoodleUrl, |
| 116 | "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios2.json"}, |
| 117 | {"(force test doodle 3)", search_provider_logos::switches::kGoogleDoodleUrl, |
| 118 | "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios3.json"}, |
| 119 | {"(force test doodle 4)", search_provider_logos::switches::kGoogleDoodleUrl, |
| 120 | "https://www.gstatic.com/chrome/ntp/doodle_test/ddljson_ios4.json"}, |
| 121 | }; |
Marc Treib | 2752e8b | 2017-08-04 14:12:09 | [diff] [blame] | 122 | |
Olivier Robin | 3d6041162 | 2018-02-23 10:03:22 | [diff] [blame] | 123 | const FeatureEntry::Choice kAutofillIOSDelayBetweenFieldsChoices[] = { |
| 124 | {flags_ui::kGenericExperimentChoiceDefault, "", ""}, |
| 125 | {"0", autofill::switches::kAutofillIOSDelayBetweenFields, "0"}, |
| 126 | {"10", autofill::switches::kAutofillIOSDelayBetweenFields, "10"}, |
| 127 | {"20", autofill::switches::kAutofillIOSDelayBetweenFields, "20"}, |
| 128 | {"50", autofill::switches::kAutofillIOSDelayBetweenFields, "50"}, |
| 129 | {"100", autofill::switches::kAutofillIOSDelayBetweenFields, "100"}, |
| 130 | {"200", autofill::switches::kAutofillIOSDelayBetweenFields, "200"}, |
| 131 | {"500", autofill::switches::kAutofillIOSDelayBetweenFields, "500"}, |
| 132 | {"1000", autofill::switches::kAutofillIOSDelayBetweenFields, "1000"}, |
| 133 | }; |
| 134 | |
Ce Chen | 104a538 | 2019-12-10 01:09:05 | [diff] [blame] | 135 | const FeatureEntry::FeatureParam kOmniboxOnDeviceHeadSuggestAlwaysServe[] = { |
| 136 | {OmniboxFieldTrial::kOnDeviceHeadSuggestIncognitoServeMode, |
| 137 | "always-serve"}}; |
| 138 | const FeatureEntry::FeatureParam kOmniboxOnDeviceHeadSuggestIncognitoOnly[] = { |
| 139 | {OmniboxFieldTrial::kOnDeviceHeadSuggestIncognitoServeMode, |
| 140 | "incognito-only"}}; |
| 141 | const FeatureEntry::FeatureVariation |
| 142 | kOmniboxOnDeviceHeadSuggestIncognitoVariations[] = { |
| 143 | {"both-normal-and-incognito", kOmniboxOnDeviceHeadSuggestAlwaysServe, |
| 144 | base::size(kOmniboxOnDeviceHeadSuggestAlwaysServe), nullptr}, |
| 145 | {"incognito-only", kOmniboxOnDeviceHeadSuggestIncognitoOnly, |
| 146 | base::size(kOmniboxOnDeviceHeadSuggestIncognitoOnly), nullptr}}; |
| 147 | |
Stepan Khapugin | cc4e984 | 2019-01-23 13:38:13 | [diff] [blame] | 148 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches3[] = { |
| 149 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "3"}}; |
| 150 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches4[] = { |
| 151 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "4"}}; |
| 152 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches5[] = { |
| 153 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "5"}}; |
| 154 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches6[] = { |
| 155 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "6"}}; |
| 156 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches8[] = { |
| 157 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "8"}}; |
| 158 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches10[] = { |
| 159 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "10"}}; |
| 160 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches12[] = { |
| 161 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "12"}}; |
| 162 | |
| 163 | const FeatureEntry::FeatureVariation |
| 164 | kOmniboxUIMaxAutocompleteMatchesVariations[] = { |
| 165 | {"3 matches", kOmniboxUIMaxAutocompleteMatches3, |
| 166 | base::size(kOmniboxUIMaxAutocompleteMatches3), nullptr}, |
| 167 | {"4 matches", kOmniboxUIMaxAutocompleteMatches4, |
| 168 | base::size(kOmniboxUIMaxAutocompleteMatches4), nullptr}, |
| 169 | {"5 matches", kOmniboxUIMaxAutocompleteMatches5, |
| 170 | base::size(kOmniboxUIMaxAutocompleteMatches5), nullptr}, |
| 171 | {"6 matches", kOmniboxUIMaxAutocompleteMatches6, |
| 172 | base::size(kOmniboxUIMaxAutocompleteMatches6), nullptr}, |
| 173 | {"8 matches", kOmniboxUIMaxAutocompleteMatches8, |
| 174 | base::size(kOmniboxUIMaxAutocompleteMatches8), nullptr}, |
| 175 | {"10 matches", kOmniboxUIMaxAutocompleteMatches10, |
| 176 | base::size(kOmniboxUIMaxAutocompleteMatches10), nullptr}, |
| 177 | {"12 matches", kOmniboxUIMaxAutocompleteMatches12, |
| 178 | base::size(kOmniboxUIMaxAutocompleteMatches12), nullptr}}; |
| 179 | |
Gauthier Ambard | 2392f2a | 2018-10-24 16:33:27 | [diff] [blame] | 180 | const FeatureEntry::FeatureParam kIconForSearchButtonGrey[] = { |
| 181 | {kIconForSearchButtonFeatureParameterName, |
| 182 | kIconForSearchButtonParameterGrey}}; |
| 183 | const FeatureEntry::FeatureParam kIconForSearchButtonColorful[] = { |
| 184 | {kIconForSearchButtonFeatureParameterName, |
| 185 | kIconForSearchButtonParameterColorful}}; |
| 186 | const FeatureEntry::FeatureParam kIconForSearchButtonMagnifying[] = { |
| 187 | {kIconForSearchButtonFeatureParameterName, |
| 188 | kIconForSearchButtonParameterMagnifying}}; |
| 189 | |
| 190 | const FeatureEntry::FeatureVariation kIconForSearchButtonVariations[] = { |
| 191 | {"Grey search engine logo", kIconForSearchButtonGrey, |
| 192 | base::size(kIconForSearchButtonGrey), nullptr}, |
| 193 | {"Colorful search engine logo", kIconForSearchButtonColorful, |
| 194 | base::size(kIconForSearchButtonColorful), nullptr}, |
| 195 | {"Magnifying glass", kIconForSearchButtonMagnifying, |
| 196 | base::size(kIconForSearchButtonMagnifying), nullptr}}; |
| 197 | |
Olivier Robin | ce9386ebd | 2018-11-29 09:07:38 | [diff] [blame] | 198 | const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout3s[] = { |
| 199 | {crash_report::kDetectMainThreadFreezeParameterName, |
| 200 | crash_report::kDetectMainThreadFreezeParameter3s}}; |
| 201 | const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout5s[] = { |
| 202 | {crash_report::kDetectMainThreadFreezeParameterName, |
| 203 | crash_report::kDetectMainThreadFreezeParameter5s}}; |
| 204 | const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout7s[] = { |
| 205 | {crash_report::kDetectMainThreadFreezeParameterName, |
| 206 | crash_report::kDetectMainThreadFreezeParameter7s}}; |
| 207 | const FeatureEntry::FeatureParam kDetectMainThreadFreezeTimeout9s[] = { |
| 208 | {crash_report::kDetectMainThreadFreezeParameterName, |
| 209 | crash_report::kDetectMainThreadFreezeParameter9s}}; |
| 210 | |
| 211 | const FeatureEntry::FeatureVariation kDetectMainThreadFreezeVariations[] = { |
| 212 | {"3s", kDetectMainThreadFreezeTimeout3s, |
| 213 | base::size(kDetectMainThreadFreezeTimeout3s), nullptr}, |
| 214 | {"5s", kDetectMainThreadFreezeTimeout5s, |
| 215 | base::size(kDetectMainThreadFreezeTimeout5s), nullptr}, |
| 216 | {"7s", kDetectMainThreadFreezeTimeout7s, |
| 217 | base::size(kDetectMainThreadFreezeTimeout7s), nullptr}, |
| 218 | {"9s", kDetectMainThreadFreezeTimeout9s, |
| 219 | base::size(kDetectMainThreadFreezeTimeout9s), nullptr}}; |
| 220 | |
Caitlin Fischer | 37e0123 | 2019-05-24 13:05:45 | [diff] [blame] | 221 | const FeatureEntry::FeatureParam |
| 222 | kAutofillUseMobileLabelDisambiguationShowAll[] = { |
| 223 | {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName, |
| 224 | autofill::features:: |
| 225 | kAutofillUseMobileLabelDisambiguationParameterShowAll}}; |
| 226 | const FeatureEntry::FeatureParam |
| 227 | kAutofillUseMobileLabelDisambiguationShowOne[] = { |
| 228 | {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName, |
| 229 | autofill::features:: |
| 230 | kAutofillUseMobileLabelDisambiguationParameterShowOne}}; |
| 231 | |
| 232 | const FeatureEntry::FeatureVariation |
| 233 | kAutofillUseMobileLabelDisambiguationVariations[] = { |
| 234 | {"(show all)", kAutofillUseMobileLabelDisambiguationShowAll, |
| 235 | base::size(kAutofillUseMobileLabelDisambiguationShowAll), nullptr}, |
| 236 | {"(show one)", kAutofillUseMobileLabelDisambiguationShowOne, |
| 237 | base::size(kAutofillUseMobileLabelDisambiguationShowOne), nullptr}}; |
| 238 | |
Cooper Knaak | 1e02656 | 2017-07-26 05:22:28 | [diff] [blame] | 239 | // To add a new entry, add to the end of kFeatureEntries. There are four |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 240 | // distinct types of entries: |
Cooper Knaak | 1e02656 | 2017-07-26 05:22:28 | [diff] [blame] | 241 | // . ENABLE_DISABLE_VALUE: entry is either enabled, disabled, or uses the |
| 242 | // default value for this feature. Use the ENABLE_DISABLE_VALUE_TYPE |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 243 | // macro for this type supplying the command line to the macro. |
| 244 | // . MULTI_VALUE: a list of choices, the first of which should correspond to a |
| 245 | // deactivated state for this lab (i.e. no command line option). To specify |
| 246 | // this type of entry use the macro MULTI_VALUE_TYPE supplying it the |
| 247 | // array of choices. |
Cooper Knaak | 1e02656 | 2017-07-26 05:22:28 | [diff] [blame] | 248 | // . FEATURE_VALUE: entry is associated with a base::Feature instance. Entry is |
| 249 | // either enabled, disabled, or uses the default value of the associated |
| 250 | // base::Feature instance. To specify this type of entry use the macro |
| 251 | // FEATURE_VALUE_TYPE supplying it the base::Feature instance. |
| 252 | // . FEATURE_WITH_PARAM_VALUES: a list of choices associated with a |
| 253 | // base::Feature instance. Choices corresponding to the default state, a |
| 254 | // universally enabled state, and a universally disabled state are |
| 255 | // automatically included. To specify this type of entry use the macro |
| 256 | // FEATURE_WITH_PARAMS_VALUE_TYPE supplying it the base::Feature instance and |
| 257 | // the array of choices. |
| 258 | // |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 259 | // See the documentation of FeatureEntry for details on the fields. |
| 260 | // |
| 261 | // When adding a new choice, add it to the end of the list. |
| 262 | const flags_ui::FeatureEntry kFeatureEntries[] = { |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 263 | {"enable-mark-http-as", flag_descriptions::kMarkHttpAsName, |
elawrence | 816f6790e | 2017-06-16 18:19:28 | [diff] [blame] | 264 | flag_descriptions::kMarkHttpAsDescription, flags_ui::kOsIos, |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 265 | FEATURE_WITH_PARAMS_VALUE_TYPE( |
| 266 | security_state::features::kMarkHttpAsFeature, |
| 267 | kMarkHttpAsFeatureVariations, |
| 268 | "MarkHttpAs")}, |
Cooper Knaak | 1e02656 | 2017-07-26 05:22:28 | [diff] [blame] | 269 | {"in-product-help-demo-mode-choice", |
| 270 | flag_descriptions::kInProductHelpDemoModeName, |
| 271 | flag_descriptions::kInProductHelpDemoModeDescription, flags_ui::kOsIos, |
| 272 | FEATURE_WITH_PARAMS_VALUE_TYPE( |
Tommy Nyquist | c1d6dea1 | 2017-07-26 20:37:23 | [diff] [blame] | 273 | feature_engagement::kIPHDemoMode, |
| 274 | feature_engagement::kIPHDemoModeChoiceVariations, |
Marc Treib | 2752e8b | 2017-08-04 14:12:09 | [diff] [blame] | 275 | "IPH_DemoMode")}, |
| 276 | {"use-ddljson-api", flag_descriptions::kUseDdljsonApiName, |
| 277 | flag_descriptions::kUseDdljsonApiDescription, flags_ui::kOsIos, |
Marc Treib | 5fc99e1f | 2017-11-08 12:19:18 | [diff] [blame] | 278 | MULTI_VALUE_TYPE(kUseDdljsonApiChoices)}, |
Jean-François Geyelin | 30be591 | 2017-08-25 12:05:38 | [diff] [blame] | 279 | {"drag_and_drop", flag_descriptions::kDragAndDropName, |
| 280 | flag_descriptions::kDragAndDropDescription, flags_ui::kOsIos, |
Rohit Rao | 6a3a481d | 2017-09-25 19:31:41 | [diff] [blame] | 281 | FEATURE_VALUE_TYPE(kDragAndDrop)}, |
Eugene But | 468b6d5f0 | 2018-10-18 21:17:45 | [diff] [blame] | 282 | {"ignores-viewport-scale-limits", |
| 283 | flag_descriptions::kIgnoresViewportScaleLimitsName, |
| 284 | flag_descriptions::kIgnoresViewportScaleLimitsDescription, |
| 285 | flags_ui::kOsIos, |
| 286 | FEATURE_VALUE_TYPE(web::features::kIgnoresViewportScaleLimits)}, |
Moe Ahmadi | c3fd7cd | 2018-05-11 21:40:22 | [diff] [blame] | 287 | {"enable-autofill-credit-card-upload", |
| 288 | flag_descriptions::kAutofillCreditCardUploadName, |
| 289 | flag_descriptions::kAutofillCreditCardUploadDescription, flags_ui::kOsIos, |
Anne Lim | 579b573 | 2018-08-30 18:24:24 | [diff] [blame] | 290 | FEATURE_VALUE_TYPE(autofill::features::kAutofillUpstream)}, |
Himanshu Jaju | e760efb | 2019-10-17 11:07:53 | [diff] [blame] | 291 | {"enable-sync-device-info-in-transport-mode", |
| 292 | flag_descriptions::kSyncDeviceInfoInTransportModeName, |
| 293 | flag_descriptions::kSyncDeviceInfoInTransportModeDescription, |
| 294 | flags_ui::kOsIos, |
| 295 | FEATURE_VALUE_TYPE(switches::kSyncDeviceInfoInTransportMode)}, |
Moe Ahmadi | d6d5d17 | 2018-06-20 17:20:23 | [diff] [blame] | 296 | {"use-sync-sandbox", flag_descriptions::kSyncSandboxName, |
| 297 | flag_descriptions::kSyncSandboxDescription, flags_ui::kOsIos, |
| 298 | SINGLE_VALUE_TYPE_AND_VALUE( |
| 299 | switches::kSyncServiceURL, |
| 300 | "https://chrome-sync.sandbox.google.com/chrome-sync/alpha")}, |
| 301 | {"wallet-service-use-sandbox", |
| 302 | flag_descriptions::kWalletServiceUseSandboxName, |
| 303 | flag_descriptions::kWalletServiceUseSandboxDescription, flags_ui::kOsIos, |
| 304 | ENABLE_DISABLE_VALUE_TYPE_AND_VALUE( |
| 305 | autofill::switches::kWalletServiceUseSandbox, |
| 306 | "1", |
| 307 | autofill::switches::kWalletServiceUseSandbox, |
| 308 | "0")}, |
Mohamad Ahmadi | c4df81f | 2017-12-20 04:41:59 | [diff] [blame] | 309 | {"show-autofill-type-predictions", |
| 310 | flag_descriptions::kShowAutofillTypePredictionsName, |
| 311 | flag_descriptions::kShowAutofillTypePredictionsDescription, |
| 312 | flags_ui::kOsIos, |
Gauthier Ambard | cfd8518 | 2018-01-05 10:37:46 | [diff] [blame] | 313 | FEATURE_VALUE_TYPE(autofill::features::kAutofillShowTypePredictions)}, |
Olivier Robin | 3d6041162 | 2018-02-23 10:03:22 | [diff] [blame] | 314 | {"autofill-ios-delay-between-fields", |
| 315 | flag_descriptions::kAutofillIOSDelayBetweenFieldsName, |
| 316 | flag_descriptions::kAutofillIOSDelayBetweenFieldsDescription, |
| 317 | flags_ui::kOsIos, MULTI_VALUE_TYPE(kAutofillIOSDelayBetweenFieldsChoices)}, |
Olivier Robin | d81475b0 | 2018-06-20 21:30:11 | [diff] [blame] | 318 | {"autofill-show-all-profiles-on-prefilled-forms", |
| 319 | flag_descriptions::kAutofillShowAllSuggestionsOnPrefilledFormsName, |
| 320 | flag_descriptions::kAutofillShowAllSuggestionsOnPrefilledFormsDescription, |
| 321 | flags_ui::kOsIos, |
| 322 | FEATURE_VALUE_TYPE( |
| 323 | autofill::features::kAutofillShowAllSuggestionsOnPrefilledForms)}, |
Moe Ahmadi | d3ddfcb | 2018-04-20 19:51:08 | [diff] [blame] | 324 | {"autofill-restrict-formless-form-extraction", |
| 325 | flag_descriptions::kAutofillRestrictUnownedFieldsToFormlessCheckoutName, |
| 326 | flag_descriptions:: |
| 327 | kAutofillRestrictUnownedFieldsToFormlessCheckoutDescription, |
| 328 | flags_ui::kOsIos, |
| 329 | FEATURE_VALUE_TYPE( |
| 330 | autofill::features::kAutofillRestrictUnownedFieldsToFormlessCheckout)}, |
Roger McFarlane | e193ab12 | 2018-11-22 20:55:07 | [diff] [blame] | 331 | {"autofill-rich-metadata-queries", |
| 332 | flag_descriptions::kAutofillRichMetadataQueriesName, |
| 333 | flag_descriptions::kAutofillRichMetadataQueriesDescription, |
| 334 | flags_ui::kOsIos, |
| 335 | FEATURE_VALUE_TYPE(autofill::features::kAutofillRichMetadataQueries)}, |
Kurt Horimoto | dc33af3 | 2018-05-01 01:39:14 | [diff] [blame] | 336 | {"fullscreen-viewport-adjustment-experiment", |
Chris Lu | 481a932 | 2019-09-25 22:16:53 | [diff] [blame] | 337 | flag_descriptions::kFullscreenSmoothScrollingName, |
| 338 | flag_descriptions::kFullscreenSmoothScrollingDescription, flags_ui::kOsIos, |
| 339 | FEATURE_VALUE_TYPE(fullscreen::features::kSmoothScrollingDefault)}, |
Roger McFarlane | 1a37d7b | 2018-04-20 22:45:19 | [diff] [blame] | 340 | {"autofill-enforce-min-required-fields-for-heuristics", |
| 341 | flag_descriptions::kAutofillEnforceMinRequiredFieldsForHeuristicsName, |
| 342 | flag_descriptions:: |
| 343 | kAutofillEnforceMinRequiredFieldsForHeuristicsDescription, |
| 344 | flags_ui::kOsIos, |
| 345 | FEATURE_VALUE_TYPE( |
| 346 | autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics)}, |
| 347 | {"autofill-enforce-min-required-fields-for-query", |
| 348 | flag_descriptions::kAutofillEnforceMinRequiredFieldsForQueryName, |
| 349 | flag_descriptions::kAutofillEnforceMinRequiredFieldsForQueryDescription, |
| 350 | flags_ui::kOsIos, |
| 351 | FEATURE_VALUE_TYPE( |
| 352 | autofill::features::kAutofillEnforceMinRequiredFieldsForQuery)}, |
| 353 | {"autofill-enforce-min-required-fields-for-upload", |
| 354 | flag_descriptions::kAutofillEnforceMinRequiredFieldsForUploadName, |
| 355 | flag_descriptions::kAutofillEnforceMinRequiredFieldsForUploadDescription, |
| 356 | flags_ui::kOsIos, |
| 357 | FEATURE_VALUE_TYPE( |
| 358 | autofill::features::kAutofillEnforceMinRequiredFieldsForUpload)}, |
Roger McFarlane | 2eceba98 | 2018-05-18 01:37:11 | [diff] [blame] | 359 | {"autofill-cache-query-responses", |
| 360 | flag_descriptions::kAutofillCacheQueryResponsesName, |
| 361 | flag_descriptions::kAutofillCacheQueryResponsesDescription, |
| 362 | flags_ui::kOsIos, |
| 363 | FEATURE_VALUE_TYPE(autofill::features::kAutofillCacheQueryResponses)}, |
Jeffrey Cohen | 05cdafa39 | 2018-08-15 20:49:17 | [diff] [blame] | 364 | {"autofill-enable-company-name", |
| 365 | flag_descriptions::kAutofillEnableCompanyNameName, |
| 366 | flag_descriptions::kAutofillEnableCompanyNameDescription, flags_ui::kOsIos, |
| 367 | FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableCompanyName)}, |
Yi Su | 392b303 | 2018-06-05 07:26:47 | [diff] [blame] | 368 | {"webpage-text-accessibility", |
| 369 | flag_descriptions::kWebPageTextAccessibilityName, |
| 370 | flag_descriptions::kWebPageTextAccessibilityDescription, flags_ui::kOsIos, |
| 371 | FEATURE_VALUE_TYPE(web::kWebPageTextAccessibility)}, |
Kurt Horimoto | 79d590b | 2018-09-12 19:09:28 | [diff] [blame] | 372 | {"toolbar-container", flag_descriptions::kToolbarContainerName, |
| 373 | flag_descriptions::kToolbarContainerDescription, flags_ui::kOsIos, |
| 374 | FEATURE_VALUE_TYPE(toolbar_container::kToolbarContainerEnabled)}, |
Ce Chen | 20af01c | 2019-07-02 19:16:36 | [diff] [blame] | 375 | {"omnibox-on-device-head-suggestions", |
| 376 | flag_descriptions::kOmniboxOnDeviceHeadSuggestionsName, |
| 377 | flag_descriptions::kOmniboxOnDeviceHeadSuggestionsDescription, |
Ce Chen | 104a538 | 2019-12-10 01:09:05 | [diff] [blame] | 378 | flags_ui::kOsIos, |
| 379 | FEATURE_WITH_PARAMS_VALUE_TYPE( |
| 380 | omnibox::kOnDeviceHeadProvider, |
| 381 | kOmniboxOnDeviceHeadSuggestIncognitoVariations, |
| 382 | "OmniboxOnDeviceHeadSuggestIOS")}, |
Stepan Khapugin | cc4e984 | 2019-01-23 13:38:13 | [diff] [blame] | 383 | {"omnibox-ui-max-autocomplete-matches", |
| 384 | flag_descriptions::kOmniboxUIMaxAutocompleteMatchesName, |
| 385 | flag_descriptions::kOmniboxUIMaxAutocompleteMatchesDescription, |
| 386 | flags_ui::kOsIos, |
| 387 | FEATURE_WITH_PARAMS_VALUE_TYPE( |
| 388 | omnibox::kUIExperimentMaxAutocompleteMatches, |
| 389 | kOmniboxUIMaxAutocompleteMatchesVariations, |
| 390 | "OmniboxUIMaxAutocompleteVariations")}, |
Gauthier Ambard | 2392f2a | 2018-10-24 16:33:27 | [diff] [blame] | 391 | {"search-icon-toggle", flag_descriptions::kSearchIconToggleName, |
| 392 | flag_descriptions::kSearchIconToggleDescription, flags_ui::kOsIos, |
| 393 | FEATURE_WITH_PARAMS_VALUE_TYPE(kIconForSearchButtonFeature, |
| 394 | kIconForSearchButtonVariations, |
| 395 | "ToggleSearchButtonIcon")}, |
Olivier Robin | 2a898dc | 2018-10-31 14:37:04 | [diff] [blame] | 396 | {"enable-breakpad-upload-no-delay", |
| 397 | flag_descriptions::kBreakpadNoDelayInitialUploadName, |
| 398 | flag_descriptions::kBreakpadNoDelayInitialUploadDescription, |
| 399 | flags_ui::kOsIos, |
| 400 | FEATURE_VALUE_TYPE(crash_report::kBreakpadNoDelayInitialUpload)}, |
Kurt Horimoto | 9165404a | 2018-11-13 23:48:12 | [diff] [blame] | 401 | {"non-modal-dialogs", flag_descriptions::kNonModalDialogsName, |
| 402 | flag_descriptions::kNonModalDialogsDescription, flags_ui::kOsIos, |
| 403 | FEATURE_VALUE_TYPE(dialogs::kNonModalDialogs)}, |
Olivier Robin | ce9386ebd | 2018-11-29 09:07:38 | [diff] [blame] | 404 | {"detect-main-thread-freeze", |
| 405 | flag_descriptions::kDetectMainThreadFreezeName, |
| 406 | flag_descriptions::kDetectMainThreadFreezeDescription, flags_ui::kOsIos, |
| 407 | FEATURE_WITH_PARAMS_VALUE_TYPE(crash_report::kDetectMainThreadFreeze, |
| 408 | kDetectMainThreadFreezeVariations, |
| 409 | "DetectMainThreadFreeze")}, |
sczs | 80a6f46 | 2018-12-05 20:37:18 | [diff] [blame] | 410 | {"infobar-ui-reboot", flag_descriptions::kInfobarUIRebootName, |
| 411 | flag_descriptions::kInfobarUIRebootDescription, flags_ui::kOsIos, |
sczs | 27e389e | 2020-01-15 15:19:18 | [diff] [blame] | 412 | FEATURE_VALUE_TYPE(kIOSInfobarUIReboot)}, |
Chris Lu | 77905ac | 2018-12-06 20:46:51 | [diff] [blame] | 413 | {"find-in-page-iframe", flag_descriptions::kFindInPageiFrameName, |
| 414 | flag_descriptions::kFindInPageiFrameDescription, flags_ui::kOsIos, |
| 415 | FEATURE_VALUE_TYPE(kFindInPageiFrame)}, |
Robbie Gibson | 80d732e | 2019-01-10 10:42:49 | [diff] [blame] | 416 | {"enable-clipboard-provider-text-suggestions", |
| 417 | flag_descriptions::kEnableClipboardProviderTextSuggestionsName, |
| 418 | flag_descriptions::kEnableClipboardProviderTextSuggestionsDescription, |
| 419 | flags_ui::kOsIos, |
| 420 | FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProviderTextSuggestions)}, |
| 421 | {"enable-clipboard-provider-image-suggestions", |
| 422 | flag_descriptions::kEnableClipboardProviderImageSuggestionsName, |
| 423 | flag_descriptions::kEnableClipboardProviderImageSuggestionsDescription, |
| 424 | flags_ui::kOsIos, |
| 425 | FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProviderImageSuggestions)}, |
edchin | 5ae0b4c | 2019-01-06 06:52:28 | [diff] [blame] | 426 | {"snapshot-draw-view", flag_descriptions::kSnapshotDrawViewName, |
| 427 | flag_descriptions::kSnapshotDrawViewDescription, flags_ui::kOsIos, |
| 428 | FEATURE_VALUE_TYPE(kSnapshotDrawView)}, |
Justin Cohen | 20b6f07 | 2019-01-16 01:38:50 | [diff] [blame] | 429 | #if defined(DCHECK_IS_CONFIGURABLE) |
| 430 | {"dcheck-is-fatal", flag_descriptions::kDcheckIsFatalName, |
| 431 | flag_descriptions::kDcheckIsFatalDescription, flags_ui::kOsIos, |
| 432 | FEATURE_VALUE_TYPE(base::kDCheckIsFatalFeature)}, |
| 433 | #endif // defined(DCHECK_IS_CONFIGURABLE) |
Gauthier Ambard | 5f61086 | 2019-01-17 11:43:55 | [diff] [blame] | 434 | {"settings-refresh", flag_descriptions::kSettingsRefreshName, |
| 435 | flag_descriptions::kSettingsRefreshDescription, flags_ui::kOsIos, |
| 436 | FEATURE_VALUE_TYPE(kSettingsRefresh)}, |
Justin Cohen | cd633af | 2019-01-29 20:19:00 | [diff] [blame] | 437 | {"browser-container-keeps-content-view", |
| 438 | flag_descriptions::kBrowserContainerKeepsContentViewName, |
| 439 | flag_descriptions::kBrowserContainerKeepsContentViewDescription, |
| 440 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kBrowserContainerKeepsContentView)}, |
Gauthier Ambard | ef4442a | 2019-02-15 11:14:42 | [diff] [blame] | 441 | {"web-clear-browsing-data", flag_descriptions::kWebClearBrowsingDataName, |
| 442 | flag_descriptions::kWebClearBrowsingDataDescription, flags_ui::kOsIos, |
Gauthier Ambard | 33e0330 | 2019-02-21 13:28:58 | [diff] [blame] | 443 | FEATURE_VALUE_TYPE(kWebClearBrowsingData)}, |
Chris Lu | 8153e6e | 2019-03-26 16:28:21 | [diff] [blame] | 444 | {"send-uma-cellular", flag_descriptions::kSendUmaOverAnyNetwork, |
| 445 | flag_descriptions::kSendUmaOverAnyNetworkDescription, flags_ui::kOsIos, |
Chris Lu | 0683adf | 2019-02-26 15:56:45 | [diff] [blame] | 446 | FEATURE_VALUE_TYPE(kUmaCellular)}, |
Mohamed Amir Yosef | 79feb775 | 2019-03-04 09:49:37 | [diff] [blame] | 447 | {"enable-sync-uss-passwords", |
| 448 | flag_descriptions::kEnableSyncUSSPasswordsName, |
| 449 | flag_descriptions::kEnableSyncUSSPasswordsDescription, flags_ui::kOsIos, |
| 450 | FEATURE_VALUE_TYPE(switches::kSyncUSSPasswords)}, |
Jared Saul | 8c22493 | 2019-03-12 15:01:18 | [diff] [blame] | 451 | {"autofill-no-local-save-on-upload-success", |
| 452 | flag_descriptions::kAutofillNoLocalSaveOnUploadSuccessName, |
| 453 | flag_descriptions::kAutofillNoLocalSaveOnUploadSuccessDescription, |
| 454 | flags_ui::kOsIos, |
| 455 | FEATURE_VALUE_TYPE( |
| 456 | autofill::features::kAutofillNoLocalSaveOnUploadSuccess)}, |
Jared Saul | 63f598a1 | 2019-03-22 23:40:26 | [diff] [blame] | 457 | {"autofill-no-local-save-on-unmask-success", |
| 458 | flag_descriptions::kAutofillNoLocalSaveOnUnmaskSuccessName, |
| 459 | flag_descriptions::kAutofillNoLocalSaveOnUnmaskSuccessDescription, |
| 460 | flags_ui::kOsIos, |
| 461 | FEATURE_VALUE_TYPE( |
| 462 | autofill::features::kAutofillNoLocalSaveOnUnmaskSuccess)}, |
Stepan Khapugin | 13b7427a | 2019-04-02 13:17:54 | [diff] [blame] | 463 | {"new-omnibox-popup-layout", flag_descriptions::kNewOmniboxPopupLayoutName, |
| 464 | flag_descriptions::kNewOmniboxPopupLayoutDescription, flags_ui::kOsIos, |
| 465 | FEATURE_VALUE_TYPE(kNewOmniboxPopupLayout)}, |
Nazerke | 4179c0e | 2019-04-11 15:43:34 | [diff] [blame] | 466 | {"omnibox-use-default-search-engine-favicon", |
| 467 | flag_descriptions::kOmniboxUseDefaultSearchEngineFaviconName, |
| 468 | flag_descriptions::kOmniboxUseDefaultSearchEngineFaviconDescription, |
| 469 | flags_ui::kOsIos, |
| 470 | FEATURE_VALUE_TYPE(kOmniboxUseDefaultSearchEngineFavicon)}, |
Robbie Gibson | 5cf28c6a | 2019-11-22 18:26:37 | [diff] [blame] | 471 | {"omnibox-preserve-default-match-against-async-update", |
| 472 | flag_descriptions::kOmniboxPreserveDefaultMatchAgainstAsyncUpdateName, |
| 473 | flag_descriptions:: |
| 474 | kOmniboxPreserveDefaultMatchAgainstAsyncUpdateDescription, |
| 475 | flags_ui::kOsIos, |
| 476 | FEATURE_VALUE_TYPE( |
| 477 | omnibox::kOmniboxPreserveDefaultMatchAgainstAsyncUpdate)}, |
Sébastien Séguin-Gagnon | 3048192 | 2019-04-24 21:31:00 | [diff] [blame] | 478 | {"enable-send-tab-to-self-broadcast", |
| 479 | flag_descriptions::kSendTabToSelfBroadcastName, |
| 480 | flag_descriptions::kSendTabToSelfBroadcastDescription, flags_ui::kOsIos, |
| 481 | FEATURE_VALUE_TYPE(send_tab_to_self::kSendTabToSelfBroadcast)}, |
Caitlin Fischer | 43edd90a | 2019-05-01 13:24:30 | [diff] [blame] | 482 | {"autofill-use-mobile-label-disambiguation", |
| 483 | flag_descriptions::kAutofillUseMobileLabelDisambiguationName, |
| 484 | flag_descriptions::kAutofillUseMobileLabelDisambiguationDescription, |
| 485 | flags_ui::kOsIos, |
Caitlin Fischer | 37e0123 | 2019-05-24 13:05:45 | [diff] [blame] | 486 | FEATURE_WITH_PARAMS_VALUE_TYPE( |
| 487 | autofill::features::kAutofillUseMobileLabelDisambiguation, |
| 488 | kAutofillUseMobileLabelDisambiguationVariations, |
| 489 | "AutofillUseMobileLabelDisambiguation")}, |
Caitlin Fischer | 6d60954 | 2019-05-01 21:59:21 | [diff] [blame] | 490 | {"enable-autofill-prune-suggestions", |
| 491 | flag_descriptions::kAutofillPruneSuggestionsName, |
| 492 | flag_descriptions::kAutofillPruneSuggestionsDescription, flags_ui::kOsIos, |
| 493 | FEATURE_VALUE_TYPE(autofill::features::kAutofillPruneSuggestions)}, |
Gauthier Ambard | 4d42f39d | 2019-06-24 13:05:33 | [diff] [blame] | 494 | {"toolbar-new-tab-button", flag_descriptions::kToolbarNewTabButtonName, |
| 495 | flag_descriptions::kToolbarNewTabButtonDescription, flags_ui::kOsIos, |
| 496 | FEATURE_VALUE_TYPE(kToolbarNewTabButton)}, |
Maksim Moskvitin | 35b09c1bf | 2019-06-28 17:29:48 | [diff] [blame] | 497 | {"enable-sync-uss-nigori", flag_descriptions::kEnableSyncUSSNigoriName, |
| 498 | flag_descriptions::kEnableSyncUSSNigoriDescription, flags_ui::kOsIos, |
| 499 | FEATURE_VALUE_TYPE(switches::kSyncUSSNigori)}, |
sczs | 76b9ba0 | 2019-07-23 23:34:30 | [diff] [blame] | 500 | {"collections-card-presentation-style", |
| 501 | flag_descriptions::kCollectionsCardPresentationStyleName, |
| 502 | flag_descriptions::kCollectionsCardPresentationStyleDescription, |
| 503 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kCollectionsCardPresentationStyle)}, |
Jared Saul | 3f520c6 | 2019-09-03 23:58:12 | [diff] [blame] | 504 | {"enable-autofill-credit-card-upload-editable-cardholder-name", |
| 505 | flag_descriptions:: |
| 506 | kEnableAutofillCreditCardUploadEditableCardholderNameName, |
| 507 | flag_descriptions:: |
| 508 | kEnableAutofillCreditCardUploadEditableCardholderNameDescription, |
| 509 | flags_ui::kOsIos, |
| 510 | FEATURE_VALUE_TYPE( |
| 511 | autofill::features::kAutofillUpstreamEditableCardholderName)}, |
| 512 | {"enable-autofill-credit-card-upload-editable-expiration-date", |
| 513 | flag_descriptions:: |
| 514 | kEnableAutofillCreditCardUploadEditableExpirationDateName, |
| 515 | flag_descriptions:: |
| 516 | kEnableAutofillCreditCardUploadEditableExpirationDateDescription, |
| 517 | flags_ui::kOsIos, |
| 518 | FEATURE_VALUE_TYPE( |
| 519 | autofill::features::kAutofillUpstreamEditableExpirationDate)}, |
Tanisha Mandre | 3a14d38 | 2019-09-05 17:33:44 | [diff] [blame] | 520 | {"credit-card-scanner", flag_descriptions::kCreditCardScannerName, |
| 521 | flag_descriptions::kCreditCardScannerDescription, flags_ui::kOsIos, |
| 522 | FEATURE_VALUE_TYPE(kCreditCardScanner)}, |
Mike Dougherty | b6c770d | 2019-09-13 22:56:46 | [diff] [blame] | 523 | {"ios-breadcrumbs", flag_descriptions::kLogBreadcrumbsName, |
| 524 | flag_descriptions::kLogBreadcrumbsDescription, flags_ui::kOsIos, |
| 525 | FEATURE_VALUE_TYPE(kLogBreadcrumbs)}, |
Ioana Pandele | 0a74f42 | 2019-09-25 12:27:45 | [diff] [blame] | 526 | {"password-leak-detection", flag_descriptions::kPasswordLeakDetectionName, |
| 527 | flag_descriptions::kPasswordLeakDetectionDescription, flags_ui::kOsIos, |
| 528 | FEATURE_VALUE_TYPE(password_manager::features::kLeakDetection)}, |
Jérôme Lebel | c374fdd | 2019-09-27 10:36:48 | [diff] [blame] | 529 | {"force-startup-signin-promo", |
| 530 | flag_descriptions::kForceStartupSigninPromoName, |
| 531 | flag_descriptions::kForceStartupSigninPromoDescription, flags_ui::kOsIos, |
| 532 | FEATURE_VALUE_TYPE(signin::kForceStartupSigninPromo)}, |
Justin Cohen | c57413a | 2019-09-30 19:42:29 | [diff] [blame] | 533 | {"embedder-block-restore-url", |
| 534 | flag_descriptions::kEmbedderBlockRestoreUrlName, |
| 535 | flag_descriptions::kEmbedderBlockRestoreUrlDescription, flags_ui::kOsIos, |
| 536 | FEATURE_VALUE_TYPE(kEmbedderBlockRestoreUrl)}, |
sczs | 6c3202e | 2019-10-01 00:22:46 | [diff] [blame] | 537 | {"messages-confirm-infobars", |
| 538 | flag_descriptions::kConfirmInfobarMessagesUIName, |
| 539 | flag_descriptions::kConfirmInfobarMessagesUIDescription, flags_ui::kOsIos, |
| 540 | FEATURE_VALUE_TYPE(kConfirmInfobarMessagesUI)}, |
David Jean | a9bf62b | 2019-10-04 11:53:36 | [diff] [blame] | 541 | {"disable-animation-on-low-battery", |
| 542 | flag_descriptions::kDisableAnimationOnLowBatteryName, |
| 543 | flag_descriptions::kDisableAnimationOnLowBatteryDescription, |
| 544 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kDisableAnimationOnLowBattery)}, |
sczs | 004fa6c | 2019-10-18 17:22:52 | [diff] [blame] | 545 | {"messages-save-card-infobar", |
| 546 | flag_descriptions::kSaveCardInfobarMessagesUIName, |
| 547 | flag_descriptions::kSaveCardInfobarMessagesUIDescription, flags_ui::kOsIos, |
| 548 | FEATURE_VALUE_TYPE(kSaveCardInfobarMessagesUI)}, |
Chris Lu | 4cc111b45 | 2019-10-18 22:18:48 | [diff] [blame] | 549 | {"messages-translate-infobar", |
| 550 | flag_descriptions::kTranslateInfobarMessagesUIName, |
| 551 | flag_descriptions::kTranslateInfobarMessagesUIDescription, |
| 552 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kTranslateInfobarMessagesUI)}, |
Yi Su | ed66a31 | 2019-10-24 13:36:08 | [diff] [blame] | 553 | {"use-WKWebView-loading", flag_descriptions::kUseWKWebViewLoadingName, |
| 554 | flag_descriptions::kUseWKWebViewLoadingDescription, flags_ui::kOsIos, |
| 555 | FEATURE_VALUE_TYPE(web::features::kUseWKWebViewLoading)}, |
sczs | 4622e6e | 2019-11-06 01:17:59 | [diff] [blame] | 556 | {"autofill-save-card-dismiss-on-navigation", |
| 557 | flag_descriptions::kAutofillSaveCardDismissOnNavigationName, |
| 558 | flag_descriptions::kAutofillSaveCardDismissOnNavigationDescription, |
| 559 | flags_ui::kOsIos, |
| 560 | FEATURE_VALUE_TYPE( |
| 561 | autofill::features::kAutofillSaveCardDismissOnNavigation)}, |
Ewann | 6674c13 | 2019-11-06 11:20:41 | [diff] [blame] | 562 | {"enable-persistent-downloads", |
| 563 | flag_descriptions::kEnablePersistentDownloadsName, |
| 564 | flag_descriptions::kEnablePersistentDownloadsDescription, flags_ui::kOsIos, |
| 565 | FEATURE_VALUE_TYPE(web::features::kEnablePersistentDownloads)}, |
Rohit Rao | e7b48931 | 2019-11-12 12:28:55 | [diff] [blame] | 566 | {"force-unstacked-tabstrip", flag_descriptions::kForceUnstackedTabstripName, |
| 567 | flag_descriptions::kForceUnstackedTabstripDescription, flags_ui::kOsIos, |
| 568 | FEATURE_VALUE_TYPE(kForceUnstackedTabstrip)}, |
Gauthier Ambard | 9391400 | 2019-11-14 12:56:12 | [diff] [blame] | 569 | {"use-js-error-page", flag_descriptions::kUseJSForErrorPageName, |
| 570 | flag_descriptions::kUseJSForErrorPageDescription, flags_ui::kOsIos, |
| 571 | FEATURE_VALUE_TYPE(web::features::kUseJSForErrorPage)}, |
Javier Ernesto Flores Robles | 73cf70ab | 2019-11-15 14:34:07 | [diff] [blame] | 572 | {"messages-download-infobar", |
| 573 | flag_descriptions::kDownloadInfobarMessagesUIName, |
| 574 | flag_descriptions::kDownloadInfobarMessagesUIDescription, flags_ui::kOsIos, |
| 575 | FEATURE_VALUE_TYPE(kDownloadInfobarMessagesUI)}, |
Gauthier Ambard | bde9def | 2019-11-19 18:04:33 | [diff] [blame] | 576 | {"desktop-version-default", flag_descriptions::kDefaultToDesktopOnIPadName, |
| 577 | flag_descriptions::kDefaultToDesktopOnIPadDescription, flags_ui::kOsIos, |
Gauthier Ambard | 054175f | 2019-12-16 11:54:09 | [diff] [blame] | 578 | FEATURE_VALUE_TYPE(web::features::kUseDefaultUserAgentInWebClient)}, |
Gauthier Ambard | bde9def | 2019-11-19 18:04:33 | [diff] [blame] | 579 | {"mobile-google-srp", flag_descriptions::kMobileGoogleSRPName, |
| 580 | flag_descriptions::kMobileGoogleSRPDescription, flags_ui::kOsIos, |
| 581 | FEATURE_VALUE_TYPE(web::kMobileGoogleSRP)}, |
sczs | 3bede828 | 2019-11-27 14:16:54 | [diff] [blame] | 582 | {"messages-crash-restore-infobars", |
| 583 | flag_descriptions::kCrashRestoreInfobarMessagesUIName, |
| 584 | flag_descriptions::kCrashRestoreInfobarMessagesUIDescription, |
| 585 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kCrashRestoreInfobarMessagesUI)}, |
Kurt Horimoto | d754e8ec | 2019-12-03 20:54:02 | [diff] [blame] | 586 | {"infobar-overlay-ui", flag_descriptions::kInfobarOverlayUIName, |
| 587 | flag_descriptions::kInfobarOverlayUIDescription, flags_ui::kOsIos, |
| 588 | FEATURE_VALUE_TYPE(kInfobarOverlayUI)}, |
sczs | 391ebba | 2019-12-05 06:59:30 | [diff] [blame] | 589 | {"autofill-save-card-infobar-edit-support", |
| 590 | flag_descriptions::kAutofillSaveCardInfobarEditSupportName, |
| 591 | flag_descriptions::kAutofillSaveCardInfobarEditSupportDescription, |
| 592 | flags_ui::kOsIos, |
| 593 | FEATURE_VALUE_TYPE( |
| 594 | autofill::features::kAutofillSaveCardInfobarEditSupport)}, |
Gauthier Ambard | cd302c4 | 2019-12-11 09:56:50 | [diff] [blame] | 595 | {"reload-sad-tab", flag_descriptions::kReloadSadTabName, |
| 596 | flag_descriptions::kReloadSadTabDescription, flags_ui::kOsIos, |
| 597 | FEATURE_VALUE_TYPE(web::kReloadSadTab)}, |
Gauthier Ambard | f2247baa | 2020-01-06 19:16:34 | [diff] [blame] | 598 | {"page-info-refactoring", flag_descriptions::kPageInfoRefactoringName, |
| 599 | flag_descriptions::kPageInfoRefactoringDescription, flags_ui::kOsIos, |
Gauthier Ambard | e813c07f | 2020-01-09 10:18:49 | [diff] [blame] | 600 | FEATURE_VALUE_TYPE(kPageInfoRefactoring)}, |
| 601 | {"contained-browser-bvc", flag_descriptions::kContainedBVCName, |
| 602 | flag_descriptions::kContainedBVCDescription, flags_ui::kOsIos, |
| 603 | FEATURE_VALUE_TYPE(kContainedBVC)}, |
Nohemi Fernandez | 6b6260a | 2020-01-17 16:53:45 | [diff] [blame^] | 604 | {"clear-synced-data", flag_descriptions::kClearSyncedDataName, |
| 605 | flag_descriptions::kClearSyncedDataDescription, flags_ui::kOsIos, |
| 606 | FEATURE_VALUE_TYPE(kClearSyncedData)}, |
Gauthier Ambard | e813c07f | 2020-01-09 10:18:49 | [diff] [blame] | 607 | }; |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 608 | |
| 609 | // Add all switches from experimental flags to |command_line|. |
| 610 | void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { |
| 611 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
| 612 | |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 613 | // Set the UA flag if UseMobileSafariUA is enabled. |
| 614 | if ([defaults boolForKey:@"UseMobileSafariUA"]) { |
| 615 | // Safari uses "Vesion/", followed by the OS version excluding bugfix, where |
| 616 | // Chrome puts its product token. |
avi | 57194367 | 2015-12-22 02:12:49 | [diff] [blame] | 617 | int32_t major = 0; |
| 618 | int32_t minor = 0; |
| 619 | int32_t bugfix = 0; |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 620 | base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); |
| 621 | std::string product = base::StringPrintf("Version/%d.%d", major, minor); |
| 622 | |
Gauthier Ambard | 2294548 | 2019-11-29 14:02:21 | [diff] [blame] | 623 | command_line->AppendSwitchASCII( |
| 624 | switches::kUserAgent, |
| 625 | web::BuildUserAgentFromProduct(web::UserAgentType::MOBILE, product)); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 626 | } |
| 627 | |
| 628 | // Freeform commandline flags. These are added last, so that any flags added |
| 629 | // earlier in this function take precedence. |
| 630 | if ([defaults boolForKey:@"EnableFreeformCommandLineFlags"]) { |
| 631 | base::CommandLine::StringVector flags; |
| 632 | // Append an empty "program" argument. |
| 633 | flags.push_back(""); |
| 634 | |
| 635 | // The number of flags corresponds to the number of text fields in |
| 636 | // Experimental.plist. |
| 637 | const int kNumFreeformFlags = 5; |
| 638 | for (int i = 1; i <= kNumFreeformFlags; ++i) { |
| 639 | NSString* key = |
| 640 | [NSString stringWithFormat:@"FreeformCommandLineFlag%d", i]; |
| 641 | NSString* flag = [defaults stringForKey:key]; |
| 642 | if ([flag length]) { |
Robbie Gibson | c91ce62 | 2019-05-20 14:44:33 | [diff] [blame] | 643 | // iOS keyboard replaces -- with —, so undo that. |
| 644 | flag = [flag stringByReplacingOccurrencesOfString:@"—" |
| 645 | withString:@"--" |
| 646 | options:0 |
| 647 | range:NSMakeRange(0, 1)]; |
| 648 | // To make things easier, allow flags with no dashes by prepending them |
| 649 | // here. This also allows for flags that just have one dash if they |
| 650 | // exist. |
| 651 | if (![flag hasPrefix:@"-"]) { |
| 652 | flag = [@"--" stringByAppendingString:flag]; |
| 653 | } |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 654 | flags.push_back(base::SysNSStringToUTF8(flag)); |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | base::CommandLine temp_command_line(flags); |
| 659 | command_line->AppendArguments(temp_command_line, false); |
| 660 | } |
msarda | fc76f66 | 2017-02-24 12:46:28 | [diff] [blame] | 661 | |
justincohen | dacc85d | 2017-06-28 23:34:10 | [diff] [blame] | 662 | // Populate command line flag for 3rd party keyboard omnibox workaround. |
| 663 | NSString* enableThirdPartyKeyboardWorkaround = |
| 664 | [defaults stringForKey:@"EnableThirdPartyKeyboardWorkaround"]; |
| 665 | if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Enabled"]) { |
| 666 | command_line->AppendSwitch(switches::kEnableThirdPartyKeyboardWorkaround); |
| 667 | } else if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Disabled"]) { |
| 668 | command_line->AppendSwitch(switches::kDisableThirdPartyKeyboardWorkaround); |
| 669 | } |
| 670 | |
msarda | fc76f66 | 2017-02-24 12:46:28 | [diff] [blame] | 671 | ios::GetChromeBrowserProvider()->AppendSwitchesFromExperimentalSettings( |
| 672 | defaults, command_line); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 673 | } |
| 674 | |
| 675 | bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) { |
| 676 | return false; |
| 677 | } |
| 678 | |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 679 | flags_ui::FlagsState& GetGlobalFlagsState() { |
Elly Fong-Jones | 3cd7528 | 2019-11-12 20:26:50 | [diff] [blame] | 680 | static base::NoDestructor<flags_ui::FlagsState> flags_state(kFeatureEntries, |
| 681 | nullptr); |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 682 | return *flags_state; |
| 683 | } |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 684 | } // namespace |
| 685 | |
| 686 | void ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage, |
| 687 | base::CommandLine* command_line) { |
Gregory Chatzinoff | 3130511 | 2017-12-20 21:56:02 | [diff] [blame] | 688 | AppendSwitchesFromExperimentalSettings(command_line); |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 689 | GetGlobalFlagsState().ConvertFlagsToSwitches( |
sdefresne | c976390 | 2015-12-02 10:30:11 | [diff] [blame] | 690 | flags_storage, command_line, flags_ui::kAddSentinels, |
Gregory Chatzinoff | f652372 | 2017-11-21 01:33:53 | [diff] [blame] | 691 | switches::kEnableFeatures, switches::kDisableFeatures); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 692 | } |
| 693 | |
jkrcal | bf07337 | 2016-07-29 07:21:31 | [diff] [blame] | 694 | std::vector<std::string> RegisterAllFeatureVariationParameters( |
| 695 | flags_ui::FlagsStorage* flags_storage, |
| 696 | base::FeatureList* feature_list) { |
Justin Cohen | 2e2adb5 | 2019-10-25 17:00:02 | [diff] [blame] | 697 | // Occasionally DCHECK crashes on canary can be very distuptive. An |
| 698 | // experimental flag was added to aid in temporarily disabling this for |
| 699 | // canary testers. |
| 700 | #if defined(DCHECK_IS_CONFIGURABLE) |
| 701 | if (experimental_flags::AreDCHECKCrashesDisabled()) { |
| 702 | std::vector<base::FeatureList::FeatureOverrideInfo> overrides; |
| 703 | overrides.push_back( |
| 704 | {std::cref(base::kDCheckIsFatalFeature), |
| 705 | base::FeatureList::OverrideState::OVERRIDE_DISABLE_FEATURE}); |
| 706 | feature_list->RegisterExtraFeatureOverrides(std::move(overrides)); |
| 707 | } |
| 708 | #endif // defined(DCHECK_IS_CONFIGURABLE) |
| 709 | |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 710 | return GetGlobalFlagsState().RegisterAllFeatureVariationParameters( |
| 711 | flags_storage, feature_list); |
jkrcal | bf07337 | 2016-07-29 07:21:31 | [diff] [blame] | 712 | } |
| 713 | |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 714 | void GetFlagFeatureEntries(flags_ui::FlagsStorage* flags_storage, |
| 715 | flags_ui::FlagAccess access, |
| 716 | base::ListValue* supported_entries, |
| 717 | base::ListValue* unsupported_entries) { |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 718 | GetGlobalFlagsState().GetFlagFeatureEntries( |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 719 | flags_storage, access, supported_entries, unsupported_entries, |
| 720 | base::Bind(&SkipConditionalFeatureEntry)); |
| 721 | } |
| 722 | |
| 723 | void SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage, |
| 724 | const std::string& internal_name, |
| 725 | bool enable) { |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 726 | GetGlobalFlagsState().SetFeatureEntryEnabled(flags_storage, internal_name, |
| 727 | enable); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 728 | } |
| 729 | |
| 730 | void ResetAllFlags(flags_ui::FlagsStorage* flags_storage) { |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 731 | GetGlobalFlagsState().ResetAllFlags(flags_storage); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 732 | } |
| 733 | |
| 734 | namespace testing { |
| 735 | |
| 736 | const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { |
kokihoon | 189a402 | 2018-10-13 02:43:44 | [diff] [blame] | 737 | *count = base::size(kFeatureEntries); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 738 | return kFeatureEntries; |
| 739 | } |
| 740 | |
| 741 | } // namespace testing |