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" |
Hans Wennborg | 3a2fb61f | 2020-05-11 15:51:16 | [diff] [blame] | 17 | #include "base/check_op.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 18 | #include "base/command_line.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" |
Robbie Gibson | 5e343663 | 2020-04-27 15:48:04 | [diff] [blame] | 28 | #include "components/content_settings/core/common/features.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 29 | #include "components/dom_distiller/core/dom_distiller_switches.h" |
Tommy Nyquist | c1d6dea1 | 2017-07-26 20:37:23 | [diff] [blame] | 30 | #include "components/feature_engagement/public/feature_constants.h" |
| 31 | #include "components/feature_engagement/public/feature_list.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 32 | #include "components/flags_ui/feature_entry.h" |
| 33 | #include "components/flags_ui/feature_entry_macros.h" |
| 34 | #include "components/flags_ui/flags_storage.h" |
| 35 | #include "components/flags_ui/flags_ui_switches.h" |
sczs | 27e389e | 2020-01-15 15:19:18 | [diff] [blame] | 36 | #include "components/infobars/core/infobar_feature.h" |
Tanja Gornak | b0985dd | 2018-10-11 17:24:40 | [diff] [blame] | 37 | #include "components/invalidation/impl/invalidation_switches.h" |
noyau | 4cfb133 | 2016-10-25 17:05:42 | [diff] [blame] | 38 | #include "components/ntp_tiles/switches.h" |
Justin Donnelly | 33d712e | 2017-08-23 21:32:51 | [diff] [blame] | 39 | #include "components/omnibox/browser/omnibox_field_trial.h" |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 40 | #include "components/omnibox/common/omnibox_features.h" |
Ioana Pandele | d14ce9e | 2017-11-28 14:41:46 | [diff] [blame] | 41 | #include "components/password_manager/core/common/password_manager_features.h" |
mathp | 9b4c11d | 2017-07-06 20:24:13 | [diff] [blame] | 42 | #include "components/payments/core/features.h" |
Guillaume Jenkins | eeb7007c | 2020-06-25 22:55:40 | [diff] [blame] | 43 | #import "components/policy/core/common/policy_loader_ios_constants.h" |
| 44 | #include "components/policy/policy_constants.h" |
Ali Juma | 01ca4ff | 2020-03-19 15:53:11 | [diff] [blame] | 45 | #include "components/safe_browsing/core/features.h" |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 46 | #include "components/security_state/core/features.h" |
Sébastien Séguin-Gagnon | dcb854b | 2019-04-10 16:36:44 | [diff] [blame] | 47 | #include "components/send_tab_to_self/features.h" |
Valeriya Sinevich | a79dc61 | 2018-09-25 14:49:09 | [diff] [blame] | 48 | #include "components/signin/core/browser/account_reconcilor.h" |
Jérôme Lebel | c374fdd | 2019-09-27 10:36:48 | [diff] [blame] | 49 | #include "components/signin/ios/browser/features.h" |
Nohemi Fernandez | 983d6d5 | 2020-09-09 09:46:19 | [diff] [blame] | 50 | #include "components/signin/public/base/account_consistency_method.h" |
Colin Blundell | 3517170e | 2019-07-11 08:16:34 | [diff] [blame] | 51 | #include "components/signin/public/base/signin_switches.h" |
sdefresne | 3657978 | 2016-02-05 11:08:25 | [diff] [blame] | 52 | #include "components/strings/grit/components_strings.h" |
Rushan Suleymanov | 988ad37 | 2020-07-26 19:10:08 | [diff] [blame] | 53 | #include "components/sync/base/sync_base_switches.h" |
Moe Ahmadi | d6d5d17 | 2018-06-20 17:20:23 | [diff] [blame] | 54 | #include "components/sync/driver/sync_driver_switches.h" |
Moe Ahmadi | e4cce1f | 2018-12-18 23:48:01 | [diff] [blame] | 55 | #include "components/translate/core/browser/translate_prefs.h" |
Chris Lu | 0683adf | 2019-02-26 15:56:45 | [diff] [blame] | 56 | #include "components/ukm/ios/features.h" |
Sylvain Defresne | ae6987e | 2018-03-01 13:21:40 | [diff] [blame] | 57 | #include "ios/chrome/browser/browsing_data/browsing_data_features.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 58 | #include "ios/chrome/browser/chrome_switches.h" |
Mike Dougherty | b6c770d | 2019-09-13 22:56:46 | [diff] [blame] | 59 | #include "ios/chrome/browser/crash_report/breadcrumbs/features.h" |
Eugene But | 2823dc7e | 2020-07-21 18:10:37 | [diff] [blame] | 60 | #include "ios/chrome/browser/crash_report/features.h" |
Jean-François Geyelin | 30be591 | 2017-08-25 12:05:38 | [diff] [blame] | 61 | #include "ios/chrome/browser/drag_and_drop/drag_and_drop_flag.h" |
Nazerke | 21bdc45a | 2019-07-11 09:02:05 | [diff] [blame] | 62 | #include "ios/chrome/browser/flags/ios_chrome_flag_descriptions.h" |
Ewann | 163e395 | 2020-08-21 12:34:49 | [diff] [blame] | 63 | #import "ios/chrome/browser/open_in/features.h" |
edchin | 6869684 | 2020-04-09 17:19:31 | [diff] [blame] | 64 | #include "ios/chrome/browser/policy/policy_features.h" |
Sylvain Defresne | 9c10708 | 2020-10-27 16:39:13 | [diff] [blame] | 65 | #include "ios/chrome/browser/screen_time/screen_time_buildflags.h" |
Gauthier Ambard | 33e0330 | 2019-02-21 13:28:58 | [diff] [blame] | 66 | #include "ios/chrome/browser/system_flags.h" |
adamta | 22a4d50 | 2020-05-21 03:12:21 | [diff] [blame] | 67 | #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h" |
Ewann | 93ce65c | 2020-03-05 16:47:13 | [diff] [blame] | 68 | #import "ios/chrome/browser/ui/download/features.h" |
Kurt Horimoto | 4da682b02 | 2018-04-12 07:43:35 | [diff] [blame] | 69 | #import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h" |
sczs | 80a6f46 | 2018-12-05 20:37:18 | [diff] [blame] | 70 | #import "ios/chrome/browser/ui/infobars/infobar_feature.h" |
Ewann Pellé | 987f3c1 | 2020-06-29 15:23:08 | [diff] [blame] | 71 | #import "ios/chrome/browser/ui/page_info/features.h" |
Tanisha Mandre | 549612ea | 2019-07-17 11:36:15 | [diff] [blame] | 72 | #include "ios/chrome/browser/ui/settings/autofill/features.h" |
Ewann | e1ffc6d | 2020-09-01 07:56:13 | [diff] [blame] | 73 | #import "ios/chrome/browser/ui/tab_grid/features.h" |
sczs | 76b9ba0 | 2019-07-23 23:34:30 | [diff] [blame] | 74 | #import "ios/chrome/browser/ui/table_view/feature_flags.h" |
Kurt Horimoto | 79d590b | 2018-09-12 19:09:28 | [diff] [blame] | 75 | #import "ios/chrome/browser/ui/toolbar_container/toolbar_container_features.h" |
Justin Cohen | 2d81c58 | 2018-01-22 14:46:44 | [diff] [blame] | 76 | #include "ios/chrome/browser/ui/ui_feature_flags.h" |
Yi Su | 392b303 | 2018-06-05 07:26:47 | [diff] [blame] | 77 | #include "ios/chrome/browser/web/features.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 78 | #include "ios/chrome/grit/ios_strings.h" |
msarda | fc76f66 | 2017-02-24 12:46:28 | [diff] [blame] | 79 | #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
Eugene But | 61818bc | 2019-04-15 21:04:07 | [diff] [blame] | 80 | #include "ios/web/common/features.h" |
Eugene But | e79f274 | 2019-07-26 17:07:22 | [diff] [blame] | 81 | #include "ios/web/common/user_agent.h" |
Eugene But | b141623 | 2019-07-22 17:31:58 | [diff] [blame] | 82 | #include "ios/web/common/web_view_creation_util.h" |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 83 | |
Sylvain Defresne | 9c10708 | 2020-10-27 16:39:13 | [diff] [blame] | 84 | #if BUILDFLAG(IOS_SCREEN_TIME_ENABLED) |
| 85 | #include "ios/chrome/browser/screen_time/features.h" |
| 86 | #endif |
| 87 | |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 88 | #if !defined(OFFICIAL_BUILD) |
| 89 | #include "components/variations/variations_switches.h" |
vitaliii | 489217aa | 2017-01-30 14:50:22 | [diff] [blame] | 90 | #endif |
stkhapugin | c1be179 | 2016-12-13 14:30:53 | [diff] [blame] | 91 | |
| 92 | #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 93 | #error "This file requires ARC support." |
| 94 | #endif |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 95 | |
elawrence | 816f6790e | 2017-06-16 18:19:28 | [diff] [blame] | 96 | using flags_ui::FeatureEntry; |
| 97 | |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 98 | namespace { |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 99 | |
| 100 | const FeatureEntry::FeatureParam kMarkHttpAsDangerous[] = { |
| 101 | {security_state::features::kMarkHttpAsFeatureParameterName, |
| 102 | security_state::features::kMarkHttpAsParameterDangerous}}; |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 103 | const FeatureEntry::FeatureParam kMarkHttpAsWarningAndDangerousOnFormEdits[] = { |
| 104 | {security_state::features::kMarkHttpAsFeatureParameterName, |
| 105 | security_state::features:: |
| 106 | kMarkHttpAsParameterWarningAndDangerousOnFormEdits}}; |
Livvie Lin | c8a9ed46 | 2019-10-29 01:06:50 | [diff] [blame] | 107 | const FeatureEntry::FeatureParam kMarkHttpAsDangerWarning[] = { |
| 108 | {security_state::features::kMarkHttpAsFeatureParameterName, |
| 109 | security_state::features::kMarkHttpAsParameterDangerWarning}}; |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 110 | |
| 111 | const FeatureEntry::FeatureVariation kMarkHttpAsFeatureVariations[] = { |
| 112 | {"(mark as actively dangerous)", kMarkHttpAsDangerous, |
kokihoon | 189a402 | 2018-10-13 02:43:44 | [diff] [blame] | 113 | base::size(kMarkHttpAsDangerous), nullptr}, |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 114 | {"(mark with a Not Secure warning and dangerous on form edits)", |
| 115 | kMarkHttpAsWarningAndDangerousOnFormEdits, |
Livvie Lin | c8a9ed46 | 2019-10-29 01:06:50 | [diff] [blame] | 116 | base::size(kMarkHttpAsWarningAndDangerousOnFormEdits), nullptr}, |
| 117 | {"(mark with a grey triangle icon)", kMarkHttpAsDangerWarning, |
| 118 | base::size(kMarkHttpAsDangerWarning), nullptr}}; |
elawrence | 816f6790e | 2017-06-16 18:19:28 | [diff] [blame] | 119 | |
Olivier Robin | 3d6041162 | 2018-02-23 10:03:22 | [diff] [blame] | 120 | const FeatureEntry::Choice kAutofillIOSDelayBetweenFieldsChoices[] = { |
| 121 | {flags_ui::kGenericExperimentChoiceDefault, "", ""}, |
| 122 | {"0", autofill::switches::kAutofillIOSDelayBetweenFields, "0"}, |
| 123 | {"10", autofill::switches::kAutofillIOSDelayBetweenFields, "10"}, |
| 124 | {"20", autofill::switches::kAutofillIOSDelayBetweenFields, "20"}, |
| 125 | {"50", autofill::switches::kAutofillIOSDelayBetweenFields, "50"}, |
| 126 | {"100", autofill::switches::kAutofillIOSDelayBetweenFields, "100"}, |
| 127 | {"200", autofill::switches::kAutofillIOSDelayBetweenFields, "200"}, |
| 128 | {"500", autofill::switches::kAutofillIOSDelayBetweenFields, "500"}, |
| 129 | {"1000", autofill::switches::kAutofillIOSDelayBetweenFields, "1000"}, |
| 130 | }; |
| 131 | |
Nohemi Fernandez | 222d6d4 | 2020-09-30 20:35:57 | [diff] [blame] | 132 | const FeatureEntry::Choice kDelayThresholdMinutesToUpdateGaiaCookieChoices[] = { |
| 133 | {flags_ui::kGenericExperimentChoiceDefault, "", ""}, |
| 134 | {"0", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "0"}, |
| 135 | {"10", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "10"}, |
| 136 | {"60", signin::kDelayThresholdMinutesToUpdateGaiaCookie, "60"}, |
| 137 | }; |
| 138 | |
Ce Chen | c8d803a | 2020-04-27 09:31:33 | [diff] [blame] | 139 | const FeatureEntry::FeatureVariation |
Ce Chen | c8d803a | 2020-04-27 09:31:33 | [diff] [blame] | 140 | kOmniboxOnDeviceHeadSuggestNonIncognitoExperimentVariations[] = { |
| 141 | { |
| 142 | "relevance-1000", |
| 143 | (FeatureEntry::FeatureParam[]){ |
| 144 | {OmniboxFieldTrial::kOnDeviceHeadSuggestMaxScoreForNonUrlInput, |
| 145 | "1000"}, |
| 146 | {OmniboxFieldTrial::kOnDeviceHeadSuggestDemoteMode, |
| 147 | "decrease-relevances"}}, |
| 148 | 2, |
| 149 | nullptr, |
| 150 | }, |
| 151 | { |
| 152 | "request-delay-100ms", |
| 153 | (FeatureEntry::FeatureParam[]){ |
| 154 | {OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs, |
| 155 | "100"}}, |
| 156 | 1, |
| 157 | nullptr, |
| 158 | }, |
| 159 | { |
| 160 | "delay-100ms-relevance-1000", |
| 161 | (FeatureEntry::FeatureParam[]){ |
| 162 | {OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs, |
| 163 | "100"}, |
| 164 | {OmniboxFieldTrial::kOnDeviceHeadSuggestMaxScoreForNonUrlInput, |
| 165 | "1000"}, |
| 166 | {OmniboxFieldTrial::kOnDeviceHeadSuggestDemoteMode, |
| 167 | "decrease-relevances"}}, |
| 168 | 3, |
| 169 | nullptr, |
| 170 | }, |
| 171 | { |
| 172 | "request-delay-200ms", |
| 173 | (FeatureEntry::FeatureParam[]){ |
| 174 | {OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs, |
| 175 | "200"}}, |
| 176 | 1, |
| 177 | nullptr, |
| 178 | }, |
| 179 | { |
| 180 | "delay-200ms-relevance-1000", |
| 181 | (FeatureEntry::FeatureParam[]){ |
| 182 | {OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs, |
| 183 | "200"}, |
| 184 | {OmniboxFieldTrial::kOnDeviceHeadSuggestMaxScoreForNonUrlInput, |
| 185 | "1000"}, |
| 186 | {OmniboxFieldTrial::kOnDeviceHeadSuggestDemoteMode, |
| 187 | "decrease-relevances"}}, |
| 188 | 3, |
| 189 | nullptr, |
| 190 | }}; |
Ce Chen | 104a538 | 2019-12-10 01:09:05 | [diff] [blame] | 191 | |
Stepan Khapugin | cc4e984 | 2019-01-23 13:38:13 | [diff] [blame] | 192 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches3[] = { |
| 193 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "3"}}; |
| 194 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches4[] = { |
| 195 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "4"}}; |
| 196 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches5[] = { |
| 197 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "5"}}; |
| 198 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches6[] = { |
| 199 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "6"}}; |
| 200 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches8[] = { |
| 201 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "8"}}; |
| 202 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches10[] = { |
| 203 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "10"}}; |
| 204 | const FeatureEntry::FeatureParam kOmniboxUIMaxAutocompleteMatches12[] = { |
| 205 | {OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "12"}}; |
| 206 | |
| 207 | const FeatureEntry::FeatureVariation |
| 208 | kOmniboxUIMaxAutocompleteMatchesVariations[] = { |
| 209 | {"3 matches", kOmniboxUIMaxAutocompleteMatches3, |
| 210 | base::size(kOmniboxUIMaxAutocompleteMatches3), nullptr}, |
| 211 | {"4 matches", kOmniboxUIMaxAutocompleteMatches4, |
| 212 | base::size(kOmniboxUIMaxAutocompleteMatches4), nullptr}, |
| 213 | {"5 matches", kOmniboxUIMaxAutocompleteMatches5, |
| 214 | base::size(kOmniboxUIMaxAutocompleteMatches5), nullptr}, |
| 215 | {"6 matches", kOmniboxUIMaxAutocompleteMatches6, |
| 216 | base::size(kOmniboxUIMaxAutocompleteMatches6), nullptr}, |
| 217 | {"8 matches", kOmniboxUIMaxAutocompleteMatches8, |
| 218 | base::size(kOmniboxUIMaxAutocompleteMatches8), nullptr}, |
| 219 | {"10 matches", kOmniboxUIMaxAutocompleteMatches10, |
| 220 | base::size(kOmniboxUIMaxAutocompleteMatches10), nullptr}, |
| 221 | {"12 matches", kOmniboxUIMaxAutocompleteMatches12, |
| 222 | base::size(kOmniboxUIMaxAutocompleteMatches12), nullptr}}; |
| 223 | |
Caitlin Fischer | 37e0123 | 2019-05-24 13:05:45 | [diff] [blame] | 224 | const FeatureEntry::FeatureParam |
| 225 | kAutofillUseMobileLabelDisambiguationShowAll[] = { |
| 226 | {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName, |
| 227 | autofill::features:: |
| 228 | kAutofillUseMobileLabelDisambiguationParameterShowAll}}; |
| 229 | const FeatureEntry::FeatureParam |
| 230 | kAutofillUseMobileLabelDisambiguationShowOne[] = { |
| 231 | {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName, |
| 232 | autofill::features:: |
| 233 | kAutofillUseMobileLabelDisambiguationParameterShowOne}}; |
| 234 | |
| 235 | const FeatureEntry::FeatureVariation |
| 236 | kAutofillUseMobileLabelDisambiguationVariations[] = { |
| 237 | {"(show all)", kAutofillUseMobileLabelDisambiguationShowAll, |
| 238 | base::size(kAutofillUseMobileLabelDisambiguationShowAll), nullptr}, |
| 239 | {"(show one)", kAutofillUseMobileLabelDisambiguationShowOne, |
| 240 | base::size(kAutofillUseMobileLabelDisambiguationShowOne), nullptr}}; |
| 241 | |
Cooper Knaak | 1e02656 | 2017-07-26 05:22:28 | [diff] [blame] | 242 | // To add a new entry, add to the end of kFeatureEntries. There are four |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 243 | // distinct types of entries: |
Cooper Knaak | 1e02656 | 2017-07-26 05:22:28 | [diff] [blame] | 244 | // . ENABLE_DISABLE_VALUE: entry is either enabled, disabled, or uses the |
| 245 | // default value for this feature. Use the ENABLE_DISABLE_VALUE_TYPE |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 246 | // macro for this type supplying the command line to the macro. |
| 247 | // . MULTI_VALUE: a list of choices, the first of which should correspond to a |
| 248 | // deactivated state for this lab (i.e. no command line option). To specify |
| 249 | // this type of entry use the macro MULTI_VALUE_TYPE supplying it the |
| 250 | // array of choices. |
Cooper Knaak | 1e02656 | 2017-07-26 05:22:28 | [diff] [blame] | 251 | // . FEATURE_VALUE: entry is associated with a base::Feature instance. Entry is |
| 252 | // either enabled, disabled, or uses the default value of the associated |
| 253 | // base::Feature instance. To specify this type of entry use the macro |
| 254 | // FEATURE_VALUE_TYPE supplying it the base::Feature instance. |
| 255 | // . FEATURE_WITH_PARAM_VALUES: a list of choices associated with a |
| 256 | // base::Feature instance. Choices corresponding to the default state, a |
| 257 | // universally enabled state, and a universally disabled state are |
| 258 | // automatically included. To specify this type of entry use the macro |
| 259 | // FEATURE_WITH_PARAMS_VALUE_TYPE supplying it the base::Feature instance and |
| 260 | // the array of choices. |
| 261 | // |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 262 | // See the documentation of FeatureEntry for details on the fields. |
| 263 | // |
| 264 | // When adding a new choice, add it to the end of the list. |
| 265 | const flags_ui::FeatureEntry kFeatureEntries[] = { |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 266 | {"enable-mark-http-as", flag_descriptions::kMarkHttpAsName, |
elawrence | 816f6790e | 2017-06-16 18:19:28 | [diff] [blame] | 267 | flag_descriptions::kMarkHttpAsDescription, flags_ui::kOsIos, |
Emily Stark | bafa906 | 2017-12-27 15:22:46 | [diff] [blame] | 268 | FEATURE_WITH_PARAMS_VALUE_TYPE( |
| 269 | security_state::features::kMarkHttpAsFeature, |
| 270 | kMarkHttpAsFeatureVariations, |
| 271 | "MarkHttpAs")}, |
Cooper Knaak | 1e02656 | 2017-07-26 05:22:28 | [diff] [blame] | 272 | {"in-product-help-demo-mode-choice", |
| 273 | flag_descriptions::kInProductHelpDemoModeName, |
| 274 | flag_descriptions::kInProductHelpDemoModeDescription, flags_ui::kOsIos, |
| 275 | FEATURE_WITH_PARAMS_VALUE_TYPE( |
Tommy Nyquist | c1d6dea1 | 2017-07-26 20:37:23 | [diff] [blame] | 276 | feature_engagement::kIPHDemoMode, |
| 277 | feature_engagement::kIPHDemoModeChoiceVariations, |
Marc Treib | 2752e8b | 2017-08-04 14:12:09 | [diff] [blame] | 278 | "IPH_DemoMode")}, |
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)}, |
Moe Ahmadi | c3fd7cd | 2018-05-11 21:40:22 | [diff] [blame] | 282 | {"enable-autofill-credit-card-upload", |
| 283 | flag_descriptions::kAutofillCreditCardUploadName, |
| 284 | flag_descriptions::kAutofillCreditCardUploadDescription, flags_ui::kOsIos, |
Anne Lim | 579b573 | 2018-08-30 18:24:24 | [diff] [blame] | 285 | FEATURE_VALUE_TYPE(autofill::features::kAutofillUpstream)}, |
Moe Ahmadi | d6d5d17 | 2018-06-20 17:20:23 | [diff] [blame] | 286 | {"use-sync-sandbox", flag_descriptions::kSyncSandboxName, |
| 287 | flag_descriptions::kSyncSandboxDescription, flags_ui::kOsIos, |
| 288 | SINGLE_VALUE_TYPE_AND_VALUE( |
| 289 | switches::kSyncServiceURL, |
| 290 | "https://chrome-sync.sandbox.google.com/chrome-sync/alpha")}, |
| 291 | {"wallet-service-use-sandbox", |
| 292 | flag_descriptions::kWalletServiceUseSandboxName, |
| 293 | flag_descriptions::kWalletServiceUseSandboxDescription, flags_ui::kOsIos, |
| 294 | ENABLE_DISABLE_VALUE_TYPE_AND_VALUE( |
| 295 | autofill::switches::kWalletServiceUseSandbox, |
| 296 | "1", |
| 297 | autofill::switches::kWalletServiceUseSandbox, |
| 298 | "0")}, |
Mohamad Ahmadi | c4df81f | 2017-12-20 04:41:59 | [diff] [blame] | 299 | {"show-autofill-type-predictions", |
| 300 | flag_descriptions::kShowAutofillTypePredictionsName, |
| 301 | flag_descriptions::kShowAutofillTypePredictionsDescription, |
| 302 | flags_ui::kOsIos, |
Gauthier Ambard | cfd8518 | 2018-01-05 10:37:46 | [diff] [blame] | 303 | FEATURE_VALUE_TYPE(autofill::features::kAutofillShowTypePredictions)}, |
Olivier Robin | 3d6041162 | 2018-02-23 10:03:22 | [diff] [blame] | 304 | {"autofill-ios-delay-between-fields", |
| 305 | flag_descriptions::kAutofillIOSDelayBetweenFieldsName, |
| 306 | flag_descriptions::kAutofillIOSDelayBetweenFieldsDescription, |
| 307 | flags_ui::kOsIos, MULTI_VALUE_TYPE(kAutofillIOSDelayBetweenFieldsChoices)}, |
Moe Ahmadi | d3ddfcb | 2018-04-20 19:51:08 | [diff] [blame] | 308 | {"autofill-restrict-formless-form-extraction", |
| 309 | flag_descriptions::kAutofillRestrictUnownedFieldsToFormlessCheckoutName, |
| 310 | flag_descriptions:: |
| 311 | kAutofillRestrictUnownedFieldsToFormlessCheckoutDescription, |
| 312 | flags_ui::kOsIos, |
| 313 | FEATURE_VALUE_TYPE( |
| 314 | autofill::features::kAutofillRestrictUnownedFieldsToFormlessCheckout)}, |
Roger McFarlane | e193ab12 | 2018-11-22 20:55:07 | [diff] [blame] | 315 | {"autofill-rich-metadata-queries", |
| 316 | flag_descriptions::kAutofillRichMetadataQueriesName, |
| 317 | flag_descriptions::kAutofillRichMetadataQueriesDescription, |
| 318 | flags_ui::kOsIos, |
| 319 | FEATURE_VALUE_TYPE(autofill::features::kAutofillRichMetadataQueries)}, |
Kurt Horimoto | dc33af3 | 2018-05-01 01:39:14 | [diff] [blame] | 320 | {"fullscreen-viewport-adjustment-experiment", |
Chris Lu | 481a932 | 2019-09-25 22:16:53 | [diff] [blame] | 321 | flag_descriptions::kFullscreenSmoothScrollingName, |
| 322 | flag_descriptions::kFullscreenSmoothScrollingDescription, flags_ui::kOsIos, |
| 323 | FEATURE_VALUE_TYPE(fullscreen::features::kSmoothScrollingDefault)}, |
Roger McFarlane | 1a37d7b | 2018-04-20 22:45:19 | [diff] [blame] | 324 | {"autofill-enforce-min-required-fields-for-heuristics", |
| 325 | flag_descriptions::kAutofillEnforceMinRequiredFieldsForHeuristicsName, |
| 326 | flag_descriptions:: |
| 327 | kAutofillEnforceMinRequiredFieldsForHeuristicsDescription, |
| 328 | flags_ui::kOsIos, |
| 329 | FEATURE_VALUE_TYPE( |
| 330 | autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics)}, |
| 331 | {"autofill-enforce-min-required-fields-for-query", |
| 332 | flag_descriptions::kAutofillEnforceMinRequiredFieldsForQueryName, |
| 333 | flag_descriptions::kAutofillEnforceMinRequiredFieldsForQueryDescription, |
| 334 | flags_ui::kOsIos, |
| 335 | FEATURE_VALUE_TYPE( |
| 336 | autofill::features::kAutofillEnforceMinRequiredFieldsForQuery)}, |
| 337 | {"autofill-enforce-min-required-fields-for-upload", |
| 338 | flag_descriptions::kAutofillEnforceMinRequiredFieldsForUploadName, |
| 339 | flag_descriptions::kAutofillEnforceMinRequiredFieldsForUploadDescription, |
| 340 | flags_ui::kOsIos, |
| 341 | FEATURE_VALUE_TYPE( |
| 342 | autofill::features::kAutofillEnforceMinRequiredFieldsForUpload)}, |
Roger McFarlane | 2eceba98 | 2018-05-18 01:37:11 | [diff] [blame] | 343 | {"autofill-cache-query-responses", |
| 344 | flag_descriptions::kAutofillCacheQueryResponsesName, |
| 345 | flag_descriptions::kAutofillCacheQueryResponsesDescription, |
| 346 | flags_ui::kOsIos, |
| 347 | FEATURE_VALUE_TYPE(autofill::features::kAutofillCacheQueryResponses)}, |
Robbie Gibson | 1f37a5e | 2020-08-06 17:03:06 | [diff] [blame] | 348 | {"webpage-default-zoom-from-dynamic-type", |
| 349 | flag_descriptions::kWebPageDefaultZoomFromDynamicTypeName, |
| 350 | flag_descriptions::kWebPageDefaultZoomFromDynamicTypeDescription, |
| 351 | flags_ui::kOsIos, |
| 352 | FEATURE_VALUE_TYPE(web::kWebPageDefaultZoomFromDynamicType)}, |
Yi Su | 392b303 | 2018-06-05 07:26:47 | [diff] [blame] | 353 | {"webpage-text-accessibility", |
| 354 | flag_descriptions::kWebPageTextAccessibilityName, |
| 355 | flag_descriptions::kWebPageTextAccessibilityDescription, flags_ui::kOsIos, |
| 356 | FEATURE_VALUE_TYPE(web::kWebPageTextAccessibility)}, |
Robbie Gibson | 88f2396 | 2020-09-28 14:35:56 | [diff] [blame] | 357 | {"webpage-alternative-text-zoom", |
| 358 | flag_descriptions::kWebPageAlternativeTextZoomName, |
| 359 | flag_descriptions::kWebPageAlternativeTextZoomDescription, |
| 360 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(web::kWebPageAlternativeTextZoom)}, |
Kurt Horimoto | 79d590b | 2018-09-12 19:09:28 | [diff] [blame] | 361 | {"toolbar-container", flag_descriptions::kToolbarContainerName, |
| 362 | flag_descriptions::kToolbarContainerDescription, flags_ui::kOsIos, |
| 363 | FEATURE_VALUE_TYPE(toolbar_container::kToolbarContainerEnabled)}, |
Ce Chen | c8d803a | 2020-04-27 09:31:33 | [diff] [blame] | 364 | {"omnibox-on-device-head-suggestions-incognito", |
| 365 | flag_descriptions::kOmniboxOnDeviceHeadSuggestionsIncognitoName, |
| 366 | flag_descriptions::kOmniboxOnDeviceHeadSuggestionsIncognitoDescription, |
Ce Chen | 104a538 | 2019-12-10 01:09:05 | [diff] [blame] | 367 | flags_ui::kOsIos, |
Ce Chen | d565f71f | 2020-08-12 01:15:53 | [diff] [blame] | 368 | FEATURE_VALUE_TYPE(omnibox::kOnDeviceHeadProviderIncognito)}, |
Ce Chen | c8d803a | 2020-04-27 09:31:33 | [diff] [blame] | 369 | {"omnibox-on-device-head-suggestions-non-incognito", |
| 370 | flag_descriptions::kOmniboxOnDeviceHeadSuggestionsNonIncognitoName, |
| 371 | flag_descriptions::kOmniboxOnDeviceHeadSuggestionsNonIncognitoDescription, |
| 372 | flags_ui::kOsIos, |
| 373 | FEATURE_WITH_PARAMS_VALUE_TYPE( |
| 374 | omnibox::kOnDeviceHeadProviderNonIncognito, |
| 375 | kOmniboxOnDeviceHeadSuggestNonIncognitoExperimentVariations, |
| 376 | "OmniboxOnDeviceHeadSuggestNonIncognitoIOS")}, |
Stepan Khapugin | cc4e984 | 2019-01-23 13:38:13 | [diff] [blame] | 377 | {"omnibox-ui-max-autocomplete-matches", |
| 378 | flag_descriptions::kOmniboxUIMaxAutocompleteMatchesName, |
| 379 | flag_descriptions::kOmniboxUIMaxAutocompleteMatchesDescription, |
| 380 | flags_ui::kOsIos, |
| 381 | FEATURE_WITH_PARAMS_VALUE_TYPE( |
| 382 | omnibox::kUIExperimentMaxAutocompleteMatches, |
| 383 | kOmniboxUIMaxAutocompleteMatchesVariations, |
| 384 | "OmniboxUIMaxAutocompleteVariations")}, |
sczs | 80a6f46 | 2018-12-05 20:37:18 | [diff] [blame] | 385 | {"infobar-ui-reboot", flag_descriptions::kInfobarUIRebootName, |
| 386 | flag_descriptions::kInfobarUIRebootDescription, flags_ui::kOsIos, |
sczs | 27e389e | 2020-01-15 15:19:18 | [diff] [blame] | 387 | FEATURE_VALUE_TYPE(kIOSInfobarUIReboot)}, |
Robbie Gibson | 80d732e | 2019-01-10 10:42:49 | [diff] [blame] | 388 | {"enable-clipboard-provider-image-suggestions", |
| 389 | flag_descriptions::kEnableClipboardProviderImageSuggestionsName, |
| 390 | flag_descriptions::kEnableClipboardProviderImageSuggestionsDescription, |
| 391 | flags_ui::kOsIos, |
| 392 | FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProviderImageSuggestions)}, |
edchin | 5ae0b4c | 2019-01-06 06:52:28 | [diff] [blame] | 393 | {"snapshot-draw-view", flag_descriptions::kSnapshotDrawViewName, |
| 394 | flag_descriptions::kSnapshotDrawViewDescription, flags_ui::kOsIos, |
| 395 | FEATURE_VALUE_TYPE(kSnapshotDrawView)}, |
Justin Cohen | 20b6f07 | 2019-01-16 01:38:50 | [diff] [blame] | 396 | #if defined(DCHECK_IS_CONFIGURABLE) |
| 397 | {"dcheck-is-fatal", flag_descriptions::kDcheckIsFatalName, |
| 398 | flag_descriptions::kDcheckIsFatalDescription, flags_ui::kOsIos, |
| 399 | FEATURE_VALUE_TYPE(base::kDCheckIsFatalFeature)}, |
| 400 | #endif // defined(DCHECK_IS_CONFIGURABLE) |
Gauthier Ambard | 5f61086 | 2019-01-17 11:43:55 | [diff] [blame] | 401 | {"settings-refresh", flag_descriptions::kSettingsRefreshName, |
| 402 | flag_descriptions::kSettingsRefreshDescription, flags_ui::kOsIos, |
| 403 | FEATURE_VALUE_TYPE(kSettingsRefresh)}, |
Chris Lu | 8153e6e | 2019-03-26 16:28:21 | [diff] [blame] | 404 | {"send-uma-cellular", flag_descriptions::kSendUmaOverAnyNetwork, |
| 405 | flag_descriptions::kSendUmaOverAnyNetworkDescription, flags_ui::kOsIos, |
Chris Lu | 0683adf | 2019-02-26 15:56:45 | [diff] [blame] | 406 | FEATURE_VALUE_TYPE(kUmaCellular)}, |
Caitlin Fischer | 43edd90a | 2019-05-01 13:24:30 | [diff] [blame] | 407 | {"autofill-use-mobile-label-disambiguation", |
| 408 | flag_descriptions::kAutofillUseMobileLabelDisambiguationName, |
| 409 | flag_descriptions::kAutofillUseMobileLabelDisambiguationDescription, |
| 410 | flags_ui::kOsIos, |
Caitlin Fischer | 37e0123 | 2019-05-24 13:05:45 | [diff] [blame] | 411 | FEATURE_WITH_PARAMS_VALUE_TYPE( |
| 412 | autofill::features::kAutofillUseMobileLabelDisambiguation, |
| 413 | kAutofillUseMobileLabelDisambiguationVariations, |
| 414 | "AutofillUseMobileLabelDisambiguation")}, |
edchin | b5d9258 | 2020-03-11 15:26:11 | [diff] [blame] | 415 | {"autofill-prune-suggestions", |
Caitlin Fischer | 6d60954 | 2019-05-01 21:59:21 | [diff] [blame] | 416 | flag_descriptions::kAutofillPruneSuggestionsName, |
| 417 | flag_descriptions::kAutofillPruneSuggestionsDescription, flags_ui::kOsIos, |
| 418 | FEATURE_VALUE_TYPE(autofill::features::kAutofillPruneSuggestions)}, |
sczs | 76b9ba0 | 2019-07-23 23:34:30 | [diff] [blame] | 419 | {"collections-card-presentation-style", |
| 420 | flag_descriptions::kCollectionsCardPresentationStyleName, |
| 421 | flag_descriptions::kCollectionsCardPresentationStyleDescription, |
| 422 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kCollectionsCardPresentationStyle)}, |
Tanisha Mandre | 3a14d38 | 2019-09-05 17:33:44 | [diff] [blame] | 423 | {"credit-card-scanner", flag_descriptions::kCreditCardScannerName, |
| 424 | flag_descriptions::kCreditCardScannerDescription, flags_ui::kOsIos, |
| 425 | FEATURE_VALUE_TYPE(kCreditCardScanner)}, |
Mike Dougherty | b6c770d | 2019-09-13 22:56:46 | [diff] [blame] | 426 | {"ios-breadcrumbs", flag_descriptions::kLogBreadcrumbsName, |
| 427 | flag_descriptions::kLogBreadcrumbsDescription, flags_ui::kOsIos, |
| 428 | FEATURE_VALUE_TYPE(kLogBreadcrumbs)}, |
Eugene But | 2823dc7e | 2020-07-21 18:10:37 | [diff] [blame] | 429 | {"ios-synthetic-crash-reports", |
| 430 | flag_descriptions::kSyntheticCrashReportsForUteName, |
| 431 | flag_descriptions::kSyntheticCrashReportsForUteDescription, |
| 432 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kSyntheticCrashReportsForUte)}, |
Jérôme Lebel | c374fdd | 2019-09-27 10:36:48 | [diff] [blame] | 433 | {"force-startup-signin-promo", |
| 434 | flag_descriptions::kForceStartupSigninPromoName, |
| 435 | flag_descriptions::kForceStartupSigninPromoDescription, flags_ui::kOsIos, |
| 436 | FEATURE_VALUE_TYPE(signin::kForceStartupSigninPromo)}, |
Justin Cohen | c57413a | 2019-09-30 19:42:29 | [diff] [blame] | 437 | {"embedder-block-restore-url", |
| 438 | flag_descriptions::kEmbedderBlockRestoreUrlName, |
| 439 | flag_descriptions::kEmbedderBlockRestoreUrlDescription, flags_ui::kOsIos, |
| 440 | FEATURE_VALUE_TYPE(kEmbedderBlockRestoreUrl)}, |
David Jean | faeae6f9 | 2020-06-05 08:51:52 | [diff] [blame] | 441 | {"disable-progress-bar-animation", |
| 442 | flag_descriptions::kDisableProgressBarAnimationName, |
| 443 | flag_descriptions::kDisableProgressBarAnimationDescription, |
| 444 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kDisableProgressBarAnimation)}, |
sczs | 004fa6c | 2019-10-18 17:22:52 | [diff] [blame] | 445 | {"messages-save-card-infobar", |
| 446 | flag_descriptions::kSaveCardInfobarMessagesUIName, |
| 447 | flag_descriptions::kSaveCardInfobarMessagesUIDescription, flags_ui::kOsIos, |
| 448 | FEATURE_VALUE_TYPE(kSaveCardInfobarMessagesUI)}, |
Chris Lu | 4cc111b45 | 2019-10-18 22:18:48 | [diff] [blame] | 449 | {"messages-translate-infobar", |
| 450 | flag_descriptions::kTranslateInfobarMessagesUIName, |
| 451 | flag_descriptions::kTranslateInfobarMessagesUIDescription, |
| 452 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kTranslateInfobarMessagesUI)}, |
sczs | 4622e6e | 2019-11-06 01:17:59 | [diff] [blame] | 453 | {"autofill-save-card-dismiss-on-navigation", |
| 454 | flag_descriptions::kAutofillSaveCardDismissOnNavigationName, |
| 455 | flag_descriptions::kAutofillSaveCardDismissOnNavigationDescription, |
| 456 | flags_ui::kOsIos, |
| 457 | FEATURE_VALUE_TYPE( |
| 458 | autofill::features::kAutofillSaveCardDismissOnNavigation)}, |
Ewann | 6674c13 | 2019-11-06 11:20:41 | [diff] [blame] | 459 | {"enable-persistent-downloads", |
| 460 | flag_descriptions::kEnablePersistentDownloadsName, |
| 461 | flag_descriptions::kEnablePersistentDownloadsDescription, flags_ui::kOsIos, |
| 462 | FEATURE_VALUE_TYPE(web::features::kEnablePersistentDownloads)}, |
Rohit Rao | e7b48931 | 2019-11-12 12:28:55 | [diff] [blame] | 463 | {"force-unstacked-tabstrip", flag_descriptions::kForceUnstackedTabstripName, |
| 464 | flag_descriptions::kForceUnstackedTabstripDescription, flags_ui::kOsIos, |
| 465 | FEATURE_VALUE_TYPE(kForceUnstackedTabstrip)}, |
Gauthier Ambard | 9391400 | 2019-11-14 12:56:12 | [diff] [blame] | 466 | {"use-js-error-page", flag_descriptions::kUseJSForErrorPageName, |
| 467 | flag_descriptions::kUseJSForErrorPageDescription, flags_ui::kOsIos, |
| 468 | FEATURE_VALUE_TYPE(web::features::kUseJSForErrorPage)}, |
Gauthier Ambard | bde9def | 2019-11-19 18:04:33 | [diff] [blame] | 469 | {"desktop-version-default", flag_descriptions::kDefaultToDesktopOnIPadName, |
| 470 | flag_descriptions::kDefaultToDesktopOnIPadDescription, flags_ui::kOsIos, |
Gauthier Ambard | 054175f | 2019-12-16 11:54:09 | [diff] [blame] | 471 | FEATURE_VALUE_TYPE(web::features::kUseDefaultUserAgentInWebClient)}, |
Gauthier Ambard | bde9def | 2019-11-19 18:04:33 | [diff] [blame] | 472 | {"mobile-google-srp", flag_descriptions::kMobileGoogleSRPName, |
| 473 | flag_descriptions::kMobileGoogleSRPDescription, flags_ui::kOsIos, |
| 474 | FEATURE_VALUE_TYPE(web::kMobileGoogleSRP)}, |
Kurt Horimoto | d754e8ec | 2019-12-03 20:54:02 | [diff] [blame] | 475 | {"infobar-overlay-ui", flag_descriptions::kInfobarOverlayUIName, |
| 476 | flag_descriptions::kInfobarOverlayUIDescription, flags_ui::kOsIos, |
| 477 | FEATURE_VALUE_TYPE(kInfobarOverlayUI)}, |
sczs | 391ebba | 2019-12-05 06:59:30 | [diff] [blame] | 478 | {"autofill-save-card-infobar-edit-support", |
| 479 | flag_descriptions::kAutofillSaveCardInfobarEditSupportName, |
| 480 | flag_descriptions::kAutofillSaveCardInfobarEditSupportDescription, |
| 481 | flags_ui::kOsIos, |
| 482 | FEATURE_VALUE_TYPE( |
| 483 | autofill::features::kAutofillSaveCardInfobarEditSupport)}, |
Ewann Pellé | 987f3c1 | 2020-06-29 15:23:08 | [diff] [blame] | 484 | {"page-info-refactoring", flag_descriptions::kPageInfoRefactoringName, |
| 485 | flag_descriptions::kPageInfoRefactoringDescription, flags_ui::kOsIos, |
| 486 | FEATURE_VALUE_TYPE(kPageInfoRefactoring)}, |
Livvie Lin | b861cba | 2020-01-22 01:54:47 | [diff] [blame] | 487 | {"ssl-committed-interstitials", |
| 488 | flag_descriptions::kSSLCommittedInterstitialsName, |
| 489 | flag_descriptions::kSSLCommittedInterstitialsDescription, flags_ui::kOsIos, |
| 490 | FEATURE_VALUE_TYPE(web::features::kSSLCommittedInterstitials)}, |
Chris Lu | f7c9b07 | 2020-01-23 17:57:32 | [diff] [blame] | 491 | {"fullscreen-controller-browser-scoped", |
| 492 | flag_descriptions::kFullscreenControllerBrowserScopedName, |
| 493 | flag_descriptions::kFullscreenControllerBrowserScopedDescription, |
| 494 | flags_ui::kOsIos, |
| 495 | FEATURE_VALUE_TYPE( |
| 496 | fullscreen::features::kFullscreenControllerBrowserScoped)}, |
Ewann | 93ce65c | 2020-03-05 16:47:13 | [diff] [blame] | 497 | {"open-downloads-in-files.app", |
| 498 | flag_descriptions::kOpenDownloadsInFilesAppName, |
| 499 | flag_descriptions::kOpenDownloadsInFilesAppDescription, flags_ui::kOsIos, |
| 500 | FEATURE_VALUE_TYPE(kOpenDownloadsInFilesApp)}, |
Livvie Lin | 5e09591 | 2020-03-18 18:16:28 | [diff] [blame] | 501 | {"ios-lookalike-url-navigation-suggestions-ui", |
| 502 | flag_descriptions::kIOSLookalikeUrlNavigationSuggestionsUIName, |
| 503 | flag_descriptions::kIOSLookalikeUrlNavigationSuggestionsUIDescription, |
| 504 | flags_ui::kOsIos, |
| 505 | FEATURE_VALUE_TYPE( |
| 506 | web::features::kIOSLookalikeUrlNavigationSuggestionsUI)}, |
Ali Juma | 01ca4ff | 2020-03-19 15:53:11 | [diff] [blame] | 507 | {"safe-browsing-available", flag_descriptions::kSafeBrowsingAvailableName, |
| 508 | flag_descriptions::kSafeBrowsingAvailableDescription, flags_ui::kOsIos, |
| 509 | FEATURE_VALUE_TYPE(safe_browsing::kSafeBrowsingAvailableOnIOS)}, |
Ali Juma | a2821be | 2020-07-23 18:26:16 | [diff] [blame] | 510 | {"safe-browsing-real-time", |
| 511 | flag_descriptions::kSafeBrowsingRealTimeLookupName, |
| 512 | flag_descriptions::kSafeBrowsingRealTimeLookupDescription, |
| 513 | flags_ui::kOsIos, |
| 514 | FEATURE_VALUE_TYPE(safe_browsing::kRealTimeUrlLookupEnabled)}, |
edchin | 6869684 | 2020-04-09 17:19:31 | [diff] [blame] | 515 | {"managed-bookmarks-ios", flag_descriptions::kManagedBookmarksIOSName, |
| 516 | flag_descriptions::kManagedBookmarksIOSDescription, flags_ui::kOsIos, |
| 517 | FEATURE_VALUE_TYPE(kManagedBookmarksIOS)}, |
Anne Lim | e49c5cb | 2020-04-15 03:20:59 | [diff] [blame] | 518 | {"enable-autofill-cache-server-card-info", |
| 519 | flag_descriptions::kEnableAutofillCacheServerCardInfoName, |
| 520 | flag_descriptions::kEnableAutofillCacheServerCardInfoDescription, |
| 521 | flags_ui::kOsIos, |
| 522 | FEATURE_VALUE_TYPE(autofill::features::kAutofillCacheServerCardInfo)}, |
sczs | 5b8ac5f | 2020-04-17 16:23:20 | [diff] [blame] | 523 | {"infobar-ui-reboot-only-ios13", |
| 524 | flag_descriptions::kInfobarUIRebootOnlyiOS13Name, |
| 525 | flag_descriptions::kInfobarUIRebootOnlyiOS13Description, flags_ui::kOsIos, |
| 526 | FEATURE_VALUE_TYPE(kInfobarUIRebootOnlyiOS13)}, |
edchin | 39d08d6 | 2020-04-20 13:11:24 | [diff] [blame] | 527 | {"edit-bookmarks-ios", flag_descriptions::kEditBookmarksIOSName, |
| 528 | flag_descriptions::kEditBookmarksIOSDescription, flags_ui::kOsIos, |
| 529 | FEATURE_VALUE_TYPE(kEditBookmarksIOS)}, |
Mike Dougherty | 76838950 | 2020-04-21 08:28:35 | [diff] [blame] | 530 | {"url-blocklist-ios", flag_descriptions::kURLBlocklistIOSName, |
| 531 | flag_descriptions::kURLBlocklistIOSDescription, flags_ui::kOsIos, |
| 532 | FEATURE_VALUE_TYPE(kURLBlocklistIOS)}, |
Éric Noyau | 41b90108f | 2020-04-22 21:37:55 | [diff] [blame] | 533 | #if defined(__IPHONE_13_4) |
| 534 | {"pointer-support", flag_descriptions::kPointerSupportName, |
| 535 | flag_descriptions::kPointerSupportDescription, flags_ui::kOsIos, |
| 536 | FEATURE_VALUE_TYPE(kPointerSupport)}, |
| 537 | #endif // defined(__IPHONE_13_4) |
siashah | 0a38622 | 2020-04-23 03:31:35 | [diff] [blame] | 538 | {"autofill-enable-google-issued-card", |
| 539 | flag_descriptions::kAutofillEnableGoogleIssuedCardName, |
| 540 | flag_descriptions::kAutofillEnableGoogleIssuedCardDescription, |
| 541 | flags_ui::kOsIos, |
| 542 | FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableGoogleIssuedCard)}, |
Nohemi Fernandez | 9402147 | 2020-05-05 08:33:58 | [diff] [blame] | 543 | {"enable-mygoogle", flag_descriptions::kEnableMyGoogleName, |
| 544 | flag_descriptions::kEnableMyGoogleDescription, flags_ui::kOsIos, |
| 545 | FEATURE_VALUE_TYPE(kEnableMyGoogle)}, |
Siyu An | d1f86e2 | 2020-05-13 20:35:16 | [diff] [blame] | 546 | {"autofill-enable-card-nickname-management", |
| 547 | flag_descriptions::kAutofillEnableCardNicknameManagementName, |
| 548 | flag_descriptions::kAutofillEnableCardNicknameManagementDescription, |
| 549 | flags_ui::kOsIos, |
| 550 | FEATURE_VALUE_TYPE( |
| 551 | autofill::features::kAutofillEnableCardNicknameManagement)}, |
Tina Wang | 52aea19d | 2020-05-15 16:47:33 | [diff] [blame] | 552 | {"enable-ios-managed-settings-ui", |
| 553 | flag_descriptions::kEnableIOSManagedSettingsUIName, |
| 554 | flag_descriptions::kEnableIOSManagedSettingsUIDescription, |
| 555 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableIOSManagedSettingsUI)}, |
Sean Harrison | 0ada3b08 | 2020-05-18 19:07:51 | [diff] [blame] | 556 | {"safety-check-ios", flag_descriptions::kSafetyCheckIOSName, |
| 557 | flag_descriptions::kSafetyCheckIOSDescription, flags_ui::kOsIos, |
| 558 | FEATURE_VALUE_TYPE(kSafetyCheckIOS)}, |
sczs | 37d9c13 | 2020-07-18 06:06:33 | [diff] [blame] | 559 | {"new-content-suggestions-feed", flag_descriptions::kDiscoverFeedInNtpName, |
adamta | 22a4d50 | 2020-05-21 03:12:21 | [diff] [blame] | 560 | flag_descriptions::kDiscoverFeedInNtpDescription, flags_ui::kOsIos, |
| 561 | FEATURE_VALUE_TYPE(kDiscoverFeedInNtp)}, |
Siyu An | 6ca4cdb | 2020-05-29 20:56:17 | [diff] [blame] | 562 | {"autofill-enable-card-nickname-upstream", |
| 563 | flag_descriptions::kAutofillEnableCardNicknameUpstreamName, |
| 564 | flag_descriptions::kAutofillEnableCardNicknameUpstreamDescription, |
| 565 | flags_ui::kOsIos, |
| 566 | FEATURE_VALUE_TYPE( |
| 567 | autofill::features::kAutofillEnableCardNicknameUpstream)}, |
Maxime Charland | 425d9b4 | 2020-06-01 19:47:21 | [diff] [blame] | 568 | {"illustrated-empty-states", flag_descriptions::kIllustratedEmptyStatesName, |
| 569 | flag_descriptions::kIllustratedEmptyStatesDescription, flags_ui::kOsIos, |
| 570 | FEATURE_VALUE_TYPE(kIllustratedEmptyStates)}, |
Sebastien Lalancette | 414fc1ce | 2020-06-11 14:43:06 | [diff] [blame] | 571 | {"enable-native-context-menus", |
| 572 | flag_descriptions::kEnableNativeContextMenusName, |
| 573 | flag_descriptions::kEnableNativeContextMenusDescription, flags_ui::kOsIos, |
| 574 | FEATURE_VALUE_TYPE(kEnableNativeContextMenus)}, |
Roberto Moura | b87b972 | 2020-06-17 17:12:09 | [diff] [blame] | 575 | {"expanded-tab-strip", flag_descriptions::kExpandedTabStripName, |
| 576 | flag_descriptions::kExpandedTabStripDescription, flags_ui::kOsIos, |
| 577 | FEATURE_VALUE_TYPE(kExpandedTabStrip)}, |
Ben Blake | 14592fe | 2020-06-16 15:34:38 | [diff] [blame] | 578 | {"autofill-enable-offers-in-downstream", |
| 579 | flag_descriptions::kAutofillEnableOffersInDownstreamName, |
| 580 | flag_descriptions::kAutofillEnableOffersInDownstreamDescription, |
| 581 | flags_ui::kOsIos, |
| 582 | FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableOffersInDownstream)}, |
Tommy Martino | 6b4eb7e | 2020-06-25 18:25:41 | [diff] [blame] | 583 | {"shared-highlighting-ios", flag_descriptions::kSharedHighlightingIOSName, |
| 584 | flag_descriptions::kSharedHighlightingIOSDescription, flags_ui::kOsIos, |
| 585 | FEATURE_VALUE_TYPE(kSharedHighlightingIOS)}, |
edchin | 8fdb89304 | 2020-06-25 23:17:07 | [diff] [blame] | 586 | {"add-web-content-drop-interaction", |
| 587 | flag_descriptions::kAddWebContentDropInteractionName, |
| 588 | flag_descriptions::kAddWebContentDropInteractionDescription, |
| 589 | flags_ui::kOsIos, |
| 590 | FEATURE_VALUE_TYPE(web::features::kAddWebContentDropInteraction)}, |
Julian Mentasti-Meza | 4c0a416 | 2020-07-20 18:51:41 | [diff] [blame] | 591 | {"enable-fullpage-screenshot", |
| 592 | flag_descriptions::kEnableFullPageScreenshotName, |
| 593 | flag_descriptions::kEnableFullPageScreenshotDescription, flags_ui::kOsIos, |
| 594 | FEATURE_VALUE_TYPE(kEnableFullPageScreenshot)}, |
Tommy Martino | 4012467 | 2020-07-31 17:29:44 | [diff] [blame] | 595 | {"scroll-to-text-ios", flag_descriptions::kScrollToTextIOSName, |
| 596 | flag_descriptions::kScrollToTextIOSDescription, flags_ui::kOsIos, |
| 597 | FEATURE_VALUE_TYPE(web::features::kScrollToTextIOS)}, |
Chris Thompson | 40cbb16 | 2020-08-04 23:22:15 | [diff] [blame] | 598 | {"legacy-tls-interstitial", |
| 599 | flag_descriptions::kIOSLegacyTLSInterstitialsName, |
| 600 | flag_descriptions::kIOSLegacyTLSInterstitialsDescription, flags_ui::kOsIos, |
| 601 | FEATURE_VALUE_TYPE(web::features::kIOSLegacyTLSInterstitial)}, |
Ewann | 163e395 | 2020-08-21 12:34:49 | [diff] [blame] | 602 | {"extend-open-in-files-support", |
| 603 | flag_descriptions::kExtendOpenInFilesSupportName, |
| 604 | flag_descriptions::kExtendOpenInFilesSupportDescription, flags_ui::kOsIos, |
| 605 | FEATURE_VALUE_TYPE(kExtendOpenInFilesSupport)}, |
Jan Wilken Dörrie | 7df8c60 | 2020-08-31 11:16:39 | [diff] [blame] | 606 | {"well-known-change-password", |
| 607 | flag_descriptions::kWellKnownChangePasswordName, |
| 608 | flag_descriptions::kWellKnownChangePasswordDescription, flags_ui::kOsIos, |
| 609 | FEATURE_VALUE_TYPE(password_manager::features::kWellKnownChangePassword)}, |
Ewann | e1ffc6d | 2020-09-01 07:56:13 | [diff] [blame] | 610 | {"enable-close-all-tabs-confirmation", |
| 611 | flag_descriptions::kEnableCloseAllTabsConfirmationName, |
| 612 | flag_descriptions::kEnableCloseAllTabsConfirmationDescription, |
| 613 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableCloseAllTabsConfirmation)}, |
Sylvain Defresne | 9c10708 | 2020-10-27 16:39:13 | [diff] [blame] | 614 | #if BUILDFLAG(IOS_SCREEN_TIME_ENABLED) |
edchin | 81467b8 | 2020-09-03 19:31:45 | [diff] [blame] | 615 | {"screen-time-integration-ios", |
| 616 | flag_descriptions::kScreenTimeIntegrationName, |
| 617 | flag_descriptions::kScreenTimeIntegrationDescription, flags_ui::kOsIos, |
| 618 | FEATURE_VALUE_TYPE(kScreenTimeIntegration)}, |
Sylvain Defresne | 9c10708 | 2020-10-27 16:39:13 | [diff] [blame] | 619 | #endif |
Nohemi Fernandez | 983d6d5 | 2020-09-09 09:46:19 | [diff] [blame] | 620 | {"mobile-identity-consistency", |
| 621 | flag_descriptions::kMobileIdentityConsistencyName, |
| 622 | flag_descriptions::kMobileIdentityConsistencyDescription, flags_ui::kOsIos, |
| 623 | FEATURE_VALUE_TYPE(signin::kMobileIdentityConsistency)}, |
Chris Lu | 3450330 | 2020-09-11 22:08:07 | [diff] [blame] | 624 | {"default-browser-fullscreen-promo", |
| 625 | flag_descriptions::kDefaultBrowserFullscreenPromoName, |
| 626 | flag_descriptions::kDefaultBrowserFullscreenPromoDescription, |
| 627 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kDefaultBrowserFullscreenPromo)}, |
Gauthier Ambard | a1d88a0 | 2020-09-14 11:46:37 | [diff] [blame] | 628 | {"default-browser-setting", flag_descriptions::kDefaultBrowserSettingsName, |
| 629 | flag_descriptions::kDefaultBrowserSettingsDescription, flags_ui::kOsIos, |
| 630 | FEATURE_VALUE_TYPE(kDefaultBrowserSettings)}, |
Nazerke | 3e993f7 | 2020-09-21 13:00:06 | [diff] [blame] | 631 | {"modern-tab-strip", flag_descriptions::kModernTabStripName, |
| 632 | flag_descriptions::kModernTabStripDescription, flags_ui::kOsIos, |
| 633 | FEATURE_VALUE_TYPE(kModernTabStrip)}, |
Maria Kazinova | d4e2ed7 | 2020-09-22 17:40:50 | [diff] [blame] | 634 | {"autofill-use-renderer-ids", |
| 635 | flag_descriptions::kAutofillUseRendererIDsName, |
| 636 | flag_descriptions::kAutofillUseRendererIDsDescription, flags_ui::kOsIos, |
| 637 | FEATURE_VALUE_TYPE( |
| 638 | autofill::features::kAutofillUseUniqueRendererIDsOnIOS)}, |
Nohemi Fernandez | 70452749 | 2020-09-23 14:00:08 | [diff] [blame] | 639 | {"restore-gaia-cookies-if-deleted", |
| 640 | flag_descriptions::kRestoreGaiaCookiesIfDeletedName, |
| 641 | flag_descriptions::kRestoreGaiaCookiesIfDeletedDescription, |
| 642 | flags_ui::kOsIos, |
| 643 | FEATURE_VALUE_TYPE(signin::kRestoreGaiaCookiesIfDeleted)}, |
Nohemi Fernandez | 222d6d4 | 2020-09-30 20:35:57 | [diff] [blame] | 644 | {"minutes-delay-to-restore-gaia-cookies-if-deleted", |
| 645 | flag_descriptions::kDelayThresholdMinutesToUpdateGaiaCookieName, |
| 646 | flag_descriptions::kDelayThresholdMinutesToUpdateGaiaCookieDescription, |
| 647 | flags_ui::kOsIos, |
| 648 | MULTI_VALUE_TYPE(kDelayThresholdMinutesToUpdateGaiaCookieChoices)}, |
Viktor Semeniuk | d932ff5 | 2020-10-13 13:10:17 | [diff] [blame] | 649 | {"edit-passwords-in-settings", |
| 650 | flag_descriptions::kEditPasswordsInSettingsName, |
| 651 | flag_descriptions::kEditPasswordsInSettingsDescription, flags_ui::kOsIos, |
| 652 | FEATURE_VALUE_TYPE(password_manager::features::kEditPasswordsInSettings)}, |
Stepan Khapugin | ddb8596 | 2020-10-21 11:49:58 | [diff] [blame] | 653 | {"enable-incognito-authentication-ios", |
| 654 | flag_descriptions::kIncognitoAuthenticationName, |
| 655 | flag_descriptions::kIncognitoAuthenticationDescription, flags_ui::kOsIos, |
| 656 | FEATURE_VALUE_TYPE(kIncognitoAuthentication)}, |
Chris Lu | 36a2f97 | 2020-10-21 16:30:34 | [diff] [blame] | 657 | {"location-first-run-modal", flag_descriptions::kLocationFirstRunModalName, |
| 658 | flag_descriptions::kLocationFirstRunModalDescription, flags_ui::kOsIos, |
| 659 | FEATURE_VALUE_TYPE(kLocationFirstRunModal)}, |
| 660 | {"location-remove-first-run", |
| 661 | flag_descriptions::kLocationRemoveFirstRunPromptName, |
| 662 | flag_descriptions::kLocationRemoveFirstRunPromptDescription, |
| 663 | flags_ui::kOsIos, FEATURE_VALUE_TYPE(kLocationRemoveFirstRunPrompt)}, |
| 664 | {"location-change-string", flag_descriptions::kLocationStringChangeName, |
| 665 | flag_descriptions::kLocationStringChangeDescription, flags_ui::kOsIos, |
| 666 | FEATURE_VALUE_TYPE(kLocationStringChange)}, |
Gauthier Ambard | cb6a0ccc | 2020-10-30 13:12:00 | [diff] [blame] | 667 | {"web-view-native-context-menu", |
| 668 | flag_descriptions::kWebViewNativeContextMenuName, |
| 669 | flag_descriptions::kWebViewNativeContextMenuDescription, flags_ui::kOsIos, |
| 670 | FEATURE_VALUE_TYPE(web::features::kWebViewNativeContextMenu)}, |
Gauthier Ambard | e813c07f | 2020-01-09 10:18:49 | [diff] [blame] | 671 | }; |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 672 | |
Rohit Rao | bed794c | 2020-04-27 15:27:45 | [diff] [blame] | 673 | bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) { |
| 674 | return false; |
| 675 | } |
| 676 | |
| 677 | flags_ui::FlagsState& GetGlobalFlagsState() { |
| 678 | static base::NoDestructor<flags_ui::FlagsState> flags_state(kFeatureEntries, |
| 679 | nullptr); |
| 680 | return *flags_state; |
| 681 | } |
| 682 | } // namespace |
| 683 | |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 684 | // Add all switches from experimental flags to |command_line|. |
| 685 | void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { |
| 686 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
| 687 | |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 688 | // Set the UA flag if UseMobileSafariUA is enabled. |
| 689 | if ([defaults boolForKey:@"UseMobileSafariUA"]) { |
| 690 | // Safari uses "Vesion/", followed by the OS version excluding bugfix, where |
| 691 | // Chrome puts its product token. |
avi | 57194367 | 2015-12-22 02:12:49 | [diff] [blame] | 692 | int32_t major = 0; |
| 693 | int32_t minor = 0; |
| 694 | int32_t bugfix = 0; |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 695 | base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); |
| 696 | std::string product = base::StringPrintf("Version/%d.%d", major, minor); |
| 697 | |
Gauthier Ambard | ba163d4 | 2020-05-27 14:48:17 | [diff] [blame] | 698 | command_line->AppendSwitchASCII(switches::kUserAgent, |
| 699 | web::BuildMobileUserAgent(product)); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 700 | } |
| 701 | |
Guillaume Jenkins | 25e9bd7 | 2020-08-27 17:39:06 | [diff] [blame] | 702 | // Shared variables for all enterprise experimental flags. |
Guillaume Jenkins | 57606d7 | 2020-08-13 17:32:55 | [diff] [blame] | 703 | NSMutableDictionary* testing_policies = [[NSMutableDictionary alloc] init]; |
Guillaume Jenkins | 25e9bd7 | 2020-08-27 17:39:06 | [diff] [blame] | 704 | NSMutableArray* allowed_experimental_policies = [[NSMutableArray alloc] init]; |
Guillaume Jenkins | 57606d7 | 2020-08-13 17:32:55 | [diff] [blame] | 705 | |
Guillaume Jenkins | 25e9bd7 | 2020-08-27 17:39:06 | [diff] [blame] | 706 | // Set some sample policy values for testing if EnableSamplePolicies is set to |
| 707 | // true. |
Guillaume Jenkins | eeb7007c | 2020-06-25 22:55:40 | [diff] [blame] | 708 | if ([defaults boolForKey:@"EnableSamplePolicies"]) { |
Guillaume Jenkins | 25e9bd7 | 2020-08-27 17:39:06 | [diff] [blame] | 709 | // Some of the sample policies are still marked as experimental and must be |
| 710 | // explicitly allowed, otherwise they will be ignored in Beta and Stable. |
| 711 | [allowed_experimental_policies addObjectsFromArray:@[ |
Tina Wang | 59d0b7e | 2020-08-11 04:41:01 | [diff] [blame] | 712 | base::SysUTF8ToNSString(policy::key::kAutofillAddressEnabled), |
Sébastien Séguin-Gagnon | c107b1f | 2020-07-02 21:43:58 | [diff] [blame] | 713 | base::SysUTF8ToNSString(policy::key::kAutofillCreditCardEnabled), |
| 714 | base::SysUTF8ToNSString(policy::key::kChromeVariations), |
| 715 | base::SysUTF8ToNSString(policy::key::kDefaultPopupsSetting), |
Tina Wang | 5abee80 | 2020-07-29 23:09:52 | [diff] [blame] | 716 | base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderEnabled), |
| 717 | base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderName), |
| 718 | base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderSearchURL), |
Tina Wang | 89068c8 | 2020-10-29 15:51:50 | [diff] [blame] | 719 | base::SysUTF8ToNSString(policy::key::kEditBookmarksEnabled), |
Tina Wang | 59d0b7e | 2020-08-11 04:41:01 | [diff] [blame] | 720 | base::SysUTF8ToNSString(policy::key::kPasswordManagerEnabled), |
Tina Wang | 54dddfc2 | 2020-08-20 22:34:53 | [diff] [blame] | 721 | base::SysUTF8ToNSString(policy::key::kSafeBrowsingProtectionLevel), |
| 722 | base::SysUTF8ToNSString(policy::key::kSearchSuggestEnabled), |
Tina Wang | 59d0b7e | 2020-08-11 04:41:01 | [diff] [blame] | 723 | base::SysUTF8ToNSString(policy::key::kTranslateEnabled) |
Guillaume Jenkins | 25e9bd7 | 2020-08-27 17:39:06 | [diff] [blame] | 724 | ]]; |
Sébastien Séguin-Gagnon | c107b1f | 2020-07-02 21:43:58 | [diff] [blame] | 725 | |
| 726 | // Define sample policies to enable. |
Guillaume Jenkins | 57606d7 | 2020-08-13 17:32:55 | [diff] [blame] | 727 | [testing_policies addEntriesFromDictionary:@{ |
Tina Wang | 59d0b7e | 2020-08-11 04:41:01 | [diff] [blame] | 728 | base::SysUTF8ToNSString(policy::key::kAutofillAddressEnabled) : @NO, |
| 729 | |
Guillaume Jenkins | eeb7007c | 2020-06-25 22:55:40 | [diff] [blame] | 730 | base::SysUTF8ToNSString(policy::key::kAutofillCreditCardEnabled) : @NO, |
| 731 | |
| 732 | // 2 = Disable all variations |
| 733 | base::SysUTF8ToNSString(policy::key::kChromeVariations) : @2, |
| 734 | |
| 735 | // 2 = Do not allow any site to show popups |
| 736 | base::SysUTF8ToNSString(policy::key::kDefaultPopupsSetting) : @2, |
| 737 | |
Tina Wang | 5abee80 | 2020-07-29 23:09:52 | [diff] [blame] | 738 | // Set default search engine. |
| 739 | base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderEnabled) : |
| 740 | @YES, |
| 741 | base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderSearchURL) : |
| 742 | @"http://www.google.com/search?q={searchTerms}", |
| 743 | base::SysUTF8ToNSString(policy::key::kDefaultSearchProviderName) : |
Tina Wang | 7cd0a06 | 2020-09-15 21:31:02 | [diff] [blame] | 744 | @"TestEngine", |
Tina Wang | 5abee80 | 2020-07-29 23:09:52 | [diff] [blame] | 745 | |
Tina Wang | 89068c8 | 2020-10-29 15:51:50 | [diff] [blame] | 746 | base::SysUTF8ToNSString(policy::key::kEditBookmarksEnabled) : @NO, |
| 747 | |
Guillaume Jenkins | eeb7007c | 2020-06-25 22:55:40 | [diff] [blame] | 748 | base::SysUTF8ToNSString(policy::key::kPasswordManagerEnabled) : @NO, |
Tina Wang | 59d0b7e | 2020-08-11 04:41:01 | [diff] [blame] | 749 | |
| 750 | base::SysUTF8ToNSString(policy::key::kTranslateEnabled) : @NO, |
Tina Wang | 54dddfc2 | 2020-08-20 22:34:53 | [diff] [blame] | 751 | |
| 752 | // 2 = Enhanced safe browsing protection |
| 753 | base::SysUTF8ToNSString(policy::key::kSafeBrowsingProtectionLevel) : @2, |
| 754 | |
| 755 | base::SysUTF8ToNSString(policy::key::kSearchSuggestEnabled) : @YES, |
Guillaume Jenkins | 57606d7 | 2020-08-13 17:32:55 | [diff] [blame] | 756 | }]; |
| 757 | } |
| 758 | |
| 759 | // If a CBCM enrollment token is provided, force Chrome Browser Cloud |
Guillaume Jenkins | 25e9bd7 | 2020-08-27 17:39:06 | [diff] [blame] | 760 | // Management to enabled, add the token to the list of policies, and allow |
| 761 | // the CloudReportingEnabled experimental policy. |
Guillaume Jenkins | 57606d7 | 2020-08-13 17:32:55 | [diff] [blame] | 762 | NSString* token_key = |
| 763 | base::SysUTF8ToNSString(policy::key::kCloudManagementEnrollmentToken); |
| 764 | NSString* token = [defaults stringForKey:token_key]; |
| 765 | |
| 766 | if ([token length] > 0) { |
| 767 | command_line->AppendSwitch(switches::kEnableChromeBrowserCloudManagement); |
Guillaume Jenkins | 25e9bd7 | 2020-08-27 17:39:06 | [diff] [blame] | 768 | [allowed_experimental_policies |
| 769 | addObject:base::SysUTF8ToNSString(policy::key::kCloudReportingEnabled)]; |
Guillaume Jenkins | 57606d7 | 2020-08-13 17:32:55 | [diff] [blame] | 770 | [testing_policies setValue:token forKey:token_key]; |
| 771 | } |
| 772 | |
Guillaume Jenkins | 25e9bd7 | 2020-08-27 17:39:06 | [diff] [blame] | 773 | // If any experimental policy was allowed, set the EnableExperimentalPolicies |
| 774 | // policy. |
| 775 | if ([allowed_experimental_policies count] > 0) { |
| 776 | [testing_policies setValue:allowed_experimental_policies |
| 777 | forKey:base::SysUTF8ToNSString( |
| 778 | policy::key::kEnableExperimentalPolicies)]; |
| 779 | } |
| 780 | |
Guillaume Jenkins | 57606d7 | 2020-08-13 17:32:55 | [diff] [blame] | 781 | // If some policies were set, commit them to the app's registration defaults. |
| 782 | if ([testing_policies count] > 0) { |
Guillaume Jenkins | eeb7007c | 2020-06-25 22:55:40 | [diff] [blame] | 783 | NSDictionary* registration_defaults = |
| 784 | @{kPolicyLoaderIOSConfigurationKey : testing_policies}; |
| 785 | [defaults registerDefaults:registration_defaults]; |
| 786 | } |
| 787 | |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 788 | // Freeform commandline flags. These are added last, so that any flags added |
| 789 | // earlier in this function take precedence. |
| 790 | if ([defaults boolForKey:@"EnableFreeformCommandLineFlags"]) { |
| 791 | base::CommandLine::StringVector flags; |
| 792 | // Append an empty "program" argument. |
| 793 | flags.push_back(""); |
| 794 | |
| 795 | // The number of flags corresponds to the number of text fields in |
| 796 | // Experimental.plist. |
| 797 | const int kNumFreeformFlags = 5; |
| 798 | for (int i = 1; i <= kNumFreeformFlags; ++i) { |
| 799 | NSString* key = |
| 800 | [NSString stringWithFormat:@"FreeformCommandLineFlag%d", i]; |
| 801 | NSString* flag = [defaults stringForKey:key]; |
| 802 | if ([flag length]) { |
Robbie Gibson | c91ce62 | 2019-05-20 14:44:33 | [diff] [blame] | 803 | // iOS keyboard replaces -- with —, so undo that. |
| 804 | flag = [flag stringByReplacingOccurrencesOfString:@"—" |
| 805 | withString:@"--" |
| 806 | options:0 |
| 807 | range:NSMakeRange(0, 1)]; |
| 808 | // To make things easier, allow flags with no dashes by prepending them |
| 809 | // here. This also allows for flags that just have one dash if they |
| 810 | // exist. |
| 811 | if (![flag hasPrefix:@"-"]) { |
| 812 | flag = [@"--" stringByAppendingString:flag]; |
| 813 | } |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 814 | flags.push_back(base::SysNSStringToUTF8(flag)); |
| 815 | } |
| 816 | } |
| 817 | |
| 818 | base::CommandLine temp_command_line(flags); |
| 819 | command_line->AppendArguments(temp_command_line, false); |
| 820 | } |
msarda | fc76f66 | 2017-02-24 12:46:28 | [diff] [blame] | 821 | |
justincohen | dacc85d | 2017-06-28 23:34:10 | [diff] [blame] | 822 | // Populate command line flag for 3rd party keyboard omnibox workaround. |
| 823 | NSString* enableThirdPartyKeyboardWorkaround = |
| 824 | [defaults stringForKey:@"EnableThirdPartyKeyboardWorkaround"]; |
| 825 | if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Enabled"]) { |
| 826 | command_line->AppendSwitch(switches::kEnableThirdPartyKeyboardWorkaround); |
| 827 | } else if ([enableThirdPartyKeyboardWorkaround isEqualToString:@"Disabled"]) { |
| 828 | command_line->AppendSwitch(switches::kDisableThirdPartyKeyboardWorkaround); |
| 829 | } |
| 830 | |
msarda | fc76f66 | 2017-02-24 12:46:28 | [diff] [blame] | 831 | ios::GetChromeBrowserProvider()->AppendSwitchesFromExperimentalSettings( |
| 832 | defaults, command_line); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 833 | } |
| 834 | |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 835 | void ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage, |
| 836 | base::CommandLine* command_line) { |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 837 | GetGlobalFlagsState().ConvertFlagsToSwitches( |
sdefresne | c976390 | 2015-12-02 10:30:11 | [diff] [blame] | 838 | flags_storage, command_line, flags_ui::kAddSentinels, |
Gregory Chatzinoff | f652372 | 2017-11-21 01:33:53 | [diff] [blame] | 839 | switches::kEnableFeatures, switches::kDisableFeatures); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 840 | } |
| 841 | |
jkrcal | bf07337 | 2016-07-29 07:21:31 | [diff] [blame] | 842 | std::vector<std::string> RegisterAllFeatureVariationParameters( |
| 843 | flags_ui::FlagsStorage* flags_storage, |
| 844 | base::FeatureList* feature_list) { |
Justin Cohen | 2e2adb5 | 2019-10-25 17:00:02 | [diff] [blame] | 845 | // Occasionally DCHECK crashes on canary can be very distuptive. An |
| 846 | // experimental flag was added to aid in temporarily disabling this for |
| 847 | // canary testers. |
| 848 | #if defined(DCHECK_IS_CONFIGURABLE) |
| 849 | if (experimental_flags::AreDCHECKCrashesDisabled()) { |
| 850 | std::vector<base::FeatureList::FeatureOverrideInfo> overrides; |
| 851 | overrides.push_back( |
| 852 | {std::cref(base::kDCheckIsFatalFeature), |
| 853 | base::FeatureList::OverrideState::OVERRIDE_DISABLE_FEATURE}); |
| 854 | feature_list->RegisterExtraFeatureOverrides(std::move(overrides)); |
| 855 | } |
| 856 | #endif // defined(DCHECK_IS_CONFIGURABLE) |
| 857 | |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 858 | return GetGlobalFlagsState().RegisterAllFeatureVariationParameters( |
| 859 | flags_storage, feature_list); |
jkrcal | bf07337 | 2016-07-29 07:21:31 | [diff] [blame] | 860 | } |
| 861 | |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 862 | void GetFlagFeatureEntries(flags_ui::FlagsStorage* flags_storage, |
| 863 | flags_ui::FlagAccess access, |
| 864 | base::ListValue* supported_entries, |
| 865 | base::ListValue* unsupported_entries) { |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 866 | GetGlobalFlagsState().GetFlagFeatureEntries( |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 867 | flags_storage, access, supported_entries, unsupported_entries, |
| 868 | base::Bind(&SkipConditionalFeatureEntry)); |
| 869 | } |
| 870 | |
| 871 | void SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage, |
| 872 | const std::string& internal_name, |
| 873 | bool enable) { |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 874 | GetGlobalFlagsState().SetFeatureEntryEnabled(flags_storage, internal_name, |
| 875 | enable); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 876 | } |
| 877 | |
| 878 | void ResetAllFlags(flags_ui::FlagsStorage* flags_storage) { |
Sylvain Defresne | 8327a2f | 2019-01-17 14:19:18 | [diff] [blame] | 879 | GetGlobalFlagsState().ResetAllFlags(flags_storage); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 880 | } |
| 881 | |
| 882 | namespace testing { |
| 883 | |
| 884 | const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { |
kokihoon | 189a402 | 2018-10-13 02:43:44 | [diff] [blame] | 885 | *count = base::size(kFeatureEntries); |
sdefresne | 14900ee | 2015-11-27 14:43:21 | [diff] [blame] | 886 | return kFeatureEntries; |
| 887 | } |
| 888 | |
| 889 | } // namespace testing |