[email protected] | 9c66adc | 2012-01-05 02:10:16 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 5 | #include "chrome/browser/about_flags.h" |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 6 | |
| 7 | #include <algorithm> |
| 8 | #include <iterator> |
| 9 | #include <map> |
| 10 | #include <set> |
| 11 | |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 12 | #include "base/command_line.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 13 | #include "base/memory/singleton.h" |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 14 | #include "base/string_number_conversions.h" |
[email protected] | d208f4d8 | 2011-05-23 21:52:03 | [diff] [blame] | 15 | #include "base/utf_string_conversions.h" |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 16 | #include "base/values.h" |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 17 | #include "chrome/browser/prefs/pref_service.h" |
[email protected] | 1bc7842 | 2011-03-31 08:41:38 | [diff] [blame] | 18 | #include "chrome/browser/prefs/scoped_user_pref_update.h" |
[email protected] | d208f4d8 | 2011-05-23 21:52:03 | [diff] [blame] | 19 | #include "chrome/common/chrome_content_client.h" |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 20 | #include "chrome/common/chrome_switches.h" |
| 21 | #include "chrome/common/pref_names.h" |
[email protected] | 7f6f44c | 2011-12-14 13:23:38 | [diff] [blame] | 22 | #include "content/public/browser/user_metrics.h" |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 23 | #include "grit/generated_resources.h" |
[email protected] | e2e8e32 | 2012-09-12 04:37:02 | [diff] [blame] | 24 | #include "media/base/media_switches.h" |
[email protected] | 0bc6c27 | 2012-07-17 03:32:03 | [diff] [blame] | 25 | #include "ui/app_list/app_list_switches.h" |
[email protected] | c051a1b | 2011-01-21 23:30:17 | [diff] [blame] | 26 | #include "ui/base/l10n/l10n_util.h" |
[email protected] | c9c73ad4 | 2012-04-18 03:35:59 | [diff] [blame] | 27 | #include "ui/base/ui_base_switches.h" |
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 28 | #include "ui/gl/gl_switches.h" |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 29 | |
[email protected] | dc04be7c | 2012-03-15 23:57:49 | [diff] [blame] | 30 | #if defined(USE_ASH) |
[email protected] | b65bdda | 2011-12-23 23:35:31 | [diff] [blame] | 31 | #include "ash/ash_switches.h" |
[email protected] | dc04be7c | 2012-03-15 23:57:49 | [diff] [blame] | 32 | #endif |
| 33 | |
| 34 | #if defined(USE_AURA) |
[email protected] | 308aaa3 | 2012-03-12 13:14:50 | [diff] [blame] | 35 | #include "ui/aura/aura_switches.h" |
[email protected] | 8cc10df | 2011-11-03 23:57:50 | [diff] [blame] | 36 | #endif |
| 37 | |
[email protected] | 7f6f44c | 2011-12-14 13:23:38 | [diff] [blame] | 38 | using content::UserMetricsAction; |
| 39 | |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 40 | namespace about_flags { |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 41 | |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 42 | // Macros to simplify specifying the type. |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 43 | #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ |
| 44 | Experiment::SINGLE_VALUE, command_line_switch, switch_value, NULL, 0 |
| 45 | #define SINGLE_VALUE_TYPE(command_line_switch) \ |
| 46 | SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") |
| 47 | #define MULTI_VALUE_TYPE(choices) \ |
[email protected] | 0e6f56d | 2011-02-12 23:45:15 | [diff] [blame] | 48 | Experiment::MULTI_VALUE, "", "", choices, arraysize(choices) |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 49 | |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 50 | namespace { |
| 51 | |
[email protected] | 9c7453d | 2012-01-21 00:45:40 | [diff] [blame] | 52 | const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS | kOsAndroid; |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 53 | |
[email protected] | cc3e205 | 2011-12-20 01:01:40 | [diff] [blame] | 54 | // Adds a |StringValue| to |list| for each platform where |bitmask| indicates |
| 55 | // whether the experiment is available on that platform. |
| 56 | void AddOsStrings(unsigned bitmask, ListValue* list) { |
| 57 | struct { |
| 58 | unsigned bit; |
| 59 | const char* const name; |
| 60 | } kBitsToOs[] = { |
| 61 | {kOsMac, "Mac"}, |
| 62 | {kOsWin, "Windows"}, |
| 63 | {kOsLinux, "Linux"}, |
| 64 | {kOsCrOS, "Chrome OS"}, |
| 65 | }; |
| 66 | for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kBitsToOs); ++i) |
| 67 | if (bitmask & kBitsToOs[i].bit) |
| 68 | list->Append(new StringValue(kBitsToOs[i].name)); |
| 69 | } |
| 70 | |
[email protected] | ba816424 | 2010-11-16 21:31:00 | [diff] [blame] | 71 | // Names for former Chrome OS Labs experiments, shared with prefs migration |
| 72 | // code. |
| 73 | const char kMediaPlayerExperimentName[] = "media-player"; |
| 74 | const char kAdvancedFileSystemExperimentName[] = "advanced-file-system"; |
| 75 | const char kVerticalTabsExperimentName[] = "vertical-tabs"; |
| 76 | |
[email protected] | 6831780 | 2012-06-07 19:13:23 | [diff] [blame] | 77 | const Experiment::Choice kOmniboxHistoryQuickProviderNewScoringChoices[] = { |
| 78 | { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_AUTOMATIC, "", "" }, |
| 79 | { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_ENABLED, |
| 80 | switches::kOmniboxHistoryQuickProviderNewScoring, |
| 81 | switches::kOmniboxHistoryQuickProviderNewScoringEnabled }, |
| 82 | { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_DISABLED, |
| 83 | switches::kOmniboxHistoryQuickProviderNewScoring, |
| 84 | switches::kOmniboxHistoryQuickProviderNewScoringDisabled } |
| 85 | }; |
| 86 | |
[email protected] | 128dc6c | 2012-06-22 20:30:35 | [diff] [blame] | 87 | const Experiment::Choice |
| 88 | kOmniboxHistoryQuickProviderReorderForInliningChoices[] = { |
| 89 | { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_AUTOMATIC, |
| 90 | "", |
| 91 | "" }, |
| 92 | { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_ENABLED, |
| 93 | switches::kOmniboxHistoryQuickProviderReorderForInlining, |
| 94 | switches::kOmniboxHistoryQuickProviderReorderForInliningEnabled }, |
| 95 | { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_DISABLED, |
| 96 | switches::kOmniboxHistoryQuickProviderReorderForInlining, |
| 97 | switches::kOmniboxHistoryQuickProviderReorderForInliningDisabled } |
| 98 | }; |
| 99 | |
[email protected] | 032d5e6c | 2012-02-17 17:53:55 | [diff] [blame] | 100 | const Experiment::Choice kOmniboxInlineHistoryQuickProviderChoices[] = { |
| 101 | { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_AUTOMATIC, "", "" }, |
| 102 | { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_ALLOWED, |
| 103 | switches::kOmniboxInlineHistoryQuickProvider, |
| 104 | switches::kOmniboxInlineHistoryQuickProviderAllowed }, |
| 105 | { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_PROHIBITED, |
| 106 | switches::kOmniboxInlineHistoryQuickProvider, |
| 107 | switches::kOmniboxInlineHistoryQuickProviderProhibited } |
| 108 | }; |
| 109 | |
[email protected] | de02376 | 2012-07-26 17:10:17 | [diff] [blame] | 110 | const Experiment::Choice kFixedPositionCreatesStackingContextChoices[] = { |
| 111 | { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
| 112 | { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, |
| 113 | switches::kEnableFixedPositionCreatesStackingContext, ""}, |
| 114 | { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
| 115 | switches::kDisableFixedPositionCreatesStackingContext, ""} |
| 116 | }; |
| 117 | |
[email protected] | 9b19cf8 | 2012-06-13 06:23:23 | [diff] [blame] | 118 | const Experiment::Choice kForceCompositingModeChoices[] = { |
[email protected] | a45c6940 | 2012-06-24 16:32:20 | [diff] [blame] | 119 | { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
| 120 | { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, |
[email protected] | 9b19cf8 | 2012-06-13 06:23:23 | [diff] [blame] | 121 | switches::kForceCompositingMode, ""}, |
[email protected] | a45c6940 | 2012-06-24 16:32:20 | [diff] [blame] | 122 | { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
[email protected] | 9b19cf8 | 2012-06-13 06:23:23 | [diff] [blame] | 123 | switches::kDisableForceCompositingMode, ""} |
| 124 | }; |
| 125 | |
[email protected] | 72787e39 | 2012-03-23 05:55:43 | [diff] [blame] | 126 | const Experiment::Choice kThreadedCompositingModeChoices[] = { |
[email protected] | a45c6940 | 2012-06-24 16:32:20 | [diff] [blame] | 127 | { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
| 128 | { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
[email protected] | 72787e39 | 2012-03-23 05:55:43 | [diff] [blame] | 129 | switches::kDisableThreadedCompositing, ""}, |
[email protected] | a45c6940 | 2012-06-24 16:32:20 | [diff] [blame] | 130 | { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, |
[email protected] | 72787e39 | 2012-03-23 05:55:43 | [diff] [blame] | 131 | switches::kEnableThreadedCompositing, ""} |
| 132 | }; |
| 133 | |
[email protected] | 347a0c7 | 2012-05-14 20:28:06 | [diff] [blame] | 134 | const Experiment::Choice kTouchOptimizedUIChoices[] = { |
| 135 | { IDS_FLAGS_TOUCH_OPTIMIZED_UI_AUTOMATIC, "", "" }, |
[email protected] | a45c6940 | 2012-06-24 16:32:20 | [diff] [blame] | 136 | { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, |
[email protected] | 347a0c7 | 2012-05-14 20:28:06 | [diff] [blame] | 137 | switches::kTouchOptimizedUI, |
| 138 | switches::kTouchOptimizedUIEnabled }, |
[email protected] | a45c6940 | 2012-06-24 16:32:20 | [diff] [blame] | 139 | { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
[email protected] | 347a0c7 | 2012-05-14 20:28:06 | [diff] [blame] | 140 | switches::kTouchOptimizedUI, |
| 141 | switches::kTouchOptimizedUIDisabled } |
| 142 | }; |
| 143 | |
[email protected] | 026876f3 | 2012-08-22 23:53:40 | [diff] [blame] | 144 | const Experiment::Choice kAsyncDnsChoices[] = { |
| 145 | { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
| 146 | { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
| 147 | switches::kDisableAsyncDns, ""}, |
| 148 | { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, |
| 149 | switches::kEnableAsyncDns, ""} |
| 150 | }; |
| 151 | |
[email protected] | ea2f334 | 2012-09-21 21:13:36 | [diff] [blame^] | 152 | #if defined(OS_CHROMEOS) |
| 153 | const Experiment::Choice kAshBootAnimationFunction[] = { |
| 154 | { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
| 155 | { IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION2, |
| 156 | ash::switches::kAshBootAnimationFunction2, ""}, |
| 157 | { IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION3, |
| 158 | ash::switches::kAshBootAnimationFunction3, ""} |
| 159 | }; |
| 160 | #endif |
| 161 | |
[email protected] | 347a0c7 | 2012-05-14 20:28:06 | [diff] [blame] | 162 | |
[email protected] | 4bc5050c | 2010-11-18 17:55:54 | [diff] [blame] | 163 | // RECORDING USER METRICS FOR FLAGS: |
| 164 | // ----------------------------------------------------------------------------- |
| 165 | // The first line of the experiment is the internal name. If you'd like to |
| 166 | // gather statistics about the usage of your flag, you should append a marker |
| 167 | // comment to the end of the feature name, like so: |
| 168 | // "my-special-feature", // FLAGS:RECORD_UMA |
| 169 | // |
| 170 | // After doing that, run //chrome/tools/extract_actions.py (see instructions at |
| 171 | // the top of that file for details) to update the chromeactions.txt file, which |
| 172 | // will enable UMA to record your feature flag. |
| 173 | // |
| 174 | // After your feature has shipped under a flag, you can locate the metrics |
| 175 | // under the action name AboutFlags_internal-action-name. Actions are recorded |
| 176 | // once per startup, so you should divide this number by AboutFlags_StartupTick |
| 177 | // to get a sense of usage. Note that this will not be the same as number of |
| 178 | // users with a given feature enabled because users can quit and relaunch |
| 179 | // the application multiple times over a given time interval. |
| 180 | // TODO(rsesek): See if there's a way to count per-user, rather than |
| 181 | // per-startup. |
| 182 | |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 183 | // To add a new experiment add to the end of kExperiments. There are two |
| 184 | // distinct types of experiments: |
| 185 | // . SINGLE_VALUE: experiment is either on or off. Use the SINGLE_VALUE_TYPE |
| 186 | // macro for this type supplying the command line to the macro. |
[email protected] | 28e35af | 2011-02-09 12:56:22 | [diff] [blame] | 187 | // . MULTI_VALUE: a list of choices, the first of which should correspond to a |
| 188 | // deactivated state for this lab (i.e. no command line option). To specify |
| 189 | // this type of experiment use the macro MULTI_VALUE_TYPE supplying it the |
| 190 | // array of choices. |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 191 | // See the documentation of Experiment for details on the fields. |
| 192 | // |
| 193 | // When adding a new choice, add it to the end of the list. |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 194 | const Experiment kExperiments[] = { |
| 195 | { |
[email protected] | aac169d | 2011-03-18 19:53:03 | [diff] [blame] | 196 | "expose-for-tabs", // FLAGS:RECORD_UMA |
| 197 | IDS_FLAGS_TABPOSE_NAME, |
| 198 | IDS_FLAGS_TABPOSE_DESCRIPTION, |
| 199 | kOsMac, |
| 200 | #if defined(OS_MACOSX) |
| 201 | // The switch exists only on OS X. |
| 202 | SINGLE_VALUE_TYPE(switches::kEnableExposeForTabs) |
| 203 | #else |
| 204 | SINGLE_VALUE_TYPE("") |
| 205 | #endif |
| 206 | }, |
| 207 | { |
[email protected] | 4bc5050c | 2010-11-18 17:55:54 | [diff] [blame] | 208 | "conflicting-modules-check", // FLAGS:RECORD_UMA |
[email protected] | c1bbaa8 | 2010-11-08 11:17:05 | [diff] [blame] | 209 | IDS_FLAGS_CONFLICTS_CHECK_NAME, |
| 210 | IDS_FLAGS_CONFLICTS_CHECK_DESCRIPTION, |
| 211 | kOsWin, |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 212 | SINGLE_VALUE_TYPE(switches::kConflictingModulesCheck) |
[email protected] | c1bbaa8 | 2010-11-08 11:17:05 | [diff] [blame] | 213 | }, |
| 214 | { |
[email protected] | 4bc5050c | 2010-11-18 17:55:54 | [diff] [blame] | 215 | "cloud-print-proxy", // FLAGS:RECORD_UMA |
[email protected] | dae7325b | 2011-12-21 20:56:54 | [diff] [blame] | 216 | IDS_FLAGS_CLOUD_PRINT_CONNECTOR_NAME, |
| 217 | IDS_FLAGS_CLOUD_PRINT_CONNECTOR_DESCRIPTION, |
[email protected] | 9f8872b3 | 2011-03-04 19:44:45 | [diff] [blame] | 218 | // For a Chrome build, we know we have a PDF plug-in on Windows, so it's |
[email protected] | 4fa24bf | 2011-08-20 02:15:22 | [diff] [blame] | 219 | // fully enabled. |
[email protected] | 5d10d57d | 2011-07-22 22:16:31 | [diff] [blame] | 220 | // Otherwise, where we know Windows could be working if a viable PDF |
[email protected] | 4fa24bf | 2011-08-20 02:15:22 | [diff] [blame] | 221 | // plug-in could be supplied, we'll keep the lab enabled. Mac and Linux |
| 222 | // always have PDF rasterization available, so no flag needed there. |
| 223 | #if !defined(GOOGLE_CHROME_BUILD) |
| 224 | kOsWin, |
| 225 | #else |
| 226 | 0, |
[email protected] | fa6d2a2f | 2010-11-30 21:47:19 | [diff] [blame] | 227 | #endif |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 228 | SINGLE_VALUE_TYPE(switches::kEnableCloudPrintProxy) |
[email protected] | 8b6588a | 2010-10-12 02:39:42 | [diff] [blame] | 229 | }, |
[email protected] | 60d77bd | 2012-08-22 00:10:07 | [diff] [blame] | 230 | #if defined(OS_WIN) |
| 231 | { |
| 232 | "print-raster", |
| 233 | IDS_FLAGS_PRINT_RASTER_NAME, |
| 234 | IDS_FLAGS_PRINT_RASTER_DESCRIPTION, |
| 235 | kOsWin, |
| 236 | SINGLE_VALUE_TYPE(switches::kPrintRaster) |
| 237 | }, |
| 238 | #endif // OS_WIN |
[email protected] | 0209b44 | 2012-07-18 00:38:05 | [diff] [blame] | 239 | { |
[email protected] | bb46153 | 2010-11-26 21:50:23 | [diff] [blame] | 240 | "crxless-web-apps", |
| 241 | IDS_FLAGS_CRXLESS_WEB_APPS_NAME, |
| 242 | IDS_FLAGS_CRXLESS_WEB_APPS_DESCRIPTION, |
| 243 | kOsAll, |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 244 | SINGLE_VALUE_TYPE(switches::kEnableCrxlessWebApps) |
[email protected] | bb46153 | 2010-11-26 21:50:23 | [diff] [blame] | 245 | }, |
| 246 | { |
[email protected] | 96c6f4c | 2011-05-18 19:36:22 | [diff] [blame] | 247 | "ignore-gpu-blacklist", |
| 248 | IDS_FLAGS_IGNORE_GPU_BLACKLIST_NAME, |
| 249 | IDS_FLAGS_IGNORE_GPU_BLACKLIST_DESCRIPTION, |
| 250 | kOsAll, |
| 251 | SINGLE_VALUE_TYPE(switches::kIgnoreGpuBlacklist) |
| 252 | }, |
| 253 | { |
[email protected] | 0110cf11 | 2011-07-02 00:39:43 | [diff] [blame] | 254 | "force-compositing-mode-2", |
[email protected] | 96c6f4c | 2011-05-18 19:36:22 | [diff] [blame] | 255 | IDS_FLAGS_FORCE_COMPOSITING_MODE_NAME, |
| 256 | IDS_FLAGS_FORCE_COMPOSITING_MODE_DESCRIPTION, |
[email protected] | 9b19cf8 | 2012-06-13 06:23:23 | [diff] [blame] | 257 | kOsMac | kOsWin | kOsLinux, |
| 258 | MULTI_VALUE_TYPE(kForceCompositingModeChoices) |
[email protected] | 96c6f4c | 2011-05-18 19:36:22 | [diff] [blame] | 259 | }, |
| 260 | { |
[email protected] | 72787e39 | 2012-03-23 05:55:43 | [diff] [blame] | 261 | "threaded-compositing-mode", |
| 262 | IDS_FLAGS_THREADED_COMPOSITING_MODE_NAME, |
| 263 | IDS_FLAGS_THREADED_COMPOSITING_MODE_DESCRIPTION, |
[email protected] | 644a107 | 2012-03-16 09:29:59 | [diff] [blame] | 264 | kOsAll, |
[email protected] | 72787e39 | 2012-03-23 05:55:43 | [diff] [blame] | 265 | MULTI_VALUE_TYPE(kThreadedCompositingModeChoices) |
[email protected] | 644a107 | 2012-03-16 09:29:59 | [diff] [blame] | 266 | }, |
| 267 | { |
[email protected] | 81c64af6 | 2012-06-06 20:15:52 | [diff] [blame] | 268 | "disable-accelerated-2d-canvas", |
| 269 | IDS_FLAGS_DISABLE_ACCELERATED_2D_CANVAS_NAME, |
| 270 | IDS_FLAGS_DISABLE_ACCELERATED_2D_CANVAS_DESCRIPTION, |
| 271 | kOsAll, |
| 272 | SINGLE_VALUE_TYPE(switches::kDisableAccelerated2dCanvas) |
| 273 | }, |
| 274 | { |
[email protected] | 69cffc8 | 2012-08-10 13:27:27 | [diff] [blame] | 275 | "disable-deferred-2d-canvas", |
| 276 | IDS_FLAGS_DISABLE_DEFERRED_2D_CANVAS_NAME, |
| 277 | IDS_FLAGS_DISABLE_DEFERRED_2D_CANVAS_DESCRIPTION, |
| 278 | kOsAll, |
| 279 | SINGLE_VALUE_TYPE(switches::kDisableDeferred2dCanvas) |
| 280 | }, |
| 281 | { |
[email protected] | efcde13 | 2012-05-30 01:05:18 | [diff] [blame] | 282 | "disable-threaded-animation", |
| 283 | IDS_FLAGS_DISABLE_THREADED_ANIMATION_NAME, |
| 284 | IDS_FLAGS_DISABLE_THREADED_ANIMATION_DESCRIPTION, |
[email protected] | 644a107 | 2012-03-16 09:29:59 | [diff] [blame] | 285 | kOsAll, |
[email protected] | efcde13 | 2012-05-30 01:05:18 | [diff] [blame] | 286 | SINGLE_VALUE_TYPE(switches::kDisableThreadedAnimation) |
[email protected] | 644a107 | 2012-03-16 09:29:59 | [diff] [blame] | 287 | }, |
| 288 | { |
[email protected] | 5963b77 | 2011-02-09 22:55:38 | [diff] [blame] | 289 | "composited-layer-borders", |
| 290 | IDS_FLAGS_COMPOSITED_LAYER_BORDERS, |
| 291 | IDS_FLAGS_COMPOSITED_LAYER_BORDERS_DESCRIPTION, |
| 292 | kOsAll, |
| 293 | SINGLE_VALUE_TYPE(switches::kShowCompositedLayerBorders) |
| 294 | }, |
| 295 | { |
[email protected] | a8f1eaa | 2011-03-07 19:00:58 | [diff] [blame] | 296 | "show-fps-counter", |
| 297 | IDS_FLAGS_SHOW_FPS_COUNTER, |
| 298 | IDS_FLAGS_SHOW_FPS_COUNTER_DESCRIPTION, |
| 299 | kOsAll, |
| 300 | SINGLE_VALUE_TYPE(switches::kShowFPSCounter) |
| 301 | }, |
[email protected] | 8ff7f34 | 2011-05-25 01:49:47 | [diff] [blame] | 302 | { |
[email protected] | 70c98a33 | 2011-12-21 20:51:52 | [diff] [blame] | 303 | "accelerated-filters", |
| 304 | IDS_FLAGS_ACCELERATED_FILTERS, |
| 305 | IDS_FLAGS_ACCELERATED_FILTERS_DESCRIPTION, |
| 306 | kOsAll, |
| 307 | SINGLE_VALUE_TYPE(switches::kEnableAcceleratedFilters) |
| 308 | }, |
| 309 | { |
[email protected] | 8ff7f34 | 2011-05-25 01:49:47 | [diff] [blame] | 310 | "disable-gpu-vsync", |
| 311 | IDS_FLAGS_DISABLE_GPU_VSYNC_NAME, |
| 312 | IDS_FLAGS_DISABLE_GPU_VSYNC_DESCRIPTION, |
| 313 | kOsAll, |
| 314 | SINGLE_VALUE_TYPE(switches::kDisableGpuVsync) |
| 315 | }, |
[email protected] | deaba6d5 | 2011-09-23 14:47:12 | [diff] [blame] | 316 | { |
| 317 | "disable-webgl", |
| 318 | IDS_FLAGS_DISABLE_WEBGL_NAME, |
| 319 | IDS_FLAGS_DISABLE_WEBGL_DESCRIPTION, |
| 320 | kOsAll, |
| 321 | SINGLE_VALUE_TYPE(switches::kDisableExperimentalWebGL) |
| 322 | }, |
[email protected] | 09096e0 | 2012-05-24 11:12:04 | [diff] [blame] | 323 | { |
[email protected] | 96bcdc10 | 2012-05-24 23:42:10 | [diff] [blame] | 324 | "fixed-position-creates-stacking-context", |
| 325 | IDS_FLAGS_FIXED_POSITION_CREATES_STACKING_CONTEXT_NAME, |
| 326 | IDS_FLAGS_FIXED_POSITION_CREATES_STACKING_CONTEXT_DESCRIPTION, |
| 327 | kOsAll, |
[email protected] | de02376 | 2012-07-26 17:10:17 | [diff] [blame] | 328 | MULTI_VALUE_TYPE(kFixedPositionCreatesStackingContextChoices) |
[email protected] | 96bcdc10 | 2012-05-24 23:42:10 | [diff] [blame] | 329 | }, |
[email protected] | d208f4d8 | 2011-05-23 21:52:03 | [diff] [blame] | 330 | // TODO(dspringer): When NaCl is on by default, remove this flag entry. |
[email protected] | 2fe15fcb | 2010-10-21 20:39:53 | [diff] [blame] | 331 | { |
[email protected] | e3791ce9 | 2011-08-09 01:03:32 | [diff] [blame] | 332 | "enable-nacl", // FLAGS:RECORD_UMA |
[email protected] | 4ff87d20 | 2010-11-06 01:28:40 | [diff] [blame] | 333 | IDS_FLAGS_ENABLE_NACL_NAME, |
| 334 | IDS_FLAGS_ENABLE_NACL_DESCRIPTION, |
| 335 | kOsAll, |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 336 | SINGLE_VALUE_TYPE(switches::kEnableNaCl) |
[email protected] | 4ff87d20 | 2010-11-06 01:28:40 | [diff] [blame] | 337 | }, |
[email protected] | b39c6d9 | 2012-01-31 16:38:41 | [diff] [blame] | 338 | // TODO(halyavin): When exception handling is on by default, replace this |
| 339 | // flag with disable-nacl-exception-handling. |
| 340 | { |
| 341 | "enable-nacl-exception-handling", // FLAGS:RECORD_UMA |
| 342 | IDS_FLAGS_ENABLE_NACL_EXCEPTION_HANDLING_NAME, |
| 343 | IDS_FLAGS_ENABLE_NACL_EXCEPTION_HANDLING_DESCRIPTION, |
[email protected] | bf2c61b | 2012-08-30 16:37:04 | [diff] [blame] | 344 | kOsAll, |
[email protected] | b39c6d9 | 2012-01-31 16:38:41 | [diff] [blame] | 345 | SINGLE_VALUE_TYPE(switches::kEnableNaClExceptionHandling) |
| 346 | }, |
[email protected] | 4ff87d20 | 2010-11-06 01:28:40 | [diff] [blame] | 347 | { |
[email protected] | 9addd1c | 2012-09-15 14:28:24 | [diff] [blame] | 348 | "enable-nacl-debug", // FLAGS:RECORD_UMA |
| 349 | IDS_FLAGS_ENABLE_NACL_DEBUG_NAME, |
| 350 | IDS_FLAGS_ENABLE_NACL_DEBUG_DESCRIPTION, |
[email protected] | 401b9079 | 2012-05-30 11:41:13 | [diff] [blame] | 351 | kOsAll, |
[email protected] | 9addd1c | 2012-09-15 14:28:24 | [diff] [blame] | 352 | SINGLE_VALUE_TYPE(switches::kEnableNaClDebug) |
[email protected] | 401b9079 | 2012-05-30 11:41:13 | [diff] [blame] | 353 | }, |
| 354 | { |
[email protected] | 7babd1c | 2012-08-08 20:35:29 | [diff] [blame] | 355 | "enable-pnacl", // FLAGS:RECORD_UMA |
| 356 | IDS_FLAGS_ENABLE_PNACL_NAME, |
| 357 | IDS_FLAGS_ENABLE_PNACL_DESCRIPTION, |
| 358 | kOsAll, |
| 359 | SINGLE_VALUE_TYPE(switches::kEnablePnacl) |
| 360 | }, |
| 361 | { |
[email protected] | d3a8cfc | 2012-09-14 18:31:38 | [diff] [blame] | 362 | "enable-scripted-speech", // FLAGS:RECORD_UMA |
| 363 | IDS_FLAGS_ENABLE_SCRIPTED_SPEECH_NAME, |
| 364 | IDS_FLAGS_ENABLE_SCRIPTED_SPEECH_DESCRIPTION, |
| 365 | kOsAll, |
| 366 | SINGLE_VALUE_TYPE(switches::kEnableScriptedSpeech) |
| 367 | }, |
| 368 | { |
[email protected] | 4bc5050c | 2010-11-18 17:55:54 | [diff] [blame] | 369 | "extension-apis", // FLAGS:RECORD_UMA |
[email protected] | 11dd68cd5 | 2010-11-12 01:15:32 | [diff] [blame] | 370 | IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_NAME, |
| 371 | IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_DESCRIPTION, |
| 372 | kOsAll, |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 373 | SINGLE_VALUE_TYPE(switches::kEnableExperimentalExtensionApis) |
[email protected] | 11dd68cd5 | 2010-11-12 01:15:32 | [diff] [blame] | 374 | }, |
[email protected] | 3627b06d | 2010-11-12 16:36:16 | [diff] [blame] | 375 | { |
[email protected] | 895e366 | 2012-09-20 21:36:21 | [diff] [blame] | 376 | "disable-action-box", |
[email protected] | cab18ef | 2012-04-27 07:22:03 | [diff] [blame] | 377 | IDS_FLAGS_ACTION_BOX_NAME, |
| 378 | IDS_FLAGS_ACTION_BOX_DESCRIPTION, |
| 379 | kOsAll, |
[email protected] | 895e366 | 2012-09-20 21:36:21 | [diff] [blame] | 380 | SINGLE_VALUE_TYPE(switches::kDisableActionBox), |
[email protected] | cab18ef | 2012-04-27 07:22:03 | [diff] [blame] | 381 | }, |
| 382 | { |
[email protected] | 3a36243 | 2012-06-18 20:39:51 | [diff] [blame] | 383 | "script-badges", |
| 384 | IDS_FLAGS_SCRIPT_BADGES_NAME, |
| 385 | IDS_FLAGS_SCRIPT_BADGES_DESCRIPTION, |
| 386 | kOsAll, |
| 387 | SINGLE_VALUE_TYPE(switches::kEnableScriptBadges), |
| 388 | }, |
| 389 | { |
[email protected] | cbe224d | 2011-08-04 22:12:49 | [diff] [blame] | 390 | "apps-new-install-bubble", |
| 391 | IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_NAME, |
| 392 | IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_DESCRIPTION, |
| 393 | kOsAll, |
| 394 | SINGLE_VALUE_TYPE(switches::kAppsNewInstallBubble) |
| 395 | }, |
| 396 | { |
[email protected] | 80bd24e | 2010-11-30 09:34:38 | [diff] [blame] | 397 | "disable-hyperlink-auditing", |
| 398 | IDS_FLAGS_DISABLE_HYPERLINK_AUDITING_NAME, |
| 399 | IDS_FLAGS_DISABLE_HYPERLINK_AUDITING_DESCRIPTION, |
| 400 | kOsAll, |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 401 | SINGLE_VALUE_TYPE(switches::kNoPings) |
[email protected] | feb28fef | 2010-12-01 10:52:51 | [diff] [blame] | 402 | }, |
| 403 | { |
| 404 | "experimental-location-features", // FLAGS:RECORD_UMA |
| 405 | IDS_FLAGS_EXPERIMENTAL_LOCATION_FEATURES_NAME, |
| 406 | IDS_FLAGS_EXPERIMENTAL_LOCATION_FEATURES_DESCRIPTION, |
| 407 | kOsMac | kOsWin | kOsLinux, // Currently does nothing on CrOS. |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 408 | SINGLE_VALUE_TYPE(switches::kExperimentalLocationFeatures) |
| 409 | }, |
| 410 | { |
[email protected] | 5aea186 | 2011-03-23 23:55:39 | [diff] [blame] | 411 | "tab-groups-context-menu", |
| 412 | IDS_FLAGS_TAB_GROUPS_CONTEXT_MENU_NAME, |
| 413 | IDS_FLAGS_TAB_GROUPS_CONTEXT_MENU_DESCRIPTION, |
| 414 | kOsWin, |
| 415 | SINGLE_VALUE_TYPE(switches::kEnableTabGroupsContextMenu) |
| 416 | }, |
[email protected] | c94cebd | 2012-06-21 00:55:28 | [diff] [blame] | 417 | #if defined(OS_CHROMEOS) |
| 418 | { |
| 419 | "enable-instant-extended-api", |
| 420 | IDS_FLAGS_ENABLE_INSTANT_EXTENDED_API, |
| 421 | IDS_FLAGS_ENABLE_INSTANT_EXTENDED_API_DESCRIPTION, |
| 422 | kOsAll, |
| 423 | SINGLE_VALUE_TYPE(switches::kEnableInstantExtendedAPI) |
| 424 | }, |
| 425 | #endif |
[email protected] | e9bf9d9 | 2011-03-31 20:57:15 | [diff] [blame] | 426 | { |
[email protected] | 354e33b | 2011-06-15 00:29:10 | [diff] [blame] | 427 | "static-ip-config", |
| 428 | IDS_FLAGS_STATIC_IP_CONFIG_NAME, |
| 429 | IDS_FLAGS_STATIC_IP_CONFIG_DESCRIPTION, |
| 430 | kOsCrOS, |
| 431 | #if defined(OS_CHROMEOS) |
| 432 | // This switch exists only on Chrome OS. |
| 433 | SINGLE_VALUE_TYPE(switches::kEnableStaticIPConfig) |
| 434 | #else |
| 435 | SINGLE_VALUE_TYPE("") |
| 436 | #endif |
| 437 | }, |
[email protected] | 3eb5728c | 2011-06-20 22:32:24 | [diff] [blame] | 438 | { |
| 439 | "show-autofill-type-predictions", |
| 440 | IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_NAME, |
| 441 | IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_DESCRIPTION, |
| 442 | kOsAll, |
| 443 | SINGLE_VALUE_TYPE(switches::kShowAutofillTypePredictions) |
| 444 | }, |
[email protected] | bff4d3e | 2011-06-21 23:58:52 | [diff] [blame] | 445 | { |
[email protected] | fdf4e25 | 2012-04-27 00:26:55 | [diff] [blame] | 446 | "sync-tab-favicons", |
| 447 | IDS_FLAGS_SYNC_TAB_FAVICONS_NAME, |
| 448 | IDS_FLAGS_SYNC_TAB_FAVICONS_DESCRIPTION, |
| 449 | kOsAll, |
| 450 | SINGLE_VALUE_TYPE(switches::kSyncTabFavicons) |
| 451 | }, |
| 452 | { |
[email protected] | aae9eeb1 | 2011-10-21 21:59:26 | [diff] [blame] | 453 | "sync-app-notifications", |
| 454 | IDS_FLAGS_SYNC_APP_NOTIFICATIONS_NAME, |
| 455 | IDS_FLAGS_SYNC_APP_NOTIFICATIONS_DESCRIPTION, |
| 456 | kOsAll, |
[email protected] | 0b6fba8 | 2011-11-18 01:31:11 | [diff] [blame] | 457 | SINGLE_VALUE_TYPE(switches::kDisableSyncAppNotifications) |
[email protected] | aae9eeb1 | 2011-10-21 21:59:26 | [diff] [blame] | 458 | }, |
| 459 | { |
[email protected] | e755a38 | 2012-09-13 17:16:35 | [diff] [blame] | 460 | "enable-gesture-tap-highlight", |
| 461 | IDS_FLAGS_ENABLE_GESTURE_TAP_HIGHLIGHTING_NAME, |
| 462 | IDS_FLAGS_ENABLE_GESTURE_TAP_HIGHLIGHTING_DESCRIPTION, |
| 463 | kOsLinux | kOsCrOS, |
| 464 | SINGLE_VALUE_TYPE(switches::kEnableGestureTapHighlight) |
| 465 | }, |
| 466 | { |
[email protected] | a22ebd81 | 2011-06-23 00:05:39 | [diff] [blame] | 467 | "enable-smooth-scrolling", // FLAGS:RECORD_UMA |
| 468 | IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_NAME, |
| 469 | IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_DESCRIPTION, |
| 470 | // Can't expose the switch unless the code is compiled in. |
[email protected] | 554b706 | 2011-09-03 03:09:40 | [diff] [blame] | 471 | // On by default for the Mac (different implementation in WebKit). |
[email protected] | 554b706 | 2011-09-03 03:09:40 | [diff] [blame] | 472 | kOsWin | kOsLinux | kOsCrOS, |
[email protected] | a22ebd81 | 2011-06-23 00:05:39 | [diff] [blame] | 473 | SINGLE_VALUE_TYPE(switches::kEnableSmoothScrolling) |
| 474 | }, |
[email protected] | 81a6b0b | 2011-06-24 17:55:40 | [diff] [blame] | 475 | { |
[email protected] | 6831780 | 2012-06-07 19:13:23 | [diff] [blame] | 476 | "omnibox-history-quick-provider-new-scoring", |
| 477 | IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_NAME, |
| 478 | IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_DESCRIPTION, |
| 479 | kOsAll, |
| 480 | MULTI_VALUE_TYPE(kOmniboxHistoryQuickProviderNewScoringChoices) |
| 481 | }, |
| 482 | { |
[email protected] | 128dc6c | 2012-06-22 20:30:35 | [diff] [blame] | 483 | "omnibox-history-quick-provider-reorder-for-inlining", |
| 484 | IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_NAME, |
| 485 | IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_DESCRIPTION, |
| 486 | kOsAll, |
| 487 | MULTI_VALUE_TYPE(kOmniboxHistoryQuickProviderReorderForInliningChoices) |
| 488 | }, |
| 489 | { |
[email protected] | 032d5e6c | 2012-02-17 17:53:55 | [diff] [blame] | 490 | "omnibox-inline-history-quick-provider", |
| 491 | IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_NAME, |
| 492 | IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_DESCRIPTION, |
| 493 | kOsAll, |
| 494 | MULTI_VALUE_TYPE(kOmniboxInlineHistoryQuickProviderChoices) |
| 495 | }, |
| 496 | { |
[email protected] | 7e7a2809 | 2011-12-09 22:24:55 | [diff] [blame] | 497 | "enable-panels", |
| 498 | IDS_FLAGS_ENABLE_PANELS_NAME, |
| 499 | IDS_FLAGS_ENABLE_PANELS_DESCRIPTION, |
[email protected] | 73fb1fc5 | 2011-07-09 00:06:54 | [diff] [blame] | 500 | kOsAll, |
[email protected] | 7e7a2809 | 2011-12-09 22:24:55 | [diff] [blame] | 501 | SINGLE_VALUE_TYPE(switches::kEnablePanels) |
[email protected] | 73fb1fc5 | 2011-07-09 00:06:54 | [diff] [blame] | 502 | }, |
[email protected] | e3749d1 | 2011-07-25 22:22:12 | [diff] [blame] | 503 | { |
[email protected] | 27c14f0 | 2012-06-22 17:29:58 | [diff] [blame] | 504 | // See http://crbug.com/120416 for how to remove this flag. |
[email protected] | 6474b11 | 2012-05-04 19:35:27 | [diff] [blame] | 505 | "save-page-as-mhtml", // FLAGS:RECORD_UMA |
| 506 | IDS_FLAGS_SAVE_PAGE_AS_MHTML_NAME, |
| 507 | IDS_FLAGS_SAVE_PAGE_AS_MHTML_DESCRIPTION, |
| 508 | kOsMac | kOsWin | kOsLinux, |
| 509 | SINGLE_VALUE_TYPE(switches::kSavePageAsMHTML) |
| 510 | }, |
| 511 | { |
[email protected] | b7bb44f | 2011-09-01 05:17:03 | [diff] [blame] | 512 | "enable-autologin", |
| 513 | IDS_FLAGS_ENABLE_AUTOLOGIN_NAME, |
| 514 | IDS_FLAGS_ENABLE_AUTOLOGIN_DESCRIPTION, |
| 515 | kOsMac | kOsWin | kOsLinux, |
| 516 | SINGLE_VALUE_TYPE(switches::kEnableAutologin) |
| 517 | }, |
[email protected] | b984117 | 2011-09-26 23:36:09 | [diff] [blame] | 518 | { |
[email protected] | bbadb11 | 2011-12-12 16:55:28 | [diff] [blame] | 519 | "enable-http-pipelining", |
| 520 | IDS_FLAGS_ENABLE_HTTP_PIPELINING_NAME, |
| 521 | IDS_FLAGS_ENABLE_HTTP_PIPELINING_DESCRIPTION, |
| 522 | kOsAll, |
| 523 | SINGLE_VALUE_TYPE(switches::kEnableHttpPipelining) |
| 524 | }, |
[email protected] | d411c01d | 2011-10-18 16:00:27 | [diff] [blame] | 525 | { |
[email protected] | 3231b61 | 2012-03-23 05:57:54 | [diff] [blame] | 526 | "enable-spdy3", |
| 527 | IDS_FLAGS_ENABLE_SPDY3_NAME, |
| 528 | IDS_FLAGS_ENABLE_SPDY3_DESCRIPTION, |
| 529 | kOsAll, |
| 530 | SINGLE_VALUE_TYPE(switches::kEnableSpdy3) |
| 531 | }, |
| 532 | { |
[email protected] | 27b3fe9 | 2012-03-21 05:35:06 | [diff] [blame] | 533 | "enable-async-dns", |
| 534 | IDS_FLAGS_ENABLE_ASYNC_DNS_NAME, |
| 535 | IDS_FLAGS_ENABLE_ASYNC_DNS_DESCRIPTION, |
[email protected] | 85594c14 | 2012-09-11 18:02:46 | [diff] [blame] | 536 | kOsWin | kOsMac | kOsLinux | kOsCrOS, |
[email protected] | 026876f3 | 2012-08-22 23:53:40 | [diff] [blame] | 537 | MULTI_VALUE_TYPE(kAsyncDnsChoices) |
[email protected] | 27b3fe9 | 2012-03-21 05:35:06 | [diff] [blame] | 538 | }, |
| 539 | { |
[email protected] | 1eb9380 | 2012-09-11 18:57:56 | [diff] [blame] | 540 | "disable-media-source", |
[email protected] | da43c08 | 2012-09-07 18:56:11 | [diff] [blame] | 541 | IDS_FLAGS_DISABLE_MEDIA_SOURCE_NAME, |
| 542 | IDS_FLAGS_DISABLE_MEDIA_SOURCE_DESCRIPTION, |
[email protected] | ec9d053 | 2012-03-21 05:55:32 | [diff] [blame] | 543 | kOsAll, |
[email protected] | da43c08 | 2012-09-07 18:56:11 | [diff] [blame] | 544 | SINGLE_VALUE_TYPE(switches::kDisableMediaSource) |
[email protected] | 6aa03b3 | 2011-10-27 21:44:44 | [diff] [blame] | 545 | }, |
[email protected] | e4e68dbb | 2011-11-18 01:50:22 | [diff] [blame] | 546 | { |
[email protected] | 9f5b782 | 2012-04-18 23:39:03 | [diff] [blame] | 547 | "enable-encrypted-media", |
| 548 | IDS_FLAGS_ENABLE_ENCRYPTED_MEDIA_NAME, |
| 549 | IDS_FLAGS_ENABLE_ENCRYPTED_MEDIA_DESCRIPTION, |
| 550 | kOsAll, |
| 551 | SINGLE_VALUE_TYPE(switches::kEnableEncryptedMedia) |
| 552 | }, |
[email protected] | dc04be7c | 2012-03-15 23:57:49 | [diff] [blame] | 553 | #if defined(USE_ASH) |
[email protected] | 8cc10df | 2011-11-03 23:57:50 | [diff] [blame] | 554 | { |
[email protected] | 57b8bb35 | 2012-01-11 05:11:46 | [diff] [blame] | 555 | "aura-google-dialog-frames", |
| 556 | IDS_FLAGS_AURA_GOOGLE_DIALOG_FRAMES_NAME, |
| 557 | IDS_FLAGS_AURA_GOOGLE_DIALOG_FRAMES_DESCRIPTION, |
| 558 | kOsWin | kOsLinux | kOsCrOS, |
| 559 | SINGLE_VALUE_TYPE(ash::switches::kAuraGoogleDialogFrames) |
| 560 | }, |
[email protected] | dc04be7c | 2012-03-15 23:57:49 | [diff] [blame] | 561 | #endif |
[email protected] | eaae8b46 | 2012-01-20 22:20:39 | [diff] [blame] | 562 | { |
[email protected] | db543d32 | 2011-12-15 20:40:15 | [diff] [blame] | 563 | "per-tile-painting", |
| 564 | IDS_FLAGS_PER_TILE_PAINTING_NAME, |
| 565 | IDS_FLAGS_PER_TILE_PAINTING_DESCRIPTION, |
| 566 | #if defined(USE_SKIA) |
[email protected] | a5b1b27 | 2012-01-06 20:44:37 | [diff] [blame] | 567 | kOsMac | kOsLinux | kOsCrOS, |
[email protected] | db543d32 | 2011-12-15 20:40:15 | [diff] [blame] | 568 | #else |
| 569 | 0, |
| 570 | #endif |
| 571 | SINGLE_VALUE_TYPE(switches::kEnablePerTilePainting) |
| 572 | }, |
[email protected] | bf88c03 | 2011-12-22 19:05:47 | [diff] [blame] | 573 | { |
| 574 | "enable-javascript-harmony", |
| 575 | IDS_FLAGS_ENABLE_JAVASCRIPT_HARMONY_NAME, |
| 576 | IDS_FLAGS_ENABLE_JAVASCRIPT_HARMONY_DESCRIPTION, |
| 577 | kOsAll, |
| 578 | SINGLE_VALUE_TYPE_AND_VALUE(switches::kJavaScriptFlags, "--harmony") |
| 579 | }, |
[email protected] | 7e7f378a | 2012-01-05 14:35:37 | [diff] [blame] | 580 | { |
[email protected] | 8564617 | 2012-01-09 22:45:54 | [diff] [blame] | 581 | "enable-tab-browser-dragging", |
| 582 | IDS_FLAGS_ENABLE_TAB_BROWSER_DRAGGING_NAME, |
| 583 | IDS_FLAGS_ENABLE_TAB_BROWSER_DRAGGING_DESCRIPTION, |
| 584 | kOsWin, |
| 585 | SINGLE_VALUE_TYPE(switches::kTabBrowserDragging) |
| 586 | }, |
| 587 | { |
[email protected] | 068b7b5 | 2012-02-27 12:41:44 | [diff] [blame] | 588 | "disable-restore-session-state", |
| 589 | IDS_FLAGS_DISABLE_RESTORE_SESSION_STATE_NAME, |
| 590 | IDS_FLAGS_DISABLE_RESTORE_SESSION_STATE_DESCRIPTION, |
[email protected] | 7e7f378a | 2012-01-05 14:35:37 | [diff] [blame] | 591 | kOsAll, |
[email protected] | 068b7b5 | 2012-02-27 12:41:44 | [diff] [blame] | 592 | SINGLE_VALUE_TYPE(switches::kDisableRestoreSessionState) |
[email protected] | 7e7f378a | 2012-01-05 14:35:37 | [diff] [blame] | 593 | }, |
[email protected] | 88864db | 2012-01-18 20:56:35 | [diff] [blame] | 594 | { |
| 595 | "disable-software-rasterizer", |
| 596 | IDS_FLAGS_DISABLE_SOFTWARE_RASTERIZER_NAME, |
| 597 | IDS_FLAGS_DISABLE_SOFTWARE_RASTERIZER_DESCRIPTION, |
| 598 | #if defined(ENABLE_SWIFTSHADER) |
| 599 | kOsAll, |
| 600 | #else |
| 601 | 0, |
| 602 | #endif |
| 603 | SINGLE_VALUE_TYPE(switches::kDisableSoftwareRasterizer) |
| 604 | }, |
[email protected] | 15a5d72 | 2012-01-23 09:11:14 | [diff] [blame] | 605 | { |
[email protected] | ff7b6dd | 2012-09-15 20:20:03 | [diff] [blame] | 606 | "enable-experimental-webkit-features", |
| 607 | IDS_FLAGS_EXPERIMENTAL_WEBKIT_FEATURES_NAME, |
| 608 | IDS_FLAGS_EXPERIMENTAL_WEBKIT_FEATURES_DESCRIPTION, |
[email protected] | d2edc670 | 2012-01-30 09:13:16 | [diff] [blame] | 609 | kOsAll, |
[email protected] | ff7b6dd | 2012-09-15 20:20:03 | [diff] [blame] | 610 | SINGLE_VALUE_TYPE(switches::kEnableExperimentalWebKitFeatures) |
[email protected] | ca7a3d79 | 2012-03-02 15:55:49 | [diff] [blame] | 611 | }, |
| 612 | { |
[email protected] | 0f95a25 | 2012-09-13 22:30:04 | [diff] [blame] | 613 | "enable-css-shaders", |
| 614 | IDS_FLAGS_CSS_SHADERS_NAME, |
| 615 | IDS_FLAGS_CSS_SHADERS_DESCRIPTION, |
| 616 | kOsAll, |
| 617 | SINGLE_VALUE_TYPE(switches::kEnableCssShaders) |
| 618 | }, |
| 619 | { |
[email protected] | 9860c68b | 2012-02-02 01:58:09 | [diff] [blame] | 620 | "enable-extension-activity-ui", |
| 621 | IDS_FLAGS_ENABLE_EXTENSION_ACTIVITY_UI_NAME, |
| 622 | IDS_FLAGS_ENABLE_EXTENSION_ACTIVITY_UI_DESCRIPTION, |
| 623 | kOsAll, |
| 624 | SINGLE_VALUE_TYPE(switches::kEnableExtensionActivityUI) |
[email protected] | 8bed69d | 2012-02-02 06:46:00 | [diff] [blame] | 625 | }, |
[email protected] | 54ae4e9 | 2012-02-16 15:19:05 | [diff] [blame] | 626 | { |
[email protected] | 3e8befc | 2012-03-13 01:17:03 | [diff] [blame] | 627 | "disable-ntp-other-sessions-menu", |
[email protected] | 156f96633 | 2012-02-29 00:03:16 | [diff] [blame] | 628 | IDS_FLAGS_NTP_OTHER_SESSIONS_MENU_NAME, |
| 629 | IDS_FLAGS_NTP_OTHER_SESSIONS_MENU_DESCRIPTION, |
| 630 | kOsAll, |
[email protected] | 3e8befc | 2012-03-13 01:17:03 | [diff] [blame] | 631 | SINGLE_VALUE_TYPE(switches::kDisableNTPOtherSessionsMenu) |
[email protected] | 156f96633 | 2012-02-29 00:03:16 | [diff] [blame] | 632 | }, |
[email protected] | dc04be7c | 2012-03-15 23:57:49 | [diff] [blame] | 633 | #if defined(USE_ASH) |
[email protected] | 31cf1c5 | 2012-02-29 20:55:01 | [diff] [blame] | 634 | { |
[email protected] | 3cd198a2 | 2012-03-12 20:38:01 | [diff] [blame] | 635 | "enable-ash-oak", |
| 636 | IDS_FLAGS_ENABLE_ASH_OAK_NAME, |
| 637 | IDS_FLAGS_ENABLE_ASH_OAK_DESCRIPTION, |
| 638 | kOsAll, |
| 639 | SINGLE_VALUE_TYPE(ash::switches::kAshEnableOak), |
| 640 | }, |
[email protected] | 31cf1c5 | 2012-02-29 20:55:01 | [diff] [blame] | 641 | #endif |
[email protected] | 184ec59 | 2012-03-01 11:54:28 | [diff] [blame] | 642 | { |
| 643 | "enable-devtools-experiments", |
| 644 | IDS_FLAGS_ENABLE_DEVTOOLS_EXPERIMENTS_NAME, |
| 645 | IDS_FLAGS_ENABLE_DEVTOOLS_EXPERIMENTS_DESCRIPTION, |
| 646 | kOsAll, |
| 647 | SINGLE_VALUE_TYPE(switches::kEnableDevToolsExperiments) |
| 648 | }, |
[email protected] | 76d1854e | 2012-03-02 23:57:44 | [diff] [blame] | 649 | { |
| 650 | "enable-suggestions-ntp", |
| 651 | IDS_FLAGS_NTP_SUGGESTIONS_PAGE_NAME, |
| 652 | IDS_FLAGS_NTP_SUGGESTIONS_PAGE_DESCRIPTION, |
| 653 | kOsAll, |
| 654 | SINGLE_VALUE_TYPE(switches::kEnableSuggestionsTabPage) |
| 655 | }, |
[email protected] | a78ef9e | 2012-03-21 02:49:55 | [diff] [blame] | 656 | { |
[email protected] | 7226735 | 2012-07-20 20:14:47 | [diff] [blame] | 657 | "enable-discovery-ntp", |
| 658 | IDS_FLAGS_ENABLE_NTP_DISCOVERY_NAME, |
| 659 | IDS_FLAGS_ENABLE_NTP_DISCOVERY_DESCRIPTION, |
| 660 | kOsAll, |
| 661 | SINGLE_VALUE_TYPE(switches::kEnableDiscoveryInNewTabPage) |
| 662 | }, |
[email protected] | 8e466dd | 2012-05-04 19:16:05 | [diff] [blame] | 663 | #if defined(GOOGLE_CHROME_BUILD) |
[email protected] | a3d5425 | 2012-04-05 20:04:13 | [diff] [blame] | 664 | { |
[email protected] | 37b928e | 2012-05-30 09:01:10 | [diff] [blame] | 665 | "disable-asynchronous-spellchecking", |
| 666 | IDS_FLAGS_DISABLE_ASYNCHRONOUS_SPELLCHECKING, |
| 667 | IDS_FLAGS_DISABLE_ASYNCHRONOUS_SPELLCHECKING_DESCRIPTION, |
| 668 | kOsWin | kOsLinux | kOsCrOS, |
| 669 | SINGLE_VALUE_TYPE(switches::kDisableAsynchronousSpellChecking) |
[email protected] | a3d5425 | 2012-04-05 20:04:13 | [diff] [blame] | 670 | }, |
[email protected] | 8e466dd | 2012-05-04 19:16:05 | [diff] [blame] | 671 | #endif |
[email protected] | c9c73ad4 | 2012-04-18 03:35:59 | [diff] [blame] | 672 | { |
| 673 | "touch-optimized-ui", |
[email protected] | 347a0c7 | 2012-05-14 20:28:06 | [diff] [blame] | 674 | IDS_FLAGS_TOUCH_OPTIMIZED_UI_NAME, |
| 675 | IDS_FLAGS_TOUCH_OPTIMIZED_UI_DESCRIPTION, |
[email protected] | c71fe640 | 2012-08-15 15:22:55 | [diff] [blame] | 676 | kOsWin, |
[email protected] | 347a0c7 | 2012-05-14 20:28:06 | [diff] [blame] | 677 | MULTI_VALUE_TYPE(kTouchOptimizedUIChoices) |
[email protected] | c9c73ad4 | 2012-04-18 03:35:59 | [diff] [blame] | 678 | }, |
[email protected] | 8a6aaa7 | 2012-04-20 20:53:58 | [diff] [blame] | 679 | { |
[email protected] | f6f8283 | 2012-09-04 17:12:04 | [diff] [blame] | 680 | "enable-webkit-text-subpixel-positioning", |
| 681 | IDS_FLAGS_ENABLE_WEBKIT_TEXT_SUBPIXEL_POSITIONING_NAME, |
| 682 | IDS_FLAGS_ENABLE_WEBKIT_TEXT_SUBPIXEL_POSITIONING_DESCRIPTION, |
| 683 | kOsCrOS, |
| 684 | SINGLE_VALUE_TYPE(switches::kEnableWebkitTextSubpixelPositioning) |
| 685 | }, |
| 686 | { |
[email protected] | 8a6aaa7 | 2012-04-20 20:53:58 | [diff] [blame] | 687 | "enable-touch-events", |
| 688 | IDS_ENABLE_TOUCH_EVENTS_NAME, |
| 689 | IDS_ENABLE_TOUCH_EVENTS_DESCRIPTION, |
| 690 | kOsAll, |
| 691 | SINGLE_VALUE_TYPE(switches::kEnableTouchEvents) |
| 692 | }, |
[email protected] | 0b60afa | 2012-04-19 17:36:39 | [diff] [blame] | 693 | #if defined(OS_CHROMEOS) |
| 694 | { |
[email protected] | 7c4a9bc | 2012-09-11 22:10:05 | [diff] [blame] | 695 | "enable-background-loader", |
| 696 | IDS_ENABLE_BACKLOADER_NAME, |
| 697 | IDS_ENABLE_BACKLOADER_DESCRIPTION, |
| 698 | kOsCrOS, |
| 699 | SINGLE_VALUE_TYPE(switches::kEnableBackgroundLoader) |
| 700 | }, |
| 701 | { |
[email protected] | c5667b28 | 2012-08-31 00:32:50 | [diff] [blame] | 702 | "enable-bezel-touch", |
| 703 | IDS_ENABLE_BEZEL_TOUCH_NAME, |
| 704 | IDS_ENABLE_BEZEL_TOUCH_DESCRIPTION, |
[email protected] | 1995d80d | 2012-08-23 02:58:47 | [diff] [blame] | 705 | kOsCrOS, |
[email protected] | c5667b28 | 2012-08-31 00:32:50 | [diff] [blame] | 706 | SINGLE_VALUE_TYPE(switches::kEnableBezelTouch) |
[email protected] | 1995d80d | 2012-08-23 02:58:47 | [diff] [blame] | 707 | }, |
| 708 | { |
[email protected] | 0b60afa | 2012-04-19 17:36:39 | [diff] [blame] | 709 | "no-discard-tabs", |
| 710 | IDS_FLAGS_NO_DISCARD_TABS_NAME, |
| 711 | IDS_FLAGS_NO_DISCARD_TABS_DESCRIPTION, |
| 712 | kOsCrOS, |
| 713 | SINGLE_VALUE_TYPE(switches::kNoDiscardTabs) |
| 714 | }, |
| 715 | #endif |
[email protected] | 79be6d3 | 2012-04-24 20:47:44 | [diff] [blame] | 716 | { |
[email protected] | 9a5940d | 2012-04-27 19:16:23 | [diff] [blame] | 717 | "allow-nacl-socket-api", |
| 718 | IDS_FLAGS_ALLOW_NACL_SOCKET_API_NAME, |
| 719 | IDS_FLAGS_ALLOW_NACL_SOCKET_API_DESCRIPTION, |
| 720 | kOsAll, |
| 721 | SINGLE_VALUE_TYPE_AND_VALUE(switches::kAllowNaClSocketAPI, "*") |
| 722 | }, |
[email protected] | 8533373 | 2012-05-01 19:02:24 | [diff] [blame] | 723 | { |
[email protected] | 60673ad7 | 2012-05-02 06:16:33 | [diff] [blame] | 724 | "stacked-tab-strip", |
| 725 | IDS_FLAGS_STACKED_TAB_STRIP_NAME, |
| 726 | IDS_FLAGS_STACKED_TAB_STRIP_DESCRIPTION, |
| 727 | kOsWin, |
| 728 | SINGLE_VALUE_TYPE(switches::kEnableStackedTabStrip) |
| 729 | }, |
| 730 | { |
[email protected] | 4bd2020 | 2012-06-14 17:35:01 | [diff] [blame] | 731 | "force-device-scale-factor", |
[email protected] | 8533373 | 2012-05-01 19:02:24 | [diff] [blame] | 732 | IDS_FLAGS_FORCE_HIGH_DPI_NAME, |
| 733 | IDS_FLAGS_FORCE_HIGH_DPI_DESCRIPTION, |
| 734 | kOsCrOS, |
[email protected] | 4bd2020 | 2012-06-14 17:35:01 | [diff] [blame] | 735 | SINGLE_VALUE_TYPE_AND_VALUE(switches::kForceDeviceScaleFactor, "2") |
[email protected] | 8533373 | 2012-05-01 19:02:24 | [diff] [blame] | 736 | }, |
[email protected] | 190349fd | 2012-05-02 00:10:47 | [diff] [blame] | 737 | #if defined(OS_CHROMEOS) |
| 738 | { |
| 739 | "allow-touchpad-three-finger-click", |
| 740 | IDS_FLAGS_ALLOW_TOUCHPAD_THREE_FINGER_CLICK_NAME, |
| 741 | IDS_FLAGS_ALLOW_TOUCHPAD_THREE_FINGER_CLICK_DESCRIPTION, |
| 742 | kOsCrOS, |
| 743 | SINGLE_VALUE_TYPE(switches::kEnableTouchpadThreeFingerClick) |
| 744 | }, |
| 745 | #endif |
[email protected] | aab64e0 | 2012-05-03 19:24:16 | [diff] [blame] | 746 | { |
[email protected] | d3ace93 | 2012-08-09 15:39:34 | [diff] [blame] | 747 | "enable-client-oauth-signin", |
| 748 | IDS_FLAGS_ENABLE_CLIENT_OAUTH_SIGNIN_NAME, |
| 749 | IDS_FLAGS_ENABLE_CLIENT_OAUTH_SIGNIN_DESCRIPTION, |
[email protected] | aab64e0 | 2012-05-03 19:24:16 | [diff] [blame] | 750 | kOsMac | kOsWin | kOsLinux, |
[email protected] | d3ace93 | 2012-08-09 15:39:34 | [diff] [blame] | 751 | SINGLE_VALUE_TYPE(switches::kEnableClientOAuthSignin) |
[email protected] | aab64e0 | 2012-05-03 19:24:16 | [diff] [blame] | 752 | }, |
[email protected] | 53520b1b | 2012-05-07 21:43:37 | [diff] [blame] | 753 | #if defined(USE_ASH) |
| 754 | { |
[email protected] | 5544450 | 2012-05-10 15:43:53 | [diff] [blame] | 755 | "show-launcher-alignment-menu", |
| 756 | IDS_FLAGS_SHOW_LAUNCHER_ALIGNMENT_MENU_NAME, |
| 757 | IDS_FLAGS_SHOW_LAUNCHER_ALIGNMENT_MENU_DESCRIPTION, |
| 758 | kOsAll, |
| 759 | SINGLE_VALUE_TYPE(switches::kShowLauncherAlignmentMenu) |
| 760 | }, |
[email protected] | 817ecd1 | 2012-05-16 18:36:53 | [diff] [blame] | 761 | { |
[email protected] | 7307474 | 2012-05-17 01:44:41 | [diff] [blame] | 762 | "show-touch-hud", |
| 763 | IDS_FLAGS_SHOW_TOUCH_HUD_NAME, |
| 764 | IDS_FLAGS_SHOW_TOUCH_HUD_DESCRIPTION, |
| 765 | kOsAll, |
| 766 | SINGLE_VALUE_TYPE(ash::switches::kAshTouchHud) |
| 767 | }, |
| 768 | { |
[email protected] | e154db3 | 2012-06-18 16:20:46 | [diff] [blame] | 769 | "ash-notify-disabled", |
| 770 | IDS_FLAGS_DISABLE_ASH_NOTIFY_NAME, |
| 771 | IDS_FLAGS_DISABLE_ASH_NOTIFY_DESCRIPTION, |
[email protected] | 817ecd1 | 2012-05-16 18:36:53 | [diff] [blame] | 772 | kOsAll, |
[email protected] | e154db3 | 2012-06-18 16:20:46 | [diff] [blame] | 773 | SINGLE_VALUE_TYPE(ash::switches::kAshNotifyDisabled), |
[email protected] | 817ecd1 | 2012-05-16 18:36:53 | [diff] [blame] | 774 | }, |
[email protected] | 9f0940b6 | 2012-05-23 22:56:35 | [diff] [blame] | 775 | { |
| 776 | "enable-pinch", |
| 777 | IDS_FLAGS_ENABLE_PINCH_SCALE_NAME, |
| 778 | IDS_FLAGS_ENABLE_PINCH_SCALE_DESCRIPTION, |
| 779 | kOsAll, |
| 780 | SINGLE_VALUE_TYPE(switches::kEnablePinch), |
| 781 | }, |
[email protected] | a837931 | 2012-06-15 00:20:43 | [diff] [blame] | 782 | { |
| 783 | "app-list-show-apps-only", |
| 784 | IDS_FLAGS_ENABLE_APP_LIST_SHOW_APPS_ONLY_NAME, |
| 785 | IDS_FLAGS_ENABLE_APP_LIST_SHOW_APPS_ONLY_DESCRIPTION, |
| 786 | kOsAll, |
[email protected] | 0bc6c27 | 2012-07-17 03:32:03 | [diff] [blame] | 787 | SINGLE_VALUE_TYPE(app_list::switches::kAppListShowAppsOnly), |
[email protected] | a837931 | 2012-06-15 00:20:43 | [diff] [blame] | 788 | }, |
[email protected] | 7307474 | 2012-05-17 01:44:41 | [diff] [blame] | 789 | #endif // defined(USE_ASH) |
[email protected] | ed7b67f3 | 2012-05-28 10:12:28 | [diff] [blame] | 790 | #if defined(OS_CHROMEOS) |
| 791 | { |
[email protected] | 5064c56 | 2012-09-05 18:15:27 | [diff] [blame] | 792 | "disable-new-wallpaper-picker-ui", |
| 793 | IDS_FLAGS_DISABLE_NEW_WALLPAPER_UI_NAME, |
| 794 | IDS_FLAGS_DISABLE_NEW_WALLPAPER_UI_DESCRIPTION, |
[email protected] | a7668a1 | 2012-05-28 22:23:48 | [diff] [blame] | 795 | kOsCrOS, |
[email protected] | 5064c56 | 2012-09-05 18:15:27 | [diff] [blame] | 796 | SINGLE_VALUE_TYPE(switches::kDisableNewWallpaperUI) |
[email protected] | a7668a1 | 2012-05-28 22:23:48 | [diff] [blame] | 797 | }, |
| 798 | { |
[email protected] | 89821307 | 2012-07-11 02:25:48 | [diff] [blame] | 799 | "enable-drive-v2-api", |
| 800 | IDS_FLAGS_ENABLE_DRIVE_V2_API, |
| 801 | IDS_FLAGS_ENABLE_DRIVE_V2_API_DESCRIPTION, |
| 802 | kOsCrOS, |
| 803 | SINGLE_VALUE_TYPE(switches::kEnableDriveV2Api), |
| 804 | }, |
| 805 | { |
[email protected] | 02a8cb5 | 2012-08-06 22:21:12 | [diff] [blame] | 806 | "use-leveldb-for-gdata", |
| 807 | IDS_FLAGS_USE_LEVELDB_FOR_GDATA_NAME, |
| 808 | IDS_FLAGS_USE_LEVELDB_FOR_GDATA_DESCRIPTION, |
| 809 | kOsCrOS, |
| 810 | SINGLE_VALUE_TYPE(switches::kUseLevelDBForGData), |
| 811 | }, |
| 812 | { |
[email protected] | 89ef5017 | 2012-07-24 21:58:38 | [diff] [blame] | 813 | "disable-html5-camera", |
| 814 | IDS_FLAGS_DISABLE_HTML5_CAMERA, |
| 815 | IDS_FLAGS_DISABLE_HTML5_CAMERA_DESCRIPTION, |
[email protected] | ffc6f7b1 | 2012-07-04 09:11:33 | [diff] [blame] | 816 | kOsCrOS, |
[email protected] | 89ef5017 | 2012-07-24 21:58:38 | [diff] [blame] | 817 | SINGLE_VALUE_TYPE(switches::kDisableHtml5Camera), |
[email protected] | ffc6f7b1 | 2012-07-04 09:11:33 | [diff] [blame] | 818 | }, |
| 819 | { |
[email protected] | e03dc78d | 2012-07-24 08:21:43 | [diff] [blame] | 820 | "disable-new-oobe", |
| 821 | IDS_FLAGS_DISABLE_NEW_OOBE, |
| 822 | IDS_FLAGS_DISABLE_NEW_OOBE_DESCRIPTION, |
[email protected] | ed7b67f3 | 2012-05-28 10:12:28 | [diff] [blame] | 823 | kOsCrOS, |
[email protected] | e03dc78d | 2012-07-24 08:21:43 | [diff] [blame] | 824 | SINGLE_VALUE_TYPE(switches::kDisableNewOobe), |
[email protected] | ed7b67f3 | 2012-05-28 10:12:28 | [diff] [blame] | 825 | }, |
[email protected] | 8b04a165 | 2012-08-04 02:59:49 | [diff] [blame] | 826 | { |
[email protected] | f59324d | 2012-09-17 19:41:47 | [diff] [blame] | 827 | "disable-factory-reset", |
| 828 | IDS_FLAGS_DISABLE_FACTORY_RESET, |
| 829 | IDS_FLAGS_DISABLE_FACTORY_RESET_DESCRIPTION, |
| 830 | kOsCrOS, |
| 831 | SINGLE_VALUE_TYPE(switches::kDisableFactoryReset), |
| 832 | }, |
| 833 | { |
[email protected] | 8b04a165 | 2012-08-04 02:59:49 | [diff] [blame] | 834 | "disable-boot-animation", |
| 835 | IDS_FLAGS_DISABLE_BOOT_ANIMATION, |
| 836 | IDS_FLAGS_DISABLE_BOOT_ANIMATION_DESCRIPTION, |
| 837 | kOsCrOS, |
| 838 | SINGLE_VALUE_TYPE(switches::kDisableBootAnimation), |
| 839 | }, |
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 840 | { |
[email protected] | b455719 | 2012-09-19 11:29:58 | [diff] [blame] | 841 | "disable-boot-animation2", |
| 842 | IDS_FLAGS_DISABLE_BOOT_ANIMATION2, |
| 843 | IDS_FLAGS_DISABLE_BOOT_ANIMATION2_DESCRIPTION, |
| 844 | kOsCrOS, |
| 845 | SINGLE_VALUE_TYPE(ash::switches::kAshDisableBootAnimation2), |
| 846 | }, |
| 847 | { |
[email protected] | ea2f334 | 2012-09-21 21:13:36 | [diff] [blame^] | 848 | "boot-animation-fucntion", |
| 849 | IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION, |
| 850 | IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION_DESCRIPTION, |
| 851 | kOsCrOS, |
| 852 | MULTI_VALUE_TYPE(kAshBootAnimationFunction), |
| 853 | }, |
| 854 | { |
[email protected] | 6885b73 | 2012-09-05 20:47:58 | [diff] [blame] | 855 | "disable-workspace2", |
| 856 | IDS_FLAGS_DISABLE_WORKSPACE2, |
| 857 | IDS_FLAGS_DISABLE_WORKSPACE2_DESCRIPTION, |
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 858 | kOsCrOS, |
[email protected] | 6885b73 | 2012-09-05 20:47:58 | [diff] [blame] | 859 | SINGLE_VALUE_TYPE(ash::switches::kAshDisableWorkspace2), |
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 860 | }, |
[email protected] | ed7b67f3 | 2012-05-28 10:12:28 | [diff] [blame] | 861 | #endif |
[email protected] | fc7a93c | 2012-06-08 20:25:39 | [diff] [blame] | 862 | { |
| 863 | "enable-views-textfield", |
| 864 | IDS_FLAGS_ENABLE_VIEWS_TEXTFIELD_NAME, |
| 865 | IDS_FLAGS_ENABLE_VIEWS_TEXTFIELD_DESCRIPTION, |
| 866 | kOsWin, |
| 867 | SINGLE_VALUE_TYPE(switches::kEnableViewsTextfield), |
| 868 | }, |
[email protected] | bd0cd3bb | 2012-06-14 03:03:38 | [diff] [blame] | 869 | { |
[email protected] | ef41b7ee | 2012-07-24 19:10:41 | [diff] [blame] | 870 | "old-checkbox-style", |
| 871 | IDS_FLAGS_OLD_CHECKBOX_STYLE, |
| 872 | IDS_FLAGS_OLD_CHECKBOX_STYLE_DESCRIPTION, |
| 873 | kOsLinux | kOsCrOS, |
| 874 | SINGLE_VALUE_TYPE(switches::kOldCheckboxStyle), |
| 875 | }, |
| 876 | { |
[email protected] | fcb88de | 2012-07-12 22:25:32 | [diff] [blame] | 877 | "enable-frameless-constrained-dialogs", |
| 878 | IDS_FLAGS_ENABLE_FRAMELESS_DIALOG_NAME, |
| 879 | IDS_FLAGS_ENABLE_FRAMELESS_DIALOG_DESCRIPTION, |
| 880 | kOsWin | kOsCrOS, |
| 881 | SINGLE_VALUE_TYPE(switches::kEnableFramelessConstrainedDialogs), |
| 882 | }, |
[email protected] | 7057b3e | 2012-06-18 19:19:16 | [diff] [blame] | 883 | #if defined(OS_CHROMEOS) |
| 884 | { |
| 885 | "enable-unsupported-bluetooth-devices", |
| 886 | IDS_FLAGS_UNSUPPORTED_BLUETOOTH_DEVICES_NAME, |
| 887 | IDS_FLAGS_UNSUPPORTED_BLUETOOTH_DEVICES_DESCRIPTION, |
| 888 | kOsCrOS, |
| 889 | SINGLE_VALUE_TYPE(switches::kEnableUnsupportedBluetoothDevices) |
| 890 | }, |
| 891 | #endif |
[email protected] | 7db8893a | 2012-07-26 00:49:40 | [diff] [blame] | 892 | { "disable-accelerated-video-decode", |
| 893 | IDS_FLAGS_DISABLE_ACCELERATED_VIDEO_DECODE_NAME, |
| 894 | IDS_FLAGS_DISABLE_ACCELERATED_VIDEO_DECODE_DESCRIPTION, |
[email protected] | 66dcb049 | 2012-06-18 22:32:15 | [diff] [blame] | 895 | kOsAll, |
[email protected] | 7db8893a | 2012-07-26 00:49:40 | [diff] [blame] | 896 | SINGLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), |
[email protected] | 66dcb049 | 2012-06-18 22:32:15 | [diff] [blame] | 897 | }, |
[email protected] | 66ae9fc | 2012-06-19 21:33:52 | [diff] [blame] | 898 | #if defined(USE_ASH) |
| 899 | { |
| 900 | "ash-debug-shortcuts", |
| 901 | IDS_FLAGS_DEBUG_SHORTCUTS_NAME, |
| 902 | IDS_FLAGS_DEBUG_SHORTCUTS_DESCRIPTION, |
| 903 | kOsAll, |
| 904 | SINGLE_VALUE_TYPE(ash::switches::kAshDebugShortcuts), |
| 905 | }, |
| 906 | #endif |
[email protected] | 37fee094 | 2012-08-07 21:07:45 | [diff] [blame] | 907 | { |
[email protected] | 9a8e935 | 2012-08-24 00:45:17 | [diff] [blame] | 908 | "disable-website-settings", // FLAGS:RECORD_UMA |
| 909 | IDS_FLAGS_DISABLE_WEBSITE_SETTINGS_NAME, |
| 910 | IDS_FLAGS_DISABLE_WEBSITE_SETTINGS_DESCRIPTION, |
[email protected] | 37fee094 | 2012-08-07 21:07:45 | [diff] [blame] | 911 | kOsAll, |
[email protected] | 9a8e935 | 2012-08-24 00:45:17 | [diff] [blame] | 912 | SINGLE_VALUE_TYPE(switches::kDisableWebsiteSettings), |
[email protected] | 37fee094 | 2012-08-07 21:07:45 | [diff] [blame] | 913 | }, |
[email protected] | ad3f6d2 | 2012-08-29 02:34:19 | [diff] [blame] | 914 | { |
[email protected] | e2e8e32 | 2012-09-12 04:37:02 | [diff] [blame] | 915 | "enable-webaudio-input", |
| 916 | IDS_FLAGS_ENABLE_WEBAUDIO_INPUT_NAME, |
| 917 | IDS_FLAGS_ENABLE_WEBAUDIO_INPUT_DESCRIPTION, |
| 918 | kOsAll, |
| 919 | SINGLE_VALUE_TYPE(switches::kEnableWebAudioInput), |
| 920 | }, |
| 921 | { |
[email protected] | ad3f6d2 | 2012-08-29 02:34:19 | [diff] [blame] | 922 | "enable-contacts", |
| 923 | IDS_FLAGS_ENABLE_CONTACTS_NAME, |
| 924 | IDS_FLAGS_ENABLE_CONTACTS_DESCRIPTION, |
| 925 | kOsCrOS, |
| 926 | SINGLE_VALUE_TYPE(switches::kEnableContacts) |
| 927 | }, |
[email protected] | 1d9bb9cd | 2012-08-28 22:02:50 | [diff] [blame] | 928 | #if defined(USE_ASH) |
| 929 | { "ash-enable-advanced-gestures", |
| 930 | IDS_FLAGS_ENABLE_ADVANCED_GESTURES_NAME, |
| 931 | IDS_FLAGS_ENABLE_ADVANCED_GESTURES_DESCRIPTION, |
| 932 | kOsCrOS, |
| 933 | SINGLE_VALUE_TYPE(ash::switches::kAshEnableAdvancedGestures), |
| 934 | }, |
| 935 | #endif |
[email protected] | 9b7ab88 | 2012-09-10 23:46:36 | [diff] [blame] | 936 | #if defined(OS_CHROMEOS) |
| 937 | { |
| 938 | "enable-request-tablet-site", |
| 939 | IDS_FLAGS_ENABLE_REQUEST_TABLET_SITE_NAME, |
| 940 | IDS_FLAGS_ENABLE_REQUEST_TABLET_SITE_DESCRIPTION, |
| 941 | kOsCrOS, |
| 942 | SINGLE_VALUE_TYPE(switches::kEnableRequestTabletSite) |
| 943 | }, |
| 944 | #endif |
[email protected] | a0e4b07 | 2011-08-17 01:47:07 | [diff] [blame] | 945 | }; |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 946 | |
[email protected] | a314ee5a | 2010-10-26 21:23:28 | [diff] [blame] | 947 | const Experiment* experiments = kExperiments; |
| 948 | size_t num_experiments = arraysize(kExperiments); |
| 949 | |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 950 | // Stores and encapsulates the little state that about:flags has. |
| 951 | class FlagsState { |
| 952 | public: |
| 953 | FlagsState() : needs_restart_(false) {} |
| 954 | void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line); |
| 955 | bool IsRestartNeededToCommitChanges(); |
| 956 | void SetExperimentEnabled( |
[email protected] | a314ee5a | 2010-10-26 21:23:28 | [diff] [blame] | 957 | PrefService* prefs, const std::string& internal_name, bool enable); |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 958 | void RemoveFlagsSwitches( |
| 959 | std::map<std::string, CommandLine::StringType>* switch_list); |
| 960 | void reset(); |
| 961 | |
| 962 | // Returns the singleton instance of this class |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 963 | static FlagsState* GetInstance() { |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 964 | return Singleton<FlagsState>::get(); |
| 965 | } |
| 966 | |
| 967 | private: |
| 968 | bool needs_restart_; |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 969 | std::map<std::string, std::string> flags_switches_; |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 970 | |
| 971 | DISALLOW_COPY_AND_ASSIGN(FlagsState); |
| 972 | }; |
| 973 | |
[email protected] | c7b7800a | 2010-10-07 18:51:35 | [diff] [blame] | 974 | // Extracts the list of enabled lab experiments from preferences and stores them |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 975 | // in a set. |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 976 | void GetEnabledFlags(const PrefService* prefs, std::set<std::string>* result) { |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 977 | const ListValue* enabled_experiments = prefs->GetList( |
| 978 | prefs::kEnabledLabsExperiments); |
| 979 | if (!enabled_experiments) |
| 980 | return; |
| 981 | |
| 982 | for (ListValue::const_iterator it = enabled_experiments->begin(); |
| 983 | it != enabled_experiments->end(); |
| 984 | ++it) { |
| 985 | std::string experiment_name; |
| 986 | if (!(*it)->GetAsString(&experiment_name)) { |
| 987 | LOG(WARNING) << "Invalid entry in " << prefs::kEnabledLabsExperiments; |
| 988 | continue; |
| 989 | } |
| 990 | result->insert(experiment_name); |
| 991 | } |
| 992 | } |
| 993 | |
| 994 | // Takes a set of enabled lab experiments |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 995 | void SetEnabledFlags( |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 996 | PrefService* prefs, const std::set<std::string>& enabled_experiments) { |
[email protected] | 1bc7842 | 2011-03-31 08:41:38 | [diff] [blame] | 997 | ListPrefUpdate update(prefs, prefs::kEnabledLabsExperiments); |
| 998 | ListValue* experiments_list = update.Get(); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 999 | |
| 1000 | experiments_list->Clear(); |
| 1001 | for (std::set<std::string>::const_iterator it = enabled_experiments.begin(); |
| 1002 | it != enabled_experiments.end(); |
| 1003 | ++it) { |
| 1004 | experiments_list->Append(new StringValue(*it)); |
| 1005 | } |
| 1006 | } |
| 1007 | |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1008 | // Returns the name used in prefs for the choice at the specified index. |
| 1009 | std::string NameForChoice(const Experiment& e, int index) { |
[email protected] | 2ce9c8975 | 2011-02-25 18:24:34 | [diff] [blame] | 1010 | DCHECK_EQ(Experiment::MULTI_VALUE, e.type); |
| 1011 | DCHECK_LT(index, e.num_choices); |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1012 | return std::string(e.internal_name) + about_flags::testing::kMultiSeparator + |
| 1013 | base::IntToString(index); |
| 1014 | } |
| 1015 | |
| 1016 | // Adds the internal names for the specified experiment to |names|. |
| 1017 | void AddInternalName(const Experiment& e, std::set<std::string>* names) { |
| 1018 | if (e.type == Experiment::SINGLE_VALUE) { |
| 1019 | names->insert(e.internal_name); |
| 1020 | } else { |
[email protected] | 2ce9c8975 | 2011-02-25 18:24:34 | [diff] [blame] | 1021 | DCHECK_EQ(Experiment::MULTI_VALUE, e.type); |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1022 | for (int i = 0; i < e.num_choices; ++i) |
| 1023 | names->insert(NameForChoice(e, i)); |
| 1024 | } |
| 1025 | } |
| 1026 | |
[email protected] | 28e35af | 2011-02-09 12:56:22 | [diff] [blame] | 1027 | // Confirms that an experiment is valid, used in a DCHECK in |
| 1028 | // SanitizeList below. |
| 1029 | bool ValidateExperiment(const Experiment& e) { |
| 1030 | switch (e.type) { |
| 1031 | case Experiment::SINGLE_VALUE: |
| 1032 | DCHECK_EQ(0, e.num_choices); |
| 1033 | DCHECK(!e.choices); |
| 1034 | break; |
| 1035 | case Experiment::MULTI_VALUE: |
| 1036 | DCHECK_GT(e.num_choices, 0); |
| 1037 | DCHECK(e.choices); |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 1038 | DCHECK(e.choices[0].command_line_switch); |
| 1039 | DCHECK_EQ('\0', e.choices[0].command_line_switch[0]); |
[email protected] | 28e35af | 2011-02-09 12:56:22 | [diff] [blame] | 1040 | break; |
| 1041 | default: |
| 1042 | NOTREACHED(); |
| 1043 | } |
| 1044 | return true; |
| 1045 | } |
| 1046 | |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1047 | // Removes all experiments from prefs::kEnabledLabsExperiments that are |
| 1048 | // unknown, to prevent this list to become very long as experiments are added |
| 1049 | // and removed. |
| 1050 | void SanitizeList(PrefService* prefs) { |
| 1051 | std::set<std::string> known_experiments; |
[email protected] | 28e35af | 2011-02-09 12:56:22 | [diff] [blame] | 1052 | for (size_t i = 0; i < num_experiments; ++i) { |
| 1053 | DCHECK(ValidateExperiment(experiments[i])); |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1054 | AddInternalName(experiments[i], &known_experiments); |
[email protected] | 28e35af | 2011-02-09 12:56:22 | [diff] [blame] | 1055 | } |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1056 | |
| 1057 | std::set<std::string> enabled_experiments; |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 1058 | GetEnabledFlags(prefs, &enabled_experiments); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1059 | |
| 1060 | std::set<std::string> new_enabled_experiments; |
| 1061 | std::set_intersection( |
| 1062 | known_experiments.begin(), known_experiments.end(), |
| 1063 | enabled_experiments.begin(), enabled_experiments.end(), |
| 1064 | std::inserter(new_enabled_experiments, new_enabled_experiments.begin())); |
| 1065 | |
[email protected] | 4c8853f | 2012-07-23 01:29:16 | [diff] [blame] | 1066 | if (new_enabled_experiments != enabled_experiments) |
| 1067 | SetEnabledFlags(prefs, new_enabled_experiments); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1068 | } |
| 1069 | |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 1070 | void GetSanitizedEnabledFlags( |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1071 | PrefService* prefs, std::set<std::string>* result) { |
| 1072 | SanitizeList(prefs); |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 1073 | GetEnabledFlags(prefs, result); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1074 | } |
| 1075 | |
[email protected] | a314ee5a | 2010-10-26 21:23:28 | [diff] [blame] | 1076 | // Variant of GetSanitizedEnabledFlags that also removes any flags that aren't |
| 1077 | // enabled on the current platform. |
| 1078 | void GetSanitizedEnabledFlagsForCurrentPlatform( |
| 1079 | PrefService* prefs, std::set<std::string>* result) { |
| 1080 | GetSanitizedEnabledFlags(prefs, result); |
| 1081 | |
| 1082 | // Filter out any experiments that aren't enabled on the current platform. We |
| 1083 | // don't remove these from prefs else syncing to a platform with a different |
| 1084 | // set of experiments would be lossy. |
| 1085 | std::set<std::string> platform_experiments; |
| 1086 | int current_platform = GetCurrentPlatform(); |
| 1087 | for (size_t i = 0; i < num_experiments; ++i) { |
| 1088 | if (experiments[i].supported_platforms & current_platform) |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1089 | AddInternalName(experiments[i], &platform_experiments); |
[email protected] | a314ee5a | 2010-10-26 21:23:28 | [diff] [blame] | 1090 | } |
| 1091 | |
| 1092 | std::set<std::string> new_enabled_experiments; |
| 1093 | std::set_intersection( |
| 1094 | platform_experiments.begin(), platform_experiments.end(), |
| 1095 | result->begin(), result->end(), |
| 1096 | std::inserter(new_enabled_experiments, new_enabled_experiments.begin())); |
| 1097 | |
| 1098 | result->swap(new_enabled_experiments); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1099 | } |
| 1100 | |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1101 | // Returns the Value representing the choice data in the specified experiment. |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1102 | Value* CreateChoiceData(const Experiment& experiment, |
[email protected] | 28e35af | 2011-02-09 12:56:22 | [diff] [blame] | 1103 | const std::set<std::string>& enabled_experiments) { |
[email protected] | 2ce9c8975 | 2011-02-25 18:24:34 | [diff] [blame] | 1104 | DCHECK_EQ(Experiment::MULTI_VALUE, experiment.type); |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1105 | ListValue* result = new ListValue; |
| 1106 | for (int i = 0; i < experiment.num_choices; ++i) { |
| 1107 | const Experiment::Choice& choice = experiment.choices[i]; |
| 1108 | DictionaryValue* value = new DictionaryValue; |
| 1109 | std::string name = NameForChoice(experiment, i); |
| 1110 | value->SetString("description", |
| 1111 | l10n_util::GetStringUTF16(choice.description_id)); |
| 1112 | value->SetString("internal_name", name); |
[email protected] | 28e35af | 2011-02-09 12:56:22 | [diff] [blame] | 1113 | value->SetBoolean("selected", enabled_experiments.count(name) > 0); |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1114 | result->Append(value); |
| 1115 | } |
| 1116 | return result; |
| 1117 | } |
| 1118 | |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1119 | } // namespace |
| 1120 | |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 1121 | void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line) { |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 1122 | FlagsState::GetInstance()->ConvertFlagsToSwitches(prefs, command_line); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1123 | } |
| 1124 | |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 1125 | ListValue* GetFlagsExperimentsData(PrefService* prefs) { |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1126 | std::set<std::string> enabled_experiments; |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 1127 | GetSanitizedEnabledFlags(prefs, &enabled_experiments); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1128 | |
| 1129 | int current_platform = GetCurrentPlatform(); |
| 1130 | |
| 1131 | ListValue* experiments_data = new ListValue(); |
[email protected] | a314ee5a | 2010-10-26 21:23:28 | [diff] [blame] | 1132 | for (size_t i = 0; i < num_experiments; ++i) { |
| 1133 | const Experiment& experiment = experiments[i]; |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1134 | |
| 1135 | DictionaryValue* data = new DictionaryValue(); |
| 1136 | data->SetString("internal_name", experiment.internal_name); |
| 1137 | data->SetString("name", |
| 1138 | l10n_util::GetStringUTF16(experiment.visible_name_id)); |
| 1139 | data->SetString("description", |
| 1140 | l10n_util::GetStringUTF16( |
| 1141 | experiment.visible_description_id)); |
[email protected] | cc3e205 | 2011-12-20 01:01:40 | [diff] [blame] | 1142 | bool supported = !!(experiment.supported_platforms & current_platform); |
| 1143 | data->SetBoolean("supported", supported); |
| 1144 | |
| 1145 | ListValue* supported_platforms = new ListValue(); |
| 1146 | AddOsStrings(experiment.supported_platforms, supported_platforms); |
| 1147 | data->Set("supported_platforms", supported_platforms); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1148 | |
[email protected] | 28e35af | 2011-02-09 12:56:22 | [diff] [blame] | 1149 | switch (experiment.type) { |
| 1150 | case Experiment::SINGLE_VALUE: |
| 1151 | data->SetBoolean( |
| 1152 | "enabled", |
| 1153 | enabled_experiments.count(experiment.internal_name) > 0); |
| 1154 | break; |
| 1155 | case Experiment::MULTI_VALUE: |
| 1156 | data->Set("choices", CreateChoiceData(experiment, enabled_experiments)); |
| 1157 | break; |
| 1158 | default: |
| 1159 | NOTREACHED(); |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1160 | } |
| 1161 | |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1162 | experiments_data->Append(data); |
| 1163 | } |
| 1164 | return experiments_data; |
| 1165 | } |
| 1166 | |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1167 | bool IsRestartNeededToCommitChanges() { |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 1168 | return FlagsState::GetInstance()->IsRestartNeededToCommitChanges(); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1169 | } |
| 1170 | |
| 1171 | void SetExperimentEnabled( |
[email protected] | c7b7800a | 2010-10-07 18:51:35 | [diff] [blame] | 1172 | PrefService* prefs, const std::string& internal_name, bool enable) { |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 1173 | FlagsState::GetInstance()->SetExperimentEnabled(prefs, internal_name, enable); |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1174 | } |
| 1175 | |
| 1176 | void RemoveFlagsSwitches( |
| 1177 | std::map<std::string, CommandLine::StringType>* switch_list) { |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 1178 | FlagsState::GetInstance()->RemoveFlagsSwitches(switch_list); |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1179 | } |
| 1180 | |
[email protected] | a314ee5a | 2010-10-26 21:23:28 | [diff] [blame] | 1181 | int GetCurrentPlatform() { |
| 1182 | #if defined(OS_MACOSX) |
| 1183 | return kOsMac; |
| 1184 | #elif defined(OS_WIN) |
| 1185 | return kOsWin; |
| 1186 | #elif defined(OS_CHROMEOS) // Needs to be before the OS_LINUX check. |
| 1187 | return kOsCrOS; |
[email protected] | c92f4ed | 2011-10-21 19:50:21 | [diff] [blame] | 1188 | #elif defined(OS_LINUX) || defined(OS_OPENBSD) |
[email protected] | a314ee5a | 2010-10-26 21:23:28 | [diff] [blame] | 1189 | return kOsLinux; |
[email protected] | 9c7453d | 2012-01-21 00:45:40 | [diff] [blame] | 1190 | #elif defined(OS_ANDROID) |
| 1191 | return kOsAndroid; |
[email protected] | a314ee5a | 2010-10-26 21:23:28 | [diff] [blame] | 1192 | #else |
| 1193 | #error Unknown platform |
| 1194 | #endif |
| 1195 | } |
| 1196 | |
[email protected] | 4bc5050c | 2010-11-18 17:55:54 | [diff] [blame] | 1197 | void RecordUMAStatistics(const PrefService* prefs) { |
| 1198 | std::set<std::string> flags; |
| 1199 | GetEnabledFlags(prefs, &flags); |
| 1200 | for (std::set<std::string>::iterator it = flags.begin(); it != flags.end(); |
| 1201 | ++it) { |
| 1202 | std::string action("AboutFlags_"); |
| 1203 | action += *it; |
[email protected] | 7f6f44c | 2011-12-14 13:23:38 | [diff] [blame] | 1204 | content::RecordComputedAction(action); |
[email protected] | 4bc5050c | 2010-11-18 17:55:54 | [diff] [blame] | 1205 | } |
| 1206 | // Since flag metrics are recorded every startup, add a tick so that the |
| 1207 | // stats can be made meaningful. |
| 1208 | if (flags.size()) |
[email protected] | 7f6f44c | 2011-12-14 13:23:38 | [diff] [blame] | 1209 | content::RecordAction(UserMetricsAction("AboutFlags_StartupTick")); |
| 1210 | content::RecordAction(UserMetricsAction("StartupTick")); |
[email protected] | 4bc5050c | 2010-11-18 17:55:54 | [diff] [blame] | 1211 | } |
| 1212 | |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1213 | ////////////////////////////////////////////////////////////////////////////// |
| 1214 | // FlagsState implementation. |
| 1215 | |
| 1216 | namespace { |
| 1217 | |
| 1218 | void FlagsState::ConvertFlagsToSwitches( |
| 1219 | PrefService* prefs, CommandLine* command_line) { |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1220 | if (command_line->HasSwitch(switches::kNoExperiments)) |
| 1221 | return; |
| 1222 | |
| 1223 | std::set<std::string> enabled_experiments; |
[email protected] | ba816424 | 2010-11-16 21:31:00 | [diff] [blame] | 1224 | |
[email protected] | a314ee5a | 2010-10-26 21:23:28 | [diff] [blame] | 1225 | GetSanitizedEnabledFlagsForCurrentPlatform(prefs, &enabled_experiments); |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1226 | |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 1227 | typedef std::map<std::string, std::pair<std::string, std::string> > |
| 1228 | NameToSwitchAndValueMap; |
| 1229 | NameToSwitchAndValueMap name_to_switch_map; |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1230 | for (size_t i = 0; i < num_experiments; ++i) { |
| 1231 | const Experiment& e = experiments[i]; |
| 1232 | if (e.type == Experiment::SINGLE_VALUE) { |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 1233 | name_to_switch_map[e.internal_name] = |
| 1234 | std::pair<std::string, std::string>(e.command_line_switch, |
| 1235 | e.command_line_value); |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1236 | } else { |
| 1237 | for (int j = 0; j < e.num_choices; ++j) |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 1238 | name_to_switch_map[NameForChoice(e, j)] = |
| 1239 | std::pair<std::string, std::string>( |
| 1240 | e.choices[j].command_line_switch, |
| 1241 | e.choices[j].command_line_value); |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1242 | } |
| 1243 | } |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1244 | |
| 1245 | command_line->AppendSwitch(switches::kFlagSwitchesBegin); |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 1246 | flags_switches_.insert( |
| 1247 | std::pair<std::string, std::string>(switches::kFlagSwitchesBegin, |
| 1248 | std::string())); |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1249 | for (std::set<std::string>::iterator it = enabled_experiments.begin(); |
| 1250 | it != enabled_experiments.end(); |
| 1251 | ++it) { |
| 1252 | const std::string& experiment_name = *it; |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 1253 | NameToSwitchAndValueMap::const_iterator name_to_switch_it = |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1254 | name_to_switch_map.find(experiment_name); |
| 1255 | if (name_to_switch_it == name_to_switch_map.end()) { |
| 1256 | NOTREACHED(); |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1257 | continue; |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1258 | } |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1259 | |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 1260 | const std::pair<std::string, std::string>& |
| 1261 | switch_and_value_pair = name_to_switch_it->second; |
| 1262 | |
| 1263 | command_line->AppendSwitchASCII(switch_and_value_pair.first, |
| 1264 | switch_and_value_pair.second); |
| 1265 | flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second; |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1266 | } |
| 1267 | command_line->AppendSwitch(switches::kFlagSwitchesEnd); |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 1268 | flags_switches_.insert( |
| 1269 | std::pair<std::string, std::string>(switches::kFlagSwitchesEnd, |
| 1270 | std::string())); |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1271 | } |
| 1272 | |
| 1273 | bool FlagsState::IsRestartNeededToCommitChanges() { |
| 1274 | return needs_restart_; |
| 1275 | } |
| 1276 | |
| 1277 | void FlagsState::SetExperimentEnabled( |
| 1278 | PrefService* prefs, const std::string& internal_name, bool enable) { |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1279 | needs_restart_ = true; |
| 1280 | |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1281 | size_t at_index = internal_name.find(about_flags::testing::kMultiSeparator); |
| 1282 | if (at_index != std::string::npos) { |
| 1283 | DCHECK(enable); |
| 1284 | // We're being asked to enable a multi-choice experiment. Disable the |
| 1285 | // currently selected choice. |
| 1286 | DCHECK_NE(at_index, 0u); |
[email protected] | 28e35af | 2011-02-09 12:56:22 | [diff] [blame] | 1287 | const std::string experiment_name = internal_name.substr(0, at_index); |
| 1288 | SetExperimentEnabled(prefs, experiment_name, false); |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1289 | |
[email protected] | 28e35af | 2011-02-09 12:56:22 | [diff] [blame] | 1290 | // And enable the new choice, if it is not the default first choice. |
| 1291 | if (internal_name != experiment_name + "@0") { |
| 1292 | std::set<std::string> enabled_experiments; |
| 1293 | GetSanitizedEnabledFlags(prefs, &enabled_experiments); |
| 1294 | enabled_experiments.insert(internal_name); |
| 1295 | SetEnabledFlags(prefs, enabled_experiments); |
| 1296 | } |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1297 | return; |
| 1298 | } |
| 1299 | |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1300 | std::set<std::string> enabled_experiments; |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 1301 | GetSanitizedEnabledFlags(prefs, &enabled_experiments); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1302 | |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1303 | const Experiment* e = NULL; |
| 1304 | for (size_t i = 0; i < num_experiments; ++i) { |
| 1305 | if (experiments[i].internal_name == internal_name) { |
| 1306 | e = experiments + i; |
| 1307 | break; |
| 1308 | } |
| 1309 | } |
| 1310 | DCHECK(e); |
| 1311 | |
| 1312 | if (e->type == Experiment::SINGLE_VALUE) { |
[email protected] | 8a271368 | 2011-08-19 10:36:59 | [diff] [blame] | 1313 | if (enable) |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1314 | enabled_experiments.insert(internal_name); |
[email protected] | 8a271368 | 2011-08-19 10:36:59 | [diff] [blame] | 1315 | else |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1316 | enabled_experiments.erase(internal_name); |
| 1317 | } else { |
| 1318 | if (enable) { |
| 1319 | // Enable the first choice. |
| 1320 | enabled_experiments.insert(NameForChoice(*e, 0)); |
| 1321 | } else { |
| 1322 | // Find the currently enabled choice and disable it. |
| 1323 | for (int i = 0; i < e->num_choices; ++i) { |
| 1324 | std::string choice_name = NameForChoice(*e, i); |
| 1325 | if (enabled_experiments.find(choice_name) != |
| 1326 | enabled_experiments.end()) { |
| 1327 | enabled_experiments.erase(choice_name); |
| 1328 | // Continue on just in case there's a bug and more than one |
| 1329 | // experiment for this choice was enabled. |
| 1330 | } |
| 1331 | } |
| 1332 | } |
| 1333 | } |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1334 | |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 1335 | SetEnabledFlags(prefs, enabled_experiments); |
[email protected] | ad2a3ded | 2010-08-27 13:19:05 | [diff] [blame] | 1336 | } |
| 1337 | |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1338 | void FlagsState::RemoveFlagsSwitches( |
| 1339 | std::map<std::string, CommandLine::StringType>* switch_list) { |
[email protected] | a8274453 | 2011-02-11 16:15:53 | [diff] [blame] | 1340 | for (std::map<std::string, std::string>::const_iterator |
| 1341 | it = flags_switches_.begin(); it != flags_switches_.end(); ++it) { |
| 1342 | switch_list->erase(it->first); |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1343 | } |
| 1344 | } |
| 1345 | |
| 1346 | void FlagsState::reset() { |
| 1347 | needs_restart_ = false; |
| 1348 | flags_switches_.clear(); |
| 1349 | } |
| 1350 | |
[email protected] | 38e4681 | 2011-05-09 20:49:22 | [diff] [blame] | 1351 | } // namespace |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1352 | |
| 1353 | namespace testing { |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1354 | |
| 1355 | // WARNING: '@' is also used in the html file. If you update this constant you |
| 1356 | // also need to update the html file. |
| 1357 | const char kMultiSeparator[] = "@"; |
| 1358 | |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1359 | void ClearState() { |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 1360 | FlagsState::GetInstance()->reset(); |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1361 | } |
[email protected] | a314ee5a | 2010-10-26 21:23:28 | [diff] [blame] | 1362 | |
| 1363 | void SetExperiments(const Experiment* e, size_t count) { |
| 1364 | if (!e) { |
| 1365 | experiments = kExperiments; |
| 1366 | num_experiments = arraysize(kExperiments); |
| 1367 | } else { |
| 1368 | experiments = e; |
| 1369 | num_experiments = count; |
| 1370 | } |
| 1371 | } |
| 1372 | |
[email protected] | 8a6ff28d | 2010-12-02 16:35:19 | [diff] [blame] | 1373 | const Experiment* GetExperiments(size_t* count) { |
| 1374 | *count = num_experiments; |
| 1375 | return experiments; |
| 1376 | } |
| 1377 | |
[email protected] | e2ddbc9 | 2010-10-15 20:02:07 | [diff] [blame] | 1378 | } // namespace testing |
| 1379 | |
[email protected] | 1a47d7e | 2010-10-15 00:37:24 | [diff] [blame] | 1380 | } // namespace about_flags |