1 // Copyright (c) 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.
5 #include "chrome/browser/about_flags.h"
13 #include "base/command_line.h"
14 #include "base/memory/singleton.h"
15 #include "base/prefs/pref_service.h"
16 #include "base/strings/string_number_conversions.h"
17 #include "base/utf_string_conversions.h"
18 #include "base/values.h"
19 #include "cc/base/switches.h"
20 #include "chrome/browser/prefs/scoped_user_pref_update.h"
21 #include "chrome/common/chrome_content_client.h"
22 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/pref_names.h"
24 #include "content/public/browser/user_metrics.h"
25 #include "grit/chromium_strings.h"
26 #include "grit/generated_resources.h"
27 #include "grit/google_chrome_strings.h"
28 #include "media/base/media_switches.h"
29 #include "ui/app_list/app_list_switches.h"
30 #include "ui/base/l10n/l10n_util.h"
31 #include "ui/base/ui_base_switches.h"
32 #include "ui/gfx/switches.h"
33 #include "ui/gl/gl_switches.h"
34 #include "ui/keyboard/keyboard_switches.h"
35 #include "ui/surface/surface_switches.h"
37 #if defined(ENABLE_MESSAGE_CENTER)
38 #include "ui/message_center/message_center_switches.h"
42 #include "ash/ash_switches.h"
45 #if defined(OS_CHROMEOS)
46 #include "chromeos/chromeos_switches.h"
49 using content::UserMetricsAction
;
51 namespace about_flags
{
53 // Macros to simplify specifying the type.
54 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
55 Experiment::SINGLE_VALUE, \
56 command_line_switch, switch_value, NULL, NULL, NULL, 0
57 #define SINGLE_VALUE_TYPE(command_line_switch) \
58 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "")
59 #define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \
60 disable_switch, disable_value) \
61 Experiment::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \
62 disable_switch, disable_value, NULL, 3
63 #define ENABLE_DISABLE_VALUE_TYPE(enable_switch, disable_switch) \
64 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, "", disable_switch, "")
65 #define MULTI_VALUE_TYPE(choices) \
66 Experiment::MULTI_VALUE, NULL, NULL, NULL, NULL, choices, arraysize(choices)
70 const unsigned kOsAll
= kOsMac
| kOsWin
| kOsLinux
| kOsCrOS
| kOsAndroid
;
71 const unsigned kOsDesktop
= kOsMac
| kOsWin
| kOsLinux
| kOsCrOS
;
73 // Adds a |StringValue| to |list| for each platform where |bitmask| indicates
74 // whether the experiment is available on that platform.
75 void AddOsStrings(unsigned bitmask
, ListValue
* list
) {
78 const char* const name
;
83 {kOsCrOS
, "Chrome OS"},
84 {kOsAndroid
, "Android"},
85 {kOsCrOSOwnerOnly
, "Chrome OS (owner only)"},
87 for (size_t i
= 0; i
< ARRAYSIZE_UNSAFE(kBitsToOs
); ++i
)
88 if (bitmask
& kBitsToOs
[i
].bit
)
89 list
->Append(new StringValue(kBitsToOs
[i
].name
));
92 const Experiment::Choice
93 kOmniboxHistoryQuickProviderReorderForInliningChoices
[] = {
94 { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_AUTOMATIC
,
97 { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_ENABLED
,
98 switches::kOmniboxHistoryQuickProviderReorderForInlining
,
99 switches::kOmniboxHistoryQuickProviderReorderForInliningEnabled
},
100 { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_DISABLED
,
101 switches::kOmniboxHistoryQuickProviderReorderForInlining
,
102 switches::kOmniboxHistoryQuickProviderReorderForInliningDisabled
}
105 const Experiment::Choice kOmniboxInlineHistoryQuickProviderChoices
[] = {
106 { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_AUTOMATIC
, "", "" },
107 { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_ALLOWED
,
108 switches::kOmniboxInlineHistoryQuickProvider
,
109 switches::kOmniboxInlineHistoryQuickProviderAllowed
},
110 { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_PROHIBITED
,
111 switches::kOmniboxInlineHistoryQuickProvider
,
112 switches::kOmniboxInlineHistoryQuickProviderProhibited
}
115 const Experiment::Choice kEnableCompositingForFixedPositionChoices
[] = {
116 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
, "", "" },
117 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED
,
118 switches::kEnableCompositingForFixedPosition
, ""},
119 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED
,
120 switches::kDisableCompositingForFixedPosition
, ""},
121 { IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_HIGH_DPI
,
122 switches::kEnableHighDpiCompositingForFixedPosition
, ""}
125 const Experiment::Choice kGDIPresentChoices
[] = {
126 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
, "", "" },
127 { IDS_FLAGS_PRESENT_WITH_GDI_FIRST_SHOW
,
128 switches::kDoFirstShowPresentWithGDI
, ""},
129 { IDS_FLAGS_PRESENT_WITH_GDI_ALL_SHOW
,
130 switches::kDoAllShowPresentWithGDI
, ""}
133 const Experiment::Choice kTouchEventsChoices
[] = {
134 { IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC
, "", "" },
135 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED
,
136 switches::kTouchEvents
,
137 switches::kTouchEventsEnabled
},
138 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED
,
139 switches::kTouchEvents
,
140 switches::kTouchEventsDisabled
}
143 const Experiment::Choice kTouchOptimizedUIChoices
[] = {
144 { IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC
, "", "" },
145 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED
,
146 switches::kTouchOptimizedUI
,
147 switches::kTouchOptimizedUIEnabled
},
148 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED
,
149 switches::kTouchOptimizedUI
,
150 switches::kTouchOptimizedUIDisabled
}
153 const Experiment::Choice kNaClDebugMaskChoices
[] = {
154 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
, "", "" },
155 // Secure shell can be used on ChromeOS for forwarding the TCP port opened by
156 // debug stub to a remote machine. Since secure shell uses NaCl, we provide
157 // an option to switch off its debugging.
158 { IDS_NACL_DEBUG_MASK_CHOICE_EXCLUDE_UTILS
,
159 switches::kNaClDebugMask
, "!*://*/*ssh_client.nmf" },
160 { IDS_NACL_DEBUG_MASK_CHOICE_INCLUDE_DEBUG
,
161 switches::kNaClDebugMask
, "*://*/*debug.nmf" }
164 #if defined(OS_CHROMEOS)
165 const Experiment::Choice kAshBootAnimationFunction
[] = {
166 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
, "", "" },
167 { IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION2
,
168 ash::switches::kAshBootAnimationFunction2
, ""},
169 { IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION3
,
170 ash::switches::kAshBootAnimationFunction3
, ""}
173 const Experiment::Choice kChromeCaptivePortalDetectionChoices
[] = {
174 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
, "", "" },
175 { IDS_FLAGS_CHROME_CAPTIVE_PORTAL_DETECTOR
,
176 chromeos::switches::kEnableChromeCaptivePortalDetector
, "" },
177 { IDS_FLAGS_SHILL_CAPTIVE_PORTAL_DETECTOR
,
178 chromeos::switches::kDisableChromeCaptivePortalDetector
, "" }
183 const Experiment::Choice kImplSidePaintingChoices
[] = {
184 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
, "", "" },
185 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED
,
186 cc::switches::kEnableImplSidePainting
, ""},
187 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED
,
188 cc::switches::kDisableImplSidePainting
, ""}
191 const Experiment::Choice kMaxTilesForInterestAreaChoices
[] = {
192 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
, "", "" },
193 { IDS_FLAGS_MAX_TILES_FOR_INTEREST_AREA_SHORT
,
194 cc::switches::kMaxTilesForInterestArea
, "64"},
195 { IDS_FLAGS_MAX_TILES_FOR_INTEREST_AREA_TALL
,
196 cc::switches::kMaxTilesForInterestArea
, "128"},
197 { IDS_FLAGS_MAX_TILES_FOR_INTEREST_AREA_GRANDE
,
198 cc::switches::kMaxTilesForInterestArea
, "256"},
199 { IDS_FLAGS_MAX_TILES_FOR_INTEREST_AREA_VENTI
,
200 cc::switches::kMaxTilesForInterestArea
, "512"}
203 const Experiment::Choice kDefaultTileWidthChoices
[] = {
204 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
, "", "" },
205 { IDS_FLAGS_DEFAULT_TILE_WIDTH_SHORT
,
206 switches::kDefaultTileWidth
, "128"},
207 { IDS_FLAGS_DEFAULT_TILE_WIDTH_TALL
,
208 switches::kDefaultTileWidth
, "256"},
209 { IDS_FLAGS_DEFAULT_TILE_WIDTH_GRANDE
,
210 switches::kDefaultTileWidth
, "512"},
211 { IDS_FLAGS_DEFAULT_TILE_WIDTH_VENTI
,
212 switches::kDefaultTileWidth
, "1024"}
215 const Experiment::Choice kDefaultTileHeightChoices
[] = {
216 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
, "", "" },
217 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_SHORT
,
218 switches::kDefaultTileHeight
, "128"},
219 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_TALL
,
220 switches::kDefaultTileHeight
, "256"},
221 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_GRANDE
,
222 switches::kDefaultTileHeight
, "512"},
223 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_VENTI
,
224 switches::kDefaultTileHeight
, "1024"}
227 const Experiment::Choice kSimpleCacheBackendChoices
[] = {
228 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
, "", "" },
229 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED
,
230 switches::kUseSimpleCacheBackend
, "off" },
231 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED
,
232 switches::kUseSimpleCacheBackend
, "on"}
235 // RECORDING USER METRICS FOR FLAGS:
236 // -----------------------------------------------------------------------------
237 // The first line of the experiment is the internal name. If you'd like to
238 // gather statistics about the usage of your flag, you should append a marker
239 // comment to the end of the feature name, like so:
240 // "my-special-feature", // FLAGS:RECORD_UMA
242 // After doing that, run //chrome/tools/extract_actions.py (see instructions at
243 // the top of that file for details) to update the chromeactions.txt file, which
244 // will enable UMA to record your feature flag.
246 // After your feature has shipped under a flag, you can locate the metrics under
247 // the action name AboutFlags_internal-action-name. Actions are recorded once
248 // per startup, so you should divide this number by AboutFlags_StartupTick to
249 // get a sense of usage. Note that this will not be the same as number of users
250 // with a given feature enabled because users can quit and relaunch the
251 // application multiple times over a given time interval. The dashboard also
252 // shows you how many (metrics reporting) users have enabled the flag over the
253 // last seven days. However, note that this is not the same as the number of
254 // users who have the flag enabled, since enabling the flag happens once,
255 // whereas running with the flag enabled happens until the user flips the flag
258 // To add a new experiment add to the end of kExperiments. There are two
259 // distinct types of experiments:
260 // . SINGLE_VALUE: experiment is either on or off. Use the SINGLE_VALUE_TYPE
261 // macro for this type supplying the command line to the macro.
262 // . MULTI_VALUE: a list of choices, the first of which should correspond to a
263 // deactivated state for this lab (i.e. no command line option). To specify
264 // this type of experiment use the macro MULTI_VALUE_TYPE supplying it the
266 // See the documentation of Experiment for details on the fields.
268 // When adding a new choice, add it to the end of the list.
269 const Experiment kExperiments
[] = {
271 "expose-for-tabs", // FLAGS:RECORD_UMA
272 IDS_FLAGS_TABPOSE_NAME
,
273 IDS_FLAGS_TABPOSE_DESCRIPTION
,
275 #if defined(OS_MACOSX)
276 // The switch exists only on OS X.
277 SINGLE_VALUE_TYPE(switches::kEnableExposeForTabs
)
279 SINGLE_VALUE_TYPE("")
283 "conflicting-modules-check", // FLAGS:RECORD_UMA
284 IDS_FLAGS_CONFLICTS_CHECK_NAME
,
285 IDS_FLAGS_CONFLICTS_CHECK_DESCRIPTION
,
287 SINGLE_VALUE_TYPE(switches::kConflictingModulesCheck
)
290 "cloud-print-proxy", // FLAGS:RECORD_UMA
291 IDS_FLAGS_CLOUD_PRINT_CONNECTOR_NAME
,
292 IDS_FLAGS_CLOUD_PRINT_CONNECTOR_DESCRIPTION
,
293 // For a Chrome build, we know we have a PDF plug-in on Windows, so it's
295 // Otherwise, where we know Windows could be working if a viable PDF
296 // plug-in could be supplied, we'll keep the lab enabled. Mac and Linux
297 // always have PDF rasterization available, so no flag needed there.
298 #if !defined(GOOGLE_CHROME_BUILD)
303 SINGLE_VALUE_TYPE(switches::kEnableCloudPrintProxy
)
308 IDS_FLAGS_PRINT_RASTER_NAME
,
309 IDS_FLAGS_PRINT_RASTER_DESCRIPTION
,
311 SINGLE_VALUE_TYPE(switches::kPrintRaster
)
315 "ignore-gpu-blacklist",
316 IDS_FLAGS_IGNORE_GPU_BLACKLIST_NAME
,
317 IDS_FLAGS_IGNORE_GPU_BLACKLIST_DESCRIPTION
,
319 SINGLE_VALUE_TYPE(switches::kIgnoreGpuBlacklist
)
322 "force-compositing-mode-2",
323 IDS_FLAGS_FORCE_COMPOSITING_MODE_NAME
,
324 IDS_FLAGS_FORCE_COMPOSITING_MODE_DESCRIPTION
,
325 kOsMac
| kOsWin
| kOsLinux
,
326 ENABLE_DISABLE_VALUE_TYPE(switches::kForceCompositingMode
,
327 switches::kDisableForceCompositingMode
)
330 "threaded-compositing-mode",
331 IDS_FLAGS_THREADED_COMPOSITING_MODE_NAME
,
332 IDS_FLAGS_THREADED_COMPOSITING_MODE_DESCRIPTION
,
333 kOsMac
| kOsWin
| kOsLinux
,
334 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableThreadedCompositing
,
335 switches::kDisableThreadedCompositing
)
338 "force-accelerated-composited-scrolling",
339 IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_NAME
,
340 IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_DESCRIPTION
,
342 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableAcceleratedOverflowScroll
,
343 switches::kDisableAcceleratedOverflowScroll
)
347 IDS_FLAGS_PRESENT_WITH_GDI_NAME
,
348 IDS_FLAGS_PRESENT_WITH_GDI_DESCRIPTION
,
350 MULTI_VALUE_TYPE(kGDIPresentChoices
)
353 "enable-experimental-canvas-features",
354 IDS_FLAGS_ENABLE_EXPERIMENTAL_CANVAS_FEATURES_NAME
,
355 IDS_FLAGS_ENABLE_EXPERIMENTAL_CANVAS_FEATURES_DESCRIPTION
,
357 SINGLE_VALUE_TYPE(switches::kEnableExperimentalCanvasFeatures
)
360 "disable-accelerated-2d-canvas",
361 IDS_FLAGS_DISABLE_ACCELERATED_2D_CANVAS_NAME
,
362 IDS_FLAGS_DISABLE_ACCELERATED_2D_CANVAS_DESCRIPTION
,
364 SINGLE_VALUE_TYPE(switches::kDisableAccelerated2dCanvas
)
367 "disable-threaded-animation",
368 IDS_FLAGS_DISABLE_THREADED_ANIMATION_NAME
,
369 IDS_FLAGS_DISABLE_THREADED_ANIMATION_DESCRIPTION
,
371 SINGLE_VALUE_TYPE(cc::switches::kDisableThreadedAnimation
)
374 "composited-layer-borders",
375 IDS_FLAGS_COMPOSITED_LAYER_BORDERS
,
376 IDS_FLAGS_COMPOSITED_LAYER_BORDERS_DESCRIPTION
,
378 SINGLE_VALUE_TYPE(cc::switches::kShowCompositedLayerBorders
)
382 IDS_FLAGS_SHOW_FPS_COUNTER
,
383 IDS_FLAGS_SHOW_FPS_COUNTER_DESCRIPTION
,
385 SINGLE_VALUE_TYPE(cc::switches::kShowFPSCounter
)
388 "accelerated-filters",
389 IDS_FLAGS_ACCELERATED_FILTERS
,
390 IDS_FLAGS_ACCELERATED_FILTERS_DESCRIPTION
,
392 SINGLE_VALUE_TYPE(switches::kEnableAcceleratedFilters
)
396 IDS_FLAGS_DISABLE_GPU_VSYNC_NAME
,
397 IDS_FLAGS_DISABLE_GPU_VSYNC_DESCRIPTION
,
399 SINGLE_VALUE_TYPE(switches::kDisableGpuVsync
)
403 IDS_FLAGS_ENABLE_WEBGL_NAME
,
404 IDS_FLAGS_ENABLE_WEBGL_DESCRIPTION
,
406 #if defined(OS_ANDROID)
407 SINGLE_VALUE_TYPE(switches::kEnableExperimentalWebGL
)
409 SINGLE_VALUE_TYPE("")
414 IDS_FLAGS_DISABLE_WEBGL_NAME
,
415 IDS_FLAGS_DISABLE_WEBGL_DESCRIPTION
,
417 #if defined(OS_ANDROID)
418 SINGLE_VALUE_TYPE("")
420 SINGLE_VALUE_TYPE(switches::kDisableExperimentalWebGL
)
425 IDS_FLAGS_DISABLE_WEBRTC_NAME
,
426 IDS_FLAGS_DISABLE_WEBRTC_DESCRIPTION
,
428 #if defined(OS_ANDROID)
429 SINGLE_VALUE_TYPE(switches::kDisableWebRTC
)
431 SINGLE_VALUE_TYPE("")
434 #if defined(OS_ANDROID)
437 IDS_FLAGS_ENABLE_WEBAUDIO_NAME
,
438 IDS_FLAGS_ENABLE_WEBAUDIO_DESCRIPTION
,
440 SINGLE_VALUE_TYPE(switches::kEnableWebAudio
)
444 "fixed-position-creates-stacking-context",
445 IDS_FLAGS_FIXED_POSITION_CREATES_STACKING_CONTEXT_NAME
,
446 IDS_FLAGS_FIXED_POSITION_CREATES_STACKING_CONTEXT_DESCRIPTION
,
448 ENABLE_DISABLE_VALUE_TYPE(
449 switches::kEnableFixedPositionCreatesStackingContext
,
450 switches::kDisableFixedPositionCreatesStackingContext
)
453 "enable-compositing-for-fixed-position",
454 IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_NAME
,
455 IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_DESCRIPTION
,
457 MULTI_VALUE_TYPE(kEnableCompositingForFixedPositionChoices
)
459 // TODO(bbudge): When NaCl is on by default, remove this flag entry.
461 "enable-nacl", // FLAGS:RECORD_UMA
462 IDS_FLAGS_ENABLE_NACL_NAME
,
463 IDS_FLAGS_ENABLE_NACL_DESCRIPTION
,
465 SINGLE_VALUE_TYPE(switches::kEnableNaCl
)
468 "enable-nacl-debug", // FLAGS:RECORD_UMA
469 IDS_FLAGS_ENABLE_NACL_DEBUG_NAME
,
470 IDS_FLAGS_ENABLE_NACL_DEBUG_DESCRIPTION
,
472 SINGLE_VALUE_TYPE(switches::kEnableNaClDebug
)
475 "nacl-debug-mask", // FLAGS:RECORD_UMA
476 IDS_FLAGS_NACL_DEBUG_MASK_NAME
,
477 IDS_FLAGS_NACL_DEBUG_MASK_DESCRIPTION
,
479 MULTI_VALUE_TYPE(kNaClDebugMaskChoices
)
482 "enable-pnacl", // FLAGS:RECORD_UMA
483 IDS_FLAGS_ENABLE_PNACL_NAME
,
484 IDS_FLAGS_ENABLE_PNACL_DESCRIPTION
,
486 SINGLE_VALUE_TYPE(switches::kEnablePnacl
)
489 "extension-apis", // FLAGS:RECORD_UMA
490 IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_NAME
,
491 IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_DESCRIPTION
,
493 SINGLE_VALUE_TYPE(switches::kEnableExperimentalExtensionApis
)
496 "extensions-on-chrome-urls",
497 IDS_FLAGS_EXTENSIONS_ON_CHROME_URLS_NAME
,
498 IDS_FLAGS_EXTENSIONS_ON_CHROME_URLS_DESCRIPTION
,
500 SINGLE_VALUE_TYPE(switches::kExtensionsOnChromeURLs
)
504 IDS_FLAGS_ENABLE_ADVIEW_NAME
,
505 IDS_FLAGS_ENABLE_ADVIEW_DESCRIPTION
,
507 SINGLE_VALUE_TYPE(switches::kEnableAdview
)
510 "enable-adview-src-attribute",
511 IDS_FLAGS_ENABLE_ADVIEW_SRC_ATTRIBUTE_NAME
,
512 IDS_FLAGS_ENABLE_ADVIEW_SRC_ATTRIBUTE_DESCRIPTION
,
514 SINGLE_VALUE_TYPE(switches::kEnableAdviewSrcAttribute
)
518 IDS_FLAGS_ACTION_BOX_NAME
,
519 IDS_FLAGS_ACTION_BOX_DESCRIPTION
,
521 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kActionBox
, "1",
522 switches::kActionBox
, "0")
526 IDS_FLAGS_SCRIPT_BADGES_NAME
,
527 IDS_FLAGS_SCRIPT_BADGES_DESCRIPTION
,
529 SINGLE_VALUE_TYPE(switches::kScriptBadges
)
533 IDS_FLAGS_SCRIPT_BUBBLE_NAME
,
534 IDS_FLAGS_SCRIPT_BUBBLE_DESCRIPTION
,
536 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kScriptBubble
, "1",
537 switches::kScriptBubble
, "0")
540 "apps-new-install-bubble",
541 IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_NAME
,
542 IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_DESCRIPTION
,
544 SINGLE_VALUE_TYPE(switches::kAppsNewInstallBubble
)
547 "disable-hyperlink-auditing",
548 IDS_FLAGS_DISABLE_HYPERLINK_AUDITING_NAME
,
549 IDS_FLAGS_DISABLE_HYPERLINK_AUDITING_DESCRIPTION
,
551 SINGLE_VALUE_TYPE(switches::kNoPings
)
554 "experimental-location-features", // FLAGS:RECORD_UMA
555 IDS_FLAGS_EXPERIMENTAL_LOCATION_FEATURES_NAME
,
556 IDS_FLAGS_EXPERIMENTAL_LOCATION_FEATURES_DESCRIPTION
,
557 kOsMac
| kOsWin
| kOsLinux
, // Currently does nothing on CrOS.
558 SINGLE_VALUE_TYPE(switches::kExperimentalLocationFeatures
)
561 "tab-groups-context-menu",
562 IDS_FLAGS_TAB_GROUPS_CONTEXT_MENU_NAME
,
563 IDS_FLAGS_TAB_GROUPS_CONTEXT_MENU_DESCRIPTION
,
565 SINGLE_VALUE_TYPE(switches::kEnableTabGroupsContextMenu
)
568 "enable-instant-extended-api",
569 IDS_FLAGS_ENABLE_INSTANT_EXTENDED_API
,
570 IDS_FLAGS_ENABLE_INSTANT_EXTENDED_API_DESCRIPTION
,
572 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableInstantExtendedAPI
,
573 switches::kDisableInstantExtendedAPI
)
576 "enable-local-first-load-ntp",
577 IDS_FLAGS_ENABLE_LOCAL_FIRST_LOAD_NTP
,
578 IDS_FLAGS_ENABLE_LOCAL_FIRST_LOAD_NTP_DESCRIPTION
,
580 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableLocalFirstLoadNTP
,
581 switches::kDisableLocalFirstLoadNTP
)
584 "enable-local-only-instant-extended-api",
585 IDS_FLAGS_ENABLE_LOCAL_ONLY_INSTANT_EXTENDED_API
,
586 IDS_FLAGS_ENABLE_LOCAL_ONLY_INSTANT_EXTENDED_API_DESCRIPTION
,
588 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableLocalOnlyInstantExtendedAPI
,
589 switches::kDisableLocalOnlyInstantExtendedAPI
)
593 IDS_FLAGS_STATIC_IP_CONFIG_NAME
,
594 IDS_FLAGS_STATIC_IP_CONFIG_DESCRIPTION
,
596 #if defined(OS_CHROMEOS)
597 // This switch exists only on Chrome OS.
598 SINGLE_VALUE_TYPE(chromeos::switches::kEnableStaticIPConfig
)
600 SINGLE_VALUE_TYPE("")
604 "show-autofill-type-predictions",
605 IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_NAME
,
606 IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_DESCRIPTION
,
608 SINGLE_VALUE_TYPE(autofill::switches::kShowAutofillTypePredictions
)
611 "enable-sync-favicons",
612 IDS_FLAGS_ENABLE_SYNC_FAVICONS_NAME
,
613 IDS_FLAGS_ENABLE_SYNC_FAVICONS_DESCRIPTION
,
615 SINGLE_VALUE_TYPE(switches::kEnableSyncFavicons
)
618 "sync-keystore-encryption",
619 IDS_FLAGS_SYNC_KEYSTORE_ENCRYPTION_NAME
,
620 IDS_FLAGS_SYNC_KEYSTORE_ENCRYPTION_DESCRIPTION
,
622 SINGLE_VALUE_TYPE(switches::kSyncKeystoreEncryption
)
625 "enable-gesture-tap-highlight",
626 IDS_FLAGS_ENABLE_GESTURE_TAP_HIGHLIGHTING_NAME
,
627 IDS_FLAGS_ENABLE_GESTURE_TAP_HIGHLIGHTING_DESCRIPTION
,
629 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableGestureTapHighlight
,
630 switches::kDisableGestureTapHighlight
)
633 "enable-smooth-scrolling", // FLAGS:RECORD_UMA
634 IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_NAME
,
635 IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_DESCRIPTION
,
636 // Can't expose the switch unless the code is compiled in.
637 // On by default for the Mac (different implementation in WebKit).
639 SINGLE_VALUE_TYPE(switches::kEnableSmoothScrolling
)
642 "omnibox-history-quick-provider-reorder-for-inlining",
643 IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_NAME
,
644 IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_REORDER_FOR_INLINING_DESCRIPTION
,
646 MULTI_VALUE_TYPE(kOmniboxHistoryQuickProviderReorderForInliningChoices
)
649 "omnibox-inline-history-quick-provider",
650 IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_NAME
,
651 IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_DESCRIPTION
,
653 MULTI_VALUE_TYPE(kOmniboxInlineHistoryQuickProviderChoices
)
657 IDS_FLAGS_ENABLE_PANELS_NAME
,
658 IDS_FLAGS_ENABLE_PANELS_DESCRIPTION
,
660 SINGLE_VALUE_TYPE(switches::kEnablePanels
)
663 // See http://crbug.com/120416 for how to remove this flag.
664 "save-page-as-mhtml", // FLAGS:RECORD_UMA
665 IDS_FLAGS_SAVE_PAGE_AS_MHTML_NAME
,
666 IDS_FLAGS_SAVE_PAGE_AS_MHTML_DESCRIPTION
,
667 kOsMac
| kOsWin
| kOsLinux
,
668 SINGLE_VALUE_TYPE(switches::kSavePageAsMHTML
)
672 IDS_FLAGS_ENABLE_AUTOLOGIN_NAME
,
673 IDS_FLAGS_ENABLE_AUTOLOGIN_DESCRIPTION
,
674 kOsMac
| kOsWin
| kOsLinux
,
675 SINGLE_VALUE_TYPE(switches::kEnableAutologin
)
679 IDS_FLAGS_ENABLE_SPDY4A1_NAME
,
680 IDS_FLAGS_ENABLE_SPDY4A1_DESCRIPTION
,
682 SINGLE_VALUE_TYPE(switches::kEnableSpdy4a1
)
686 IDS_FLAGS_ENABLE_ASYNC_DNS_NAME
,
687 IDS_FLAGS_ENABLE_ASYNC_DNS_DESCRIPTION
,
688 kOsWin
| kOsMac
| kOsLinux
| kOsCrOS
,
689 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableAsyncDns
,
690 switches::kDisableAsyncDns
)
693 "disable-media-source",
694 IDS_FLAGS_DISABLE_MEDIA_SOURCE_NAME
,
695 IDS_FLAGS_DISABLE_MEDIA_SOURCE_DESCRIPTION
,
697 SINGLE_VALUE_TYPE(switches::kDisableMediaSource
)
700 "disable-encrypted-media",
701 IDS_FLAGS_DISABLE_ENCRYPTED_MEDIA_NAME
,
702 IDS_FLAGS_DISABLE_ENCRYPTED_MEDIA_DESCRIPTION
,
704 SINGLE_VALUE_TYPE(switches::kDisableEncryptedMedia
)
707 "enable-opus-playback",
708 IDS_FLAGS_ENABLE_OPUS_PLAYBACK_NAME
,
709 IDS_FLAGS_ENABLE_OPUS_PLAYBACK_DESCRIPTION
,
711 SINGLE_VALUE_TYPE(switches::kEnableOpusPlayback
)
714 "enable-vp9-playback",
715 IDS_FLAGS_ENABLE_VP9_PLAYBACK_NAME
,
716 IDS_FLAGS_ENABLE_VP9_PLAYBACK_DESCRIPTION
,
718 SINGLE_VALUE_TYPE(switches::kEnableVp9Playback
)
721 "enable-vp8-alpha-playback",
722 IDS_FLAGS_ENABLE_VP8_ALPHA_PLAYBACK_NAME
,
723 IDS_FLAGS_ENABLE_VP8_ALPHA_PLAYBACK_DESCRIPTION
,
725 SINGLE_VALUE_TYPE(switches::kEnableVp8AlphaPlayback
)
728 "enable-managed-users",
729 IDS_FLAGS_ENABLE_LOCALLY_MANAGED_USERS_NAME
,
730 IDS_FLAGS_ENABLE_LOCALLY_MANAGED_USERS_DESCRIPTION
,
731 kOsMac
| kOsWin
| kOsLinux
| kOsAndroid
| kOsCrOSOwnerOnly
,
732 SINGLE_VALUE_TYPE(switches::kEnableManagedUsers
)
736 "ash-disable-auto-maximizing",
737 IDS_FLAGS_ASH_AUTO_MAXIMIZING_NAME
,
738 IDS_FLAGS_ASH_AUTO_MAXIMIZING_DESCRIPTION
,
739 kOsWin
| kOsLinux
| kOsCrOS
,
740 SINGLE_VALUE_TYPE(ash::switches::kAshDisableAutoMaximizing
)
743 "ash-disable-auto-window-placement",
744 IDS_FLAGS_ASH_AUTO_WINDOW_PLACEMENT_NAME
,
745 IDS_FLAGS_ASH_AUTO_WINDOW_PLACEMENT_DESCRIPTION
,
746 kOsWin
| kOsLinux
| kOsCrOS
,
747 SINGLE_VALUE_TYPE(ash::switches::kAshDisableAutoWindowPlacement
)
750 "ash-disable-per-app-launcher",
751 IDS_FLAGS_ASH_DISABLE_PER_APP_LAUNCHER_NAME
,
752 IDS_FLAGS_ASH_DISABLE_PER_APP_LAUNCHER_DESCRIPTION
,
753 kOsWin
| kOsLinux
| kOsCrOS
,
754 SINGLE_VALUE_TYPE(ash::switches::kAshDisablePerAppLauncher
)
759 IDS_FLAGS_PER_TILE_PAINTING_NAME
,
760 IDS_FLAGS_PER_TILE_PAINTING_DESCRIPTION
,
761 kOsMac
| kOsLinux
| kOsCrOS
,
762 SINGLE_VALUE_TYPE(cc::switches::kEnablePerTilePainting
)
765 "enable-javascript-harmony",
766 IDS_FLAGS_ENABLE_JAVASCRIPT_HARMONY_NAME
,
767 IDS_FLAGS_ENABLE_JAVASCRIPT_HARMONY_DESCRIPTION
,
769 SINGLE_VALUE_TYPE_AND_VALUE(switches::kJavaScriptFlags
, "--harmony")
772 "enable-tab-browser-dragging",
773 IDS_FLAGS_ENABLE_TAB_BROWSER_DRAGGING_NAME
,
774 IDS_FLAGS_ENABLE_TAB_BROWSER_DRAGGING_DESCRIPTION
,
776 SINGLE_VALUE_TYPE(switches::kTabBrowserDragging
)
779 "disable-restore-session-state",
780 IDS_FLAGS_DISABLE_RESTORE_SESSION_STATE_NAME
,
781 IDS_FLAGS_DISABLE_RESTORE_SESSION_STATE_DESCRIPTION
,
783 SINGLE_VALUE_TYPE(switches::kDisableRestoreSessionState
)
786 "disable-software-rasterizer",
787 IDS_FLAGS_DISABLE_SOFTWARE_RASTERIZER_NAME
,
788 IDS_FLAGS_DISABLE_SOFTWARE_RASTERIZER_DESCRIPTION
,
789 #if defined(ENABLE_SWIFTSHADER)
794 SINGLE_VALUE_TYPE(switches::kDisableSoftwareRasterizer
)
797 "enable-experimental-webkit-features",
798 IDS_FLAGS_EXPERIMENTAL_WEBKIT_FEATURES_NAME
,
799 IDS_FLAGS_EXPERIMENTAL_WEBKIT_FEATURES_DESCRIPTION
,
801 SINGLE_VALUE_TYPE(switches::kEnableExperimentalWebKitFeatures
)
804 "enable-css-shaders",
805 IDS_FLAGS_CSS_SHADERS_NAME
,
806 IDS_FLAGS_CSS_SHADERS_DESCRIPTION
,
808 SINGLE_VALUE_TYPE(switches::kEnableCssShaders
)
811 "enable-extension-activity-ui",
812 IDS_FLAGS_ENABLE_EXTENSION_ACTIVITY_UI_NAME
,
813 IDS_FLAGS_ENABLE_EXTENSION_ACTIVITY_UI_DESCRIPTION
,
815 SINGLE_VALUE_TYPE(switches::kEnableExtensionActivityUI
)
818 "disable-ntp-other-sessions-menu",
819 IDS_FLAGS_NTP_OTHER_SESSIONS_MENU_NAME
,
820 IDS_FLAGS_NTP_OTHER_SESSIONS_MENU_DESCRIPTION
,
822 SINGLE_VALUE_TYPE(switches::kDisableNTPOtherSessionsMenu
)
827 IDS_FLAGS_ENABLE_ASH_OAK_NAME
,
828 IDS_FLAGS_ENABLE_ASH_OAK_DESCRIPTION
,
830 SINGLE_VALUE_TYPE(ash::switches::kAshEnableOak
),
834 "enable-devtools-experiments",
835 IDS_FLAGS_ENABLE_DEVTOOLS_EXPERIMENTS_NAME
,
836 IDS_FLAGS_ENABLE_DEVTOOLS_EXPERIMENTS_DESCRIPTION
,
838 SINGLE_VALUE_TYPE(switches::kEnableDevToolsExperiments
)
841 "silent-debugger-extension-api",
842 IDS_FLAGS_SILENT_DEBUGGER_EXTENSION_API_NAME
,
843 IDS_FLAGS_SILENT_DEBUGGER_EXTENSION_API_DESCRIPTION
,
845 SINGLE_VALUE_TYPE(switches::kSilentDebuggerExtensionAPI
)
848 "enable-suggestions-ntp",
849 IDS_FLAGS_NTP_SUGGESTIONS_PAGE_NAME
,
850 IDS_FLAGS_NTP_SUGGESTIONS_PAGE_DESCRIPTION
,
852 SINGLE_VALUE_TYPE(switches::kEnableSuggestionsTabPage
)
855 "spellcheck-autocorrect",
856 IDS_FLAGS_SPELLCHECK_AUTOCORRECT
,
857 IDS_FLAGS_SPELLCHECK_AUTOCORRECT_DESCRIPTION
,
858 kOsWin
| kOsLinux
| kOsCrOS
,
859 SINGLE_VALUE_TYPE(switches::kEnableSpellingAutoCorrect
)
863 IDS_TOUCH_EVENTS_NAME
,
864 IDS_TOUCH_EVENTS_DESCRIPTION
,
866 MULTI_VALUE_TYPE(kTouchEventsChoices
)
869 "touch-optimized-ui",
870 IDS_FLAGS_TOUCH_OPTIMIZED_UI_NAME
,
871 IDS_FLAGS_TOUCH_OPTIMIZED_UI_DESCRIPTION
,
873 MULTI_VALUE_TYPE(kTouchOptimizedUIChoices
)
876 "disable-touch-adjustment",
877 IDS_DISABLE_TOUCH_ADJUSTMENT_NAME
,
878 IDS_DISABLE_TOUCH_ADJUSTMENT_DESCRIPTION
,
879 kOsWin
| kOsLinux
| kOsCrOS
,
880 SINGLE_VALUE_TYPE(switches::kDisableTouchAdjustment
)
883 "enable-tab-capture",
884 IDS_ENABLE_TAB_CAPTURE_NAME
,
885 IDS_ENABLE_TAB_CAPTURE_DESCRIPTION
,
886 kOsWin
| kOsMac
| kOsLinux
| kOsCrOS
,
887 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kTabCapture
, "1",
888 switches::kTabCapture
, "0")
890 #if defined(OS_CHROMEOS)
892 "enable-background-loader",
893 IDS_ENABLE_BACKLOADER_NAME
,
894 IDS_ENABLE_BACKLOADER_DESCRIPTION
,
896 SINGLE_VALUE_TYPE(chromeos::switches::kEnableBackgroundLoader
)
899 "enable-bezel-touch",
900 IDS_ENABLE_BEZEL_TOUCH_NAME
,
901 IDS_ENABLE_BEZEL_TOUCH_DESCRIPTION
,
903 SINGLE_VALUE_TYPE(switches::kEnableBezelTouch
)
906 "enable-screensaver-extension",
907 IDS_ENABLE_SCREENSAVER_EXTENSION_NAME
,
908 IDS_ENABLE_SCREENSAVER_EXTENSION_DESCRIPTION
,
910 SINGLE_VALUE_TYPE(chromeos::switches::kEnableScreensaverExtensions
)
914 IDS_FLAGS_NO_DISCARD_TABS_NAME
,
915 IDS_FLAGS_NO_DISCARD_TABS_DESCRIPTION
,
917 SINGLE_VALUE_TYPE(chromeos::switches::kNoDiscardTabs
)
921 "enable-download-resumption",
922 IDS_FLAGS_ENABLE_DOWNLOAD_RESUMPTION_NAME
,
923 IDS_FLAGS_ENABLE_DOWNLOAD_RESUMPTION_DESCRIPTION
,
925 SINGLE_VALUE_TYPE(switches::kEnableDownloadResumption
)
928 "allow-nacl-socket-api",
929 IDS_FLAGS_ALLOW_NACL_SOCKET_API_NAME
,
930 IDS_FLAGS_ALLOW_NACL_SOCKET_API_DESCRIPTION
,
932 SINGLE_VALUE_TYPE_AND_VALUE(switches::kAllowNaClSocketAPI
, "*")
936 IDS_FLAGS_STACKED_TAB_STRIP_NAME
,
937 IDS_FLAGS_STACKED_TAB_STRIP_DESCRIPTION
,
939 SINGLE_VALUE_TYPE(switches::kEnableStackedTabStrip
)
942 "force-device-scale-factor",
943 IDS_FLAGS_FORCE_HIGH_DPI_NAME
,
944 IDS_FLAGS_FORCE_HIGH_DPI_DESCRIPTION
,
946 SINGLE_VALUE_TYPE_AND_VALUE(switches::kForceDeviceScaleFactor
, "2")
948 #if defined(OS_CHROMEOS)
950 "allow-touchpad-three-finger-click",
951 IDS_FLAGS_ALLOW_TOUCHPAD_THREE_FINGER_CLICK_NAME
,
952 IDS_FLAGS_ALLOW_TOUCHPAD_THREE_FINGER_CLICK_DESCRIPTION
,
954 SINGLE_VALUE_TYPE(chromeos::switches::kEnableTouchpadThreeFingerClick
)
957 "allow-touchpad-three-finger-swipe",
958 IDS_FLAGS_ALLOW_TOUCHPAD_THREE_FINGER_SWIPE_NAME
,
959 IDS_FLAGS_ALLOW_TOUCHPAD_THREE_FINGER_SWIPE_DESCRIPTION
,
961 SINGLE_VALUE_TYPE(chromeos::switches::kEnableTouchpadThreeFingerSwipe
)
965 "use-client-login-signin-flow",
966 IDS_FLAGS_USE_CLIENT_LOGIN_SIGNIN_FLOW_NAME
,
967 IDS_FLAGS_USE_CLIENT_LOGIN_SIGNIN_FLOW_DESCRIPTION
,
968 kOsMac
| kOsWin
| kOsLinux
,
969 SINGLE_VALUE_TYPE(switches::kUseClientLoginSigninFlow
)
972 "enable-desktop-guest-mode",
973 IDS_FLAGS_DESKTOP_GUEST_MODE_NAME
,
974 IDS_FLAGS_DESKTOP_GUEST_MODE_DESCRIPTION
,
975 kOsMac
| kOsWin
| kOsLinux
,
976 SINGLE_VALUE_TYPE(switches::kEnableDesktopGuestMode
)
980 "show-launcher-alignment-menu",
981 IDS_FLAGS_SHOW_LAUNCHER_ALIGNMENT_MENU_NAME
,
982 IDS_FLAGS_SHOW_LAUNCHER_ALIGNMENT_MENU_DESCRIPTION
,
984 SINGLE_VALUE_TYPE(switches::kShowLauncherAlignmentMenu
)
987 "disable-minimize-on-second-launcher-item-click",
988 IDS_FLAGS_DISABLE_MINIMIZE_ON_SECOND_LAUNCHER_ITEM_CLICK_NAME
,
989 IDS_FLAGS_DISABLE_MINIMIZE_ON_SECOND_LAUNCHER_ITEM_CLICK_DESCRIPTION
,
991 SINGLE_VALUE_TYPE(switches::kDisableMinimizeOnSecondLauncherItemClick
)
995 IDS_FLAGS_SHOW_TOUCH_HUD_NAME
,
996 IDS_FLAGS_SHOW_TOUCH_HUD_DESCRIPTION
,
998 SINGLE_VALUE_TYPE(ash::switches::kAshTouchHud
)
1002 IDS_FLAGS_ENABLE_PINCH_SCALE_NAME
,
1003 IDS_FLAGS_ENABLE_PINCH_SCALE_DESCRIPTION
,
1004 kOsLinux
| kOsWin
| kOsCrOS
,
1005 ENABLE_DISABLE_VALUE_TYPE(switches::kEnablePinch
, switches::kDisablePinch
),
1008 "pinch-zoom-scrollbars",
1009 IDS_FLAGS_PINCH_ZOOM_SCROLLBARS_NAME
,
1010 IDS_FLAGS_PINCH_ZOOM_SCROLLBARS_DESCRIPTION
,
1012 ENABLE_DISABLE_VALUE_TYPE(cc::switches::kEnablePinchZoomScrollbars
,
1013 cc::switches::kDisablePinchZoomScrollbars
)
1016 "app-list-show-apps-only",
1017 IDS_FLAGS_ENABLE_APP_LIST_SHOW_APPS_ONLY_NAME
,
1018 IDS_FLAGS_ENABLE_APP_LIST_SHOW_APPS_ONLY_DESCRIPTION
,
1020 SINGLE_VALUE_TYPE(app_list::switches::kAppListShowAppsOnly
),
1023 "forced-maximize-mode",
1024 IDS_FLAGS_FORCE_MAXIMIZE_MODE_NAME
,
1025 IDS_FLAGS_FORCE_MAXIMIZE_MODE_DESCRIPTION
,
1026 kOsLinux
| kOsWin
| kOsCrOS
,
1027 SINGLE_VALUE_TYPE(ash::switches::kForcedMaximizeMode
),
1029 #endif // defined(USE_ASH)
1030 #if defined(OS_CHROMEOS)
1032 "disable-boot-animation",
1033 IDS_FLAGS_DISABLE_BOOT_ANIMATION
,
1034 IDS_FLAGS_DISABLE_BOOT_ANIMATION_DESCRIPTION
,
1036 SINGLE_VALUE_TYPE(chromeos::switches::kDisableBootAnimation
),
1039 "disable-boot-animation2",
1040 IDS_FLAGS_DISABLE_BOOT_ANIMATION2
,
1041 IDS_FLAGS_DISABLE_BOOT_ANIMATION2_DESCRIPTION
,
1043 SINGLE_VALUE_TYPE(ash::switches::kAshDisableBootAnimation2
),
1046 "boot-animation-fucntion",
1047 IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION
,
1048 IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION_DESCRIPTION
,
1050 MULTI_VALUE_TYPE(kAshBootAnimationFunction
),
1053 "captive-portal-detector",
1054 IDS_FLAGS_CAPTIVE_PORTAL_DETECTOR_NAME
,
1055 IDS_FLAGS_CAPTIVE_PORTAL_DETECTOR_DESCRIPTION
,
1057 MULTI_VALUE_TYPE(kChromeCaptivePortalDetectionChoices
),
1060 "disable-new-lock-animations",
1061 IDS_FLAGS_ASH_NEW_LOCK_ANIMATIONS
,
1062 IDS_FLAGS_ASH_NEW_LOCK_ANIMATIONS_DESCRIPTION
,
1064 SINGLE_VALUE_TYPE(ash::switches::kAshDisableNewLockAnimations
),
1067 "file-manager-legacy",
1068 IDS_FLAGS_FILE_MANAGER_LEGACY_NAME
,
1069 IDS_FLAGS_FILE_MANAGER_LEGACY_DESCRIPTION
,
1071 SINGLE_VALUE_TYPE(chromeos::switches::kFileManagerLegacy
),
1074 "file-manager-legacy-ui",
1075 IDS_FLAGS_FILE_MANAGER_LEGACY_UI_NAME
,
1076 IDS_FLAGS_FILE_MANAGER_LEGACY_UI_DESCRIPTION
,
1078 SINGLE_VALUE_TYPE(chromeos::switches::kFileManagerLegacyUI
),
1082 IDS_FLAGS_DISABLE_KIOSK_APPS_NAME
,
1083 IDS_FLAGS_DISABLE_KIOSK_APPS_DESCRIPTION
,
1085 SINGLE_VALUE_TYPE(chromeos::switches::kDisableAppMode
),
1088 "disable-force-fullscreen-app",
1089 IDS_FLAGS_DISABLE_FULLSCREEN_APP_NAME
,
1090 IDS_FLAGS_DISABLE_FULLSCREEN_APP_DESCRIPTION
,
1092 SINGLE_VALUE_TYPE(switches::kDisableFullscreenApp
),
1095 "disable-quickoffice-component-app",
1096 IDS_FLAGS_DISABLE_QUICKOFFICE_COMPONENT_APP_NAME
,
1097 IDS_FLAGS_DISABLE_QUICKOFFICE_COMPONENT_APP_DESCRIPTION
,
1099 SINGLE_VALUE_TYPE(chromeos::switches::kDisableQuickofficeComponentApp
),
1101 #endif // defined(OS_CHROMEOS)
1104 IDS_FLAGS_VIEWS_TEXTFIELD_NAME
,
1105 IDS_FLAGS_VIEWS_TEXTFIELD_DESCRIPTION
,
1107 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableViewsTextfield
,
1108 switches::kDisableViewsTextfield
),
1112 IDS_FLAGS_NEW_DIALOG_STYLE_NAME
,
1113 IDS_FLAGS_NEW_DIALOG_STYLE_DESCRIPTION
,
1115 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableNewDialogStyle
,
1116 switches::kDisableNewDialogStyle
),
1118 { "disable-accelerated-video-decode",
1119 IDS_FLAGS_DISABLE_ACCELERATED_VIDEO_DECODE_NAME
,
1120 IDS_FLAGS_DISABLE_ACCELERATED_VIDEO_DECODE_DESCRIPTION
,
1122 SINGLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode
),
1124 #if defined(USE_ASH)
1126 "ash-debug-shortcuts",
1127 IDS_FLAGS_DEBUG_SHORTCUTS_NAME
,
1128 IDS_FLAGS_DEBUG_SHORTCUTS_DESCRIPTION
,
1130 SINGLE_VALUE_TYPE(ash::switches::kAshDebugShortcuts
),
1135 IDS_FLAGS_ENABLE_CONTACTS_NAME
,
1136 IDS_FLAGS_ENABLE_CONTACTS_DESCRIPTION
,
1138 SINGLE_VALUE_TYPE(switches::kEnableContacts
)
1140 #if defined(USE_ASH)
1141 { "ash-enable-advanced-gestures",
1142 IDS_FLAGS_ENABLE_ADVANCED_GESTURES_NAME
,
1143 IDS_FLAGS_ENABLE_ADVANCED_GESTURES_DESCRIPTION
,
1145 SINGLE_VALUE_TYPE(ash::switches::kAshEnableAdvancedGestures
),
1147 { "ash-disable-tab-scrubbing",
1148 IDS_FLAGS_DISABLE_TAB_SCRUBBING_NAME
,
1149 IDS_FLAGS_DISABLE_TAB_SCRUBBING_DESCRIPTION
,
1151 SINGLE_VALUE_TYPE(switches::kAshDisableTabScrubbing
),
1153 { "ash-drag-and-drop-applist-to-launcher",
1154 IDS_FLAGS_DND_APPLIST_TO_LAUNCHER_NAME
,
1155 IDS_FLAGS_DND_APPLIST_TO_LAUNCHER_DESCRIPTION
,
1157 SINGLE_VALUE_TYPE(ash::switches::kAshDragAndDropAppListToLauncher
),
1159 { "ash-enable-workspace-scrubbing",
1160 IDS_FLAGS_ENABLE_WORKSPACE_SCRUBBING_NAME
,
1161 IDS_FLAGS_ENABLE_WORKSPACE_SCRUBBING_DESCRIPTION
,
1163 SINGLE_VALUE_TYPE(ash::switches::kAshEnableWorkspaceScrubbing
),
1165 { "ash-immersive-fullscreen-2",
1166 IDS_FLAGS_ASH_IMMERSIVE_FULLSCREEN_NAME
,
1167 IDS_FLAGS_ASH_IMMERSIVE_FULLSCREEN_DESCRIPTION
,
1169 ENABLE_DISABLE_VALUE_TYPE(ash::switches::kAshEnableImmersiveFullscreen
,
1170 ash::switches::kAshDisableImmersiveFullscreen
),
1172 #if defined(OS_LINUX)
1173 { "ash-enable-memory-monitor",
1174 IDS_FLAGS_ENABLE_MEMORY_MONITOR_NAME
,
1175 IDS_FLAGS_ENABLE_MEMORY_MONITOR_DESCRIPTION
,
1177 SINGLE_VALUE_TYPE(ash::switches::kAshEnableMemoryMonitor
),
1181 #if defined(OS_CHROMEOS)
1182 { "ash-disable-new-network-status-area",
1183 IDS_FLAGS_ASH_DISABLE_NEW_NETWORK_STATUS_AREA_NAME
,
1184 IDS_FLAGS_ASH_DISABLE_NEW_NETWORK_STATUS_AREA_DESCRIPTION
,
1186 SINGLE_VALUE_TYPE(ash::switches::kAshDisableNewNetworkStatusArea
),
1189 "ash-enable-new-audio-handler2",
1190 IDS_FLAGS_ASH_ENABLE_NEW_AUDIO_HANDLER_NAME
,
1191 IDS_FLAGS_ASH_ENABLE_NEW_AUDIO_HANDLER_DESCRIPTION
,
1193 ENABLE_DISABLE_VALUE_TYPE("", ash::switches::kAshDisableNewAudioHandler
)
1196 "ash-audio-device-menu",
1197 IDS_FLAGS_ASH_AUDIO_DEVICE_MENU_NAME
,
1198 IDS_FLAGS_ASH_AUDIO_DEVICE_MENU_DESCRIPTION
,
1200 SINGLE_VALUE_TYPE(ash::switches::kAshEnableAudioDeviceMenu
)
1203 "enable-carrier-switching",
1204 IDS_FLAGS_ENABLE_CARRIER_SWITCHING
,
1205 IDS_FLAGS_ENABLE_CARRIER_SWITCHING_DESCRIPTION
,
1207 SINGLE_VALUE_TYPE(chromeos::switches::kEnableCarrierSwitching
)
1210 "enable-request-tablet-site",
1211 IDS_FLAGS_ENABLE_REQUEST_TABLET_SITE_NAME
,
1212 IDS_FLAGS_ENABLE_REQUEST_TABLET_SITE_DESCRIPTION
,
1214 SINGLE_VALUE_TYPE(chromeos::switches::kEnableRequestTabletSite
)
1218 "debug-packed-apps",
1219 IDS_FLAGS_DEBUG_PACKED_APP_NAME
,
1220 IDS_FLAGS_DEBUG_PACKED_APP_DESCRIPTION
,
1222 SINGLE_VALUE_TYPE(switches::kDebugPackedApps
)
1225 "enable-password-generation",
1226 IDS_FLAGS_ENABLE_PASSWORD_GENERATION_NAME
,
1227 IDS_FLAGS_ENABLE_PASSWORD_GENERATION_DESCRIPTION
,
1229 SINGLE_VALUE_TYPE(switches::kEnablePasswordGeneration
)
1232 "enable-deferred-image-decoding",
1233 IDS_FLAGS_ENABLE_DEFERRED_IMAGE_DECODING_NAME
,
1234 IDS_FLAGS_ENABLE_DEFERRED_IMAGE_DECODING_DESCRIPTION
,
1235 kOsMac
| kOsLinux
| kOsCrOS
,
1236 SINGLE_VALUE_TYPE(switches::kEnableDeferredImageDecoding
)
1239 "performance-monitor-gathering",
1240 IDS_FLAGS_PERFORMANCE_MONITOR_GATHERING_NAME
,
1241 IDS_FLAGS_PERFORMANCE_MONITOR_GATHERING_DESCRIPTION
,
1243 SINGLE_VALUE_TYPE(switches::kPerformanceMonitorGathering
)
1246 "disable-native-autofill-ui",
1247 IDS_FLAGS_DISABLE_NATIVE_AUTOFILL_UI_NAME
,
1248 IDS_FLAGS_DISABLE_NATIVE_AUTOFILL_UI_DESCRIPTION
,
1250 SINGLE_VALUE_TYPE(switches::kDisableNativeAutofillUi
)
1253 "enable-experimental-form-filling",
1254 IDS_FLAGS_ENABLE_EXPERIMENTAL_FORM_FILLING_NAME
,
1255 IDS_FLAGS_ENABLE_EXPERIMENTAL_FORM_FILLING_DESCRIPTION
,
1257 SINGLE_VALUE_TYPE(autofill::switches::kEnableExperimentalFormFilling
)
1260 "wallet-service-use-prod",
1261 IDS_FLAGS_ENABLE_WALLET_PRODUCTION_SERVICE_NAME
,
1262 IDS_FLAGS_ENABLE_WALLET_PRODUCTION_SERVICE_DESCRIPTION
,
1264 SINGLE_VALUE_TYPE(autofill::switches::kWalletServiceUseProd
)
1267 "enable-interactive-autocomplete",
1268 IDS_FLAGS_ENABLE_INTERACTIVE_AUTOCOMPLETE_NAME
,
1269 IDS_FLAGS_ENABLE_INTERACTIVE_AUTOCOMPLETE_DESCRIPTION
,
1270 kOsWin
| kOsCrOS
| kOsAndroid
,
1271 SINGLE_VALUE_TYPE(switches::kEnableInteractiveAutocomplete
)
1273 #if defined(USE_AURA)
1275 "overscroll-history-navigation",
1276 IDS_FLAGS_OVERSCROLL_HISTORY_NAVIGATION_NAME
,
1277 IDS_FLAGS_OVERSCROLL_HISTORY_NAVIGATION_DESCRIPTION
,
1279 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(
1280 switches::kOverscrollHistoryNavigation
, "1",
1281 switches::kOverscrollHistoryNavigation
, "0")
1285 "enable-touch-drag-drop",
1286 IDS_FLAGS_ENABLE_TOUCH_DRAG_DROP_NAME
,
1287 IDS_FLAGS_ENABLE_TOUCH_DRAG_DROP_DESCRIPTION
,
1289 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableTouchDragDrop
,
1290 switches::kDisableTouchDragDrop
)
1293 "enable-touch-editing",
1294 IDS_FLAGS_ENABLE_TOUCH_EDITING_NAME
,
1295 IDS_FLAGS_ENABLE_TOUCH_EDITING_DESCRIPTION
,
1297 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableTouchEditing
,
1298 switches::kDisableTouchEditing
)
1300 #if defined(ENABLE_MESSAGE_CENTER)
1302 "enable-rich-notifications",
1303 IDS_FLAGS_ENABLE_RICH_NOTIFICATIONS_NAME
,
1304 IDS_FLAGS_ENABLE_RICH_NOTIFICATIONS_DESCRIPTION
,
1305 kOsWin
| kOsCrOS
| kOsMac
,
1306 ENABLE_DISABLE_VALUE_TYPE(
1307 message_center::switches::kEnableRichNotifications
,
1308 message_center::switches::kDisableRichNotifications
)
1312 "enable-sync-synced-notifications",
1313 IDS_FLAGS_ENABLE_SYNCED_NOTIFICATIONS_NAME
,
1314 IDS_FLAGS_ENABLE_SYNCED_NOTIFICATIONS_DESCRIPTION
,
1316 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableSyncSyncedNotifications
,
1317 switches::kDisableSyncSyncedNotifications
)
1320 "disable-full-history-sync",
1321 IDS_FLAGS_FULL_HISTORY_SYNC_NAME
,
1322 IDS_FLAGS_FULL_HISTORY_SYNC_DESCRIPTION
,
1324 SINGLE_VALUE_TYPE(switches::kHistoryDisableFullHistorySync
)
1327 "enable-usermedia-screen-capture",
1328 IDS_FLAGS_ENABLE_SCREEN_CAPTURE_NAME
,
1329 IDS_FLAGS_ENABLE_SCREEN_CAPTURE_DESCRIPTION
,
1331 SINGLE_VALUE_TYPE(switches::kEnableUserMediaScreenCapturing
)
1334 "enable-apps-devtool-app",
1335 IDS_FLAGS_ENABLE_APPS_DEVTOOL_APP_NAME
,
1336 IDS_FLAGS_ENABLE_APPS_DEVTOOL_APP_DESCRIPTION
,
1338 SINGLE_VALUE_TYPE(switches::kAppsDevtool
)
1341 "impl-side-painting",
1342 IDS_FLAGS_IMPL_SIDE_PAINTING_NAME
,
1343 IDS_FLAGS_IMPL_SIDE_PAINTING_DESCRIPTION
,
1344 kOsAndroid
| kOsLinux
| kOsCrOS
,
1345 MULTI_VALUE_TYPE(kImplSidePaintingChoices
)
1348 "enable-websocket-experimental-implementation",
1349 IDS_FLAGS_ENABLE_EXPERIMENTAL_WEBSOCKET_NAME
,
1350 IDS_FLAGS_ENABLE_EXPERIMENTAL_WEBSOCKET_DESCRIPTION
,
1352 SINGLE_VALUE_TYPE(switches::kEnableExperimentalWebSocket
)
1355 "max-tiles-for-interest-area",
1356 IDS_FLAGS_MAX_TILES_FOR_INTEREST_AREA_NAME
,
1357 IDS_FLAGS_MAX_TILES_FOR_INTEREST_AREA_DESCRIPTION
,
1358 kOsAndroid
| kOsLinux
| kOsCrOS
,
1359 MULTI_VALUE_TYPE(kMaxTilesForInterestAreaChoices
)
1362 "enable-offline-mode",
1363 IDS_FLAGS_ENABLE_OFFLINE_MODE_NAME
,
1364 IDS_FLAGS_ENABLE_OFFLINE_MODE_DESCRIPTION
,
1366 SINGLE_VALUE_TYPE(switches::kEnableOfflineCacheAccess
)
1369 "default-tile-width",
1370 IDS_FLAGS_DEFAULT_TILE_WIDTH_NAME
,
1371 IDS_FLAGS_DEFAULT_TILE_WIDTH_DESCRIPTION
,
1373 MULTI_VALUE_TYPE(kDefaultTileWidthChoices
)
1376 "default-tile-height",
1377 IDS_FLAGS_DEFAULT_TILE_HEIGHT_NAME
,
1378 IDS_FLAGS_DEFAULT_TILE_HEIGHT_DESCRIPTION
,
1380 MULTI_VALUE_TYPE(kDefaultTileHeightChoices
)
1382 // TODO(sky): ifdef needed until focus sorted out in DesktopNativeWidgetAura.
1383 #if !defined(USE_AURA)
1385 "track-active-visit-time",
1386 IDS_FLAGS_TRACK_ACTIVE_VISIT_TIME_NAME
,
1387 IDS_FLAGS_TRACK_ACTIVE_VISIT_TIME_DESCRIPTION
,
1389 SINGLE_VALUE_TYPE(switches::kTrackActiveVisitTime
)
1392 #if defined(OS_ANDROID)
1394 "disable-gesture-requirement-for-media-playback",
1395 IDS_FLAGS_DISABLE_GESTURE_REQUIREMENT_FOR_MEDIA_PLAYBACK_NAME
,
1396 IDS_FLAGS_DISABLE_GESTURE_REQUIREMENT_FOR_MEDIA_PLAYBACK_DESCRIPTION
,
1398 SINGLE_VALUE_TYPE(switches::kDisableGestureRequirementForMediaPlayback
)
1401 #if defined(OS_CHROMEOS)
1403 "enable-experimental-bluetooth",
1404 IDS_FLAGS_ENABLE_EXPERIMENTAL_BLUETOOTH_NAME
,
1405 IDS_FLAGS_ENABLE_EXPERIMENTAL_BLUETOOTH_DESCRIPTION
,
1407 SINGLE_VALUE_TYPE(chromeos::switches::kEnableExperimentalBluetooth
)
1410 #if defined(ENABLE_GOOGLE_NOW)
1412 "enable-google-now",
1413 IDS_FLAGS_ENABLE_GOOGLE_NOW_INTEGRATION_NAME
,
1414 IDS_FLAGS_ENABLE_GOOGLE_NOW_INTEGRATION_DESCRIPTION
,
1416 SINGLE_VALUE_TYPE(switches::kEnableGoogleNowIntegration
)
1420 "enable-translate-alpha-languages",
1421 IDS_FLAGS_ENABLE_TRANSLATE_ALPHA_LANGUAGES_NAME
,
1422 IDS_FLAGS_ENABLE_TRANSLATE_ALPHA_LANGUAGES_DESCRIPTION
,
1424 SINGLE_VALUE_TYPE(switches::kEnableTranslateAlphaLanguages
)
1426 #if defined(OS_CHROMEOS)
1428 "enable-virtual-keyboard",
1429 IDS_FLAGS_ENABLE_VIRTUAL_KEYBOARD_NAME
,
1430 IDS_FLAGS_ENABLE_VIRTUAL_KEYBOARD_DESCRIPTION
,
1432 SINGLE_VALUE_TYPE(keyboard::switches::kEnableVirtualKeyboard
)
1436 "enable-simple-cache-backend",
1437 IDS_FLAGS_ENABLE_SIMPLE_CACHE_BACKEND_NAME
,
1438 IDS_FLAGS_ENABLE_SIMPLE_CACHE_BACKEND_DESCRIPTION
,
1440 MULTI_VALUE_TYPE(kSimpleCacheBackendChoices
)
1443 "enable-tcp-fast-open",
1444 IDS_FLAGS_ENABLE_TCP_FAST_OPEN_NAME
,
1445 IDS_FLAGS_ENABLE_TCP_FAST_OPEN_DESCRIPTION
,
1446 kOsLinux
| kOsCrOS
| kOsAndroid
,
1447 SINGLE_VALUE_TYPE(switches::kEnableTcpFastOpen
)
1450 "enable-webp-in-accept-header",
1451 IDS_FLAGS_ENABLE_WEBP_IN_ACCEPT_HEADER_NAME
,
1452 IDS_FLAGS_ENABLE_WEBP_IN_ACCEPT_HEADER_DESCRIPTION
,
1454 SINGLE_VALUE_TYPE(switches::kEnableWebPInAcceptHeader
)
1457 "apps-use-native-frame",
1458 IDS_FLAGS_ENABLE_NATIVE_FRAMES_FOR_APPS_NAME
,
1459 IDS_FLAGS_ENABLE_NATIVE_FRAMES_FOR_APPS_DESCRIPTION
,
1461 SINGLE_VALUE_TYPE(switches::kAppsUseNativeFrame
)
1464 "enable-syncfs-directory-operation",
1465 IDS_FLAGS_ENABLE_SYNC_DIRECTORY_OPERATION_NAME
,
1466 IDS_FLAGS_ENABLE_SYNC_DIRECTORY_OPERATION_DESCRIPTION
,
1468 SINGLE_VALUE_TYPE(switches::kSyncfsEnableDirectoryOperation
),
1472 const Experiment
* experiments
= kExperiments
;
1473 size_t num_experiments
= arraysize(kExperiments
);
1475 // Stores and encapsulates the little state that about:flags has.
1478 FlagsState() : needs_restart_(false) {}
1479 void ConvertFlagsToSwitches(PrefService
* prefs
, CommandLine
* command_line
);
1480 bool IsRestartNeededToCommitChanges();
1481 void SetExperimentEnabled(
1482 PrefService
* prefs
, const std::string
& internal_name
, bool enable
);
1483 void RemoveFlagsSwitches(
1484 std::map
<std::string
, CommandLine::StringType
>* switch_list
);
1485 void ResetAllFlags(PrefService
* prefs
);
1488 // Returns the singleton instance of this class
1489 static FlagsState
* GetInstance() {
1490 return Singleton
<FlagsState
>::get();
1494 bool needs_restart_
;
1495 std::map
<std::string
, std::string
> flags_switches_
;
1497 DISALLOW_COPY_AND_ASSIGN(FlagsState
);
1500 // Extracts the list of enabled lab experiments from preferences and stores them
1502 void GetEnabledFlags(const PrefService
* prefs
, std::set
<std::string
>* result
) {
1503 const ListValue
* enabled_experiments
= prefs
->GetList(
1504 prefs::kEnabledLabsExperiments
);
1505 if (!enabled_experiments
)
1508 for (ListValue::const_iterator it
= enabled_experiments
->begin();
1509 it
!= enabled_experiments
->end();
1511 std::string experiment_name
;
1512 if (!(*it
)->GetAsString(&experiment_name
)) {
1513 LOG(WARNING
) << "Invalid entry in " << prefs::kEnabledLabsExperiments
;
1516 result
->insert(experiment_name
);
1520 // Takes a set of enabled lab experiments
1521 void SetEnabledFlags(
1522 PrefService
* prefs
, const std::set
<std::string
>& enabled_experiments
) {
1523 ListPrefUpdate
update(prefs
, prefs::kEnabledLabsExperiments
);
1524 ListValue
* experiments_list
= update
.Get();
1526 experiments_list
->Clear();
1527 for (std::set
<std::string
>::const_iterator it
= enabled_experiments
.begin();
1528 it
!= enabled_experiments
.end();
1530 experiments_list
->Append(new StringValue(*it
));
1534 // Adds the internal names for the specified experiment to |names|.
1535 void AddInternalName(const Experiment
& e
, std::set
<std::string
>* names
) {
1536 if (e
.type
== Experiment::SINGLE_VALUE
) {
1537 names
->insert(e
.internal_name
);
1539 DCHECK(e
.type
== Experiment::MULTI_VALUE
||
1540 e
.type
== Experiment::ENABLE_DISABLE_VALUE
);
1541 for (int i
= 0; i
< e
.num_choices
; ++i
)
1542 names
->insert(e
.NameForChoice(i
));
1546 // Confirms that an experiment is valid, used in a DCHECK in
1547 // SanitizeList below.
1548 bool ValidateExperiment(const Experiment
& e
) {
1550 case Experiment::SINGLE_VALUE
:
1551 DCHECK_EQ(0, e
.num_choices
);
1554 case Experiment::MULTI_VALUE
:
1555 DCHECK_GT(e
.num_choices
, 0);
1557 DCHECK(e
.choices
[0].command_line_switch
);
1558 DCHECK_EQ('\0', e
.choices
[0].command_line_switch
[0]);
1560 case Experiment::ENABLE_DISABLE_VALUE
:
1561 DCHECK_EQ(3, e
.num_choices
);
1563 DCHECK(e
.command_line_switch
);
1564 DCHECK(e
.command_line_value
);
1565 DCHECK(e
.disable_command_line_switch
);
1566 DCHECK(e
.disable_command_line_value
);
1574 // Removes all experiments from prefs::kEnabledLabsExperiments that are
1575 // unknown, to prevent this list to become very long as experiments are added
1577 void SanitizeList(PrefService
* prefs
) {
1578 std::set
<std::string
> known_experiments
;
1579 for (size_t i
= 0; i
< num_experiments
; ++i
) {
1580 DCHECK(ValidateExperiment(experiments
[i
]));
1581 AddInternalName(experiments
[i
], &known_experiments
);
1584 std::set
<std::string
> enabled_experiments
;
1585 GetEnabledFlags(prefs
, &enabled_experiments
);
1587 std::set
<std::string
> new_enabled_experiments
;
1588 std::set_intersection(
1589 known_experiments
.begin(), known_experiments
.end(),
1590 enabled_experiments
.begin(), enabled_experiments
.end(),
1591 std::inserter(new_enabled_experiments
, new_enabled_experiments
.begin()));
1593 if (new_enabled_experiments
!= enabled_experiments
)
1594 SetEnabledFlags(prefs
, new_enabled_experiments
);
1597 void GetSanitizedEnabledFlags(
1598 PrefService
* prefs
, std::set
<std::string
>* result
) {
1599 SanitizeList(prefs
);
1600 GetEnabledFlags(prefs
, result
);
1603 // Variant of GetSanitizedEnabledFlags that also removes any flags that aren't
1604 // enabled on the current platform.
1605 void GetSanitizedEnabledFlagsForCurrentPlatform(
1606 PrefService
* prefs
, std::set
<std::string
>* result
) {
1607 GetSanitizedEnabledFlags(prefs
, result
);
1609 // Filter out any experiments that aren't enabled on the current platform. We
1610 // don't remove these from prefs else syncing to a platform with a different
1611 // set of experiments would be lossy.
1612 std::set
<std::string
> platform_experiments
;
1613 int current_platform
= GetCurrentPlatform();
1614 for (size_t i
= 0; i
< num_experiments
; ++i
) {
1615 if (experiments
[i
].supported_platforms
& current_platform
)
1616 AddInternalName(experiments
[i
], &platform_experiments
);
1617 #if defined(OS_CHROMEOS)
1618 if (experiments
[i
].supported_platforms
& kOsCrOSOwnerOnly
)
1619 AddInternalName(experiments
[i
], &platform_experiments
);
1623 std::set
<std::string
> new_enabled_experiments
;
1624 std::set_intersection(
1625 platform_experiments
.begin(), platform_experiments
.end(),
1626 result
->begin(), result
->end(),
1627 std::inserter(new_enabled_experiments
, new_enabled_experiments
.begin()));
1629 result
->swap(new_enabled_experiments
);
1632 // Returns the Value representing the choice data in the specified experiment.
1633 Value
* CreateChoiceData(const Experiment
& experiment
,
1634 const std::set
<std::string
>& enabled_experiments
) {
1635 DCHECK(experiment
.type
== Experiment::MULTI_VALUE
||
1636 experiment
.type
== Experiment::ENABLE_DISABLE_VALUE
);
1637 ListValue
* result
= new ListValue
;
1638 for (int i
= 0; i
< experiment
.num_choices
; ++i
) {
1639 DictionaryValue
* value
= new DictionaryValue
;
1640 const std::string name
= experiment
.NameForChoice(i
);
1641 value
->SetString("internal_name", name
);
1642 value
->SetString("description", experiment
.DescriptionForChoice(i
));
1643 value
->SetBoolean("selected", enabled_experiments
.count(name
) > 0);
1644 result
->Append(value
);
1651 std::string
Experiment::NameForChoice(int index
) const {
1652 DCHECK(type
== Experiment::MULTI_VALUE
||
1653 type
== Experiment::ENABLE_DISABLE_VALUE
);
1654 DCHECK_LT(index
, num_choices
);
1655 return std::string(internal_name
) + testing::kMultiSeparator
+
1656 base::IntToString(index
);
1659 string16
Experiment::DescriptionForChoice(int index
) const {
1660 DCHECK(type
== Experiment::MULTI_VALUE
||
1661 type
== Experiment::ENABLE_DISABLE_VALUE
);
1662 DCHECK_LT(index
, num_choices
);
1664 if (type
== Experiment::ENABLE_DISABLE_VALUE
) {
1665 const int kEnableDisableDescriptionIds
[] = {
1666 IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT
,
1667 IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED
,
1668 IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED
,
1670 description_id
= kEnableDisableDescriptionIds
[index
];
1672 description_id
= choices
[index
].description_id
;
1674 return l10n_util::GetStringUTF16(description_id
);
1677 void ConvertFlagsToSwitches(PrefService
* prefs
, CommandLine
* command_line
) {
1678 FlagsState::GetInstance()->ConvertFlagsToSwitches(prefs
, command_line
);
1681 ListValue
* GetFlagsExperimentsData(PrefService
* prefs
, FlagAccess access
) {
1682 std::set
<std::string
> enabled_experiments
;
1683 GetSanitizedEnabledFlags(prefs
, &enabled_experiments
);
1685 int current_platform
= GetCurrentPlatform();
1687 ListValue
* experiments_data
= new ListValue();
1688 for (size_t i
= 0; i
< num_experiments
; ++i
) {
1689 const Experiment
& experiment
= experiments
[i
];
1691 DictionaryValue
* data
= new DictionaryValue();
1692 data
->SetString("internal_name", experiment
.internal_name
);
1693 data
->SetString("name",
1694 l10n_util::GetStringUTF16(experiment
.visible_name_id
));
1695 data
->SetString("description",
1696 l10n_util::GetStringUTF16(
1697 experiment
.visible_description_id
));
1698 bool supported
= (experiment
.supported_platforms
& current_platform
) != 0;
1699 #if defined(OS_CHROMEOS)
1700 if (access
== kOwnerAccessToFlags
&&
1701 (experiment
.supported_platforms
& kOsCrOSOwnerOnly
) != 0)
1704 data
->SetBoolean("supported", supported
);
1706 ListValue
* supported_platforms
= new ListValue();
1707 AddOsStrings(experiment
.supported_platforms
, supported_platforms
);
1708 data
->Set("supported_platforms", supported_platforms
);
1710 switch (experiment
.type
) {
1711 case Experiment::SINGLE_VALUE
:
1714 enabled_experiments
.count(experiment
.internal_name
) > 0);
1716 case Experiment::MULTI_VALUE
:
1717 case Experiment::ENABLE_DISABLE_VALUE
:
1718 data
->Set("choices", CreateChoiceData(experiment
, enabled_experiments
));
1724 experiments_data
->Append(data
);
1726 return experiments_data
;
1729 bool IsRestartNeededToCommitChanges() {
1730 return FlagsState::GetInstance()->IsRestartNeededToCommitChanges();
1733 void SetExperimentEnabled(
1734 PrefService
* prefs
, const std::string
& internal_name
, bool enable
) {
1735 FlagsState::GetInstance()->SetExperimentEnabled(prefs
, internal_name
, enable
);
1738 void RemoveFlagsSwitches(
1739 std::map
<std::string
, CommandLine::StringType
>* switch_list
) {
1740 FlagsState::GetInstance()->RemoveFlagsSwitches(switch_list
);
1743 void ResetAllFlags(PrefService
* prefs
) {
1744 FlagsState::GetInstance()->ResetAllFlags(prefs
);
1747 int GetCurrentPlatform() {
1748 #if defined(OS_MACOSX)
1750 #elif defined(OS_WIN)
1752 #elif defined(OS_CHROMEOS) // Needs to be before the OS_LINUX check.
1754 #elif defined(OS_LINUX) || defined(OS_OPENBSD)
1756 #elif defined(OS_ANDROID)
1759 #error Unknown platform
1763 void RecordUMAStatistics(const PrefService
* prefs
) {
1764 std::set
<std::string
> flags
;
1765 GetEnabledFlags(prefs
, &flags
);
1766 for (std::set
<std::string
>::iterator it
= flags
.begin(); it
!= flags
.end();
1768 std::string
action("AboutFlags_");
1770 content::RecordComputedAction(action
);
1772 // Since flag metrics are recorded every startup, add a tick so that the
1773 // stats can be made meaningful.
1775 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick"));
1776 content::RecordAction(UserMetricsAction("StartupTick"));
1779 //////////////////////////////////////////////////////////////////////////////
1780 // FlagsState implementation.
1784 typedef std::map
<std::string
, std::pair
<std::string
, std::string
> >
1785 NameToSwitchAndValueMap
;
1787 void SetFlagToSwitchMapping(const std::string
& key
,
1788 const std::string
& switch_name
,
1789 const std::string
& switch_value
,
1790 NameToSwitchAndValueMap
* name_to_switch_map
) {
1791 DCHECK(name_to_switch_map
->end() == name_to_switch_map
->find(key
));
1792 (*name_to_switch_map
)[key
] = std::make_pair(switch_name
, switch_value
);
1795 void FlagsState::ConvertFlagsToSwitches(
1796 PrefService
* prefs
, CommandLine
* command_line
) {
1797 if (command_line
->HasSwitch(switches::kNoExperiments
))
1800 std::set
<std::string
> enabled_experiments
;
1802 GetSanitizedEnabledFlagsForCurrentPlatform(prefs
, &enabled_experiments
);
1804 NameToSwitchAndValueMap name_to_switch_map
;
1805 for (size_t i
= 0; i
< num_experiments
; ++i
) {
1806 const Experiment
& e
= experiments
[i
];
1807 if (e
.type
== Experiment::SINGLE_VALUE
) {
1808 SetFlagToSwitchMapping(e
.internal_name
, e
.command_line_switch
,
1809 e
.command_line_value
, &name_to_switch_map
);
1810 } else if (e
.type
== Experiment::MULTI_VALUE
) {
1811 for (int j
= 0; j
< e
.num_choices
; ++j
) {
1812 SetFlagToSwitchMapping(e
.NameForChoice(j
),
1813 e
.choices
[j
].command_line_switch
,
1814 e
.choices
[j
].command_line_value
,
1815 &name_to_switch_map
);
1818 DCHECK_EQ(e
.type
, Experiment::ENABLE_DISABLE_VALUE
);
1819 SetFlagToSwitchMapping(e
.NameForChoice(0), std::string(), std::string(),
1820 &name_to_switch_map
);
1821 SetFlagToSwitchMapping(e
.NameForChoice(1), e
.command_line_switch
,
1822 e
.command_line_value
, &name_to_switch_map
);
1823 SetFlagToSwitchMapping(e
.NameForChoice(2), e
.disable_command_line_switch
,
1824 e
.disable_command_line_value
, &name_to_switch_map
);
1828 command_line
->AppendSwitch(switches::kFlagSwitchesBegin
);
1829 flags_switches_
.insert(
1830 std::pair
<std::string
, std::string
>(switches::kFlagSwitchesBegin
,
1832 for (std::set
<std::string
>::iterator it
= enabled_experiments
.begin();
1833 it
!= enabled_experiments
.end();
1835 const std::string
& experiment_name
= *it
;
1836 NameToSwitchAndValueMap::const_iterator name_to_switch_it
=
1837 name_to_switch_map
.find(experiment_name
);
1838 if (name_to_switch_it
== name_to_switch_map
.end()) {
1843 const std::pair
<std::string
, std::string
>&
1844 switch_and_value_pair
= name_to_switch_it
->second
;
1846 command_line
->AppendSwitchASCII(switch_and_value_pair
.first
,
1847 switch_and_value_pair
.second
);
1848 flags_switches_
[switch_and_value_pair
.first
] = switch_and_value_pair
.second
;
1850 command_line
->AppendSwitch(switches::kFlagSwitchesEnd
);
1851 flags_switches_
.insert(
1852 std::pair
<std::string
, std::string
>(switches::kFlagSwitchesEnd
,
1856 bool FlagsState::IsRestartNeededToCommitChanges() {
1857 return needs_restart_
;
1860 void FlagsState::SetExperimentEnabled(
1861 PrefService
* prefs
, const std::string
& internal_name
, bool enable
) {
1862 size_t at_index
= internal_name
.find(testing::kMultiSeparator
);
1863 if (at_index
!= std::string::npos
) {
1865 // We're being asked to enable a multi-choice experiment. Disable the
1866 // currently selected choice.
1867 DCHECK_NE(at_index
, 0u);
1868 const std::string experiment_name
= internal_name
.substr(0, at_index
);
1869 SetExperimentEnabled(prefs
, experiment_name
, false);
1871 // And enable the new choice, if it is not the default first choice.
1872 if (internal_name
!= experiment_name
+ "@0") {
1873 std::set
<std::string
> enabled_experiments
;
1874 GetSanitizedEnabledFlags(prefs
, &enabled_experiments
);
1875 needs_restart_
|= enabled_experiments
.insert(internal_name
).second
;
1876 SetEnabledFlags(prefs
, enabled_experiments
);
1881 std::set
<std::string
> enabled_experiments
;
1882 GetSanitizedEnabledFlags(prefs
, &enabled_experiments
);
1884 const Experiment
* e
= NULL
;
1885 for (size_t i
= 0; i
< num_experiments
; ++i
) {
1886 if (experiments
[i
].internal_name
== internal_name
) {
1887 e
= experiments
+ i
;
1893 if (e
->type
== Experiment::SINGLE_VALUE
) {
1895 needs_restart_
|= enabled_experiments
.insert(internal_name
).second
;
1897 needs_restart_
|= (enabled_experiments
.erase(internal_name
) > 0);
1900 // Enable the first choice.
1901 needs_restart_
|= enabled_experiments
.insert(e
->NameForChoice(0)).second
;
1903 // Find the currently enabled choice and disable it.
1904 for (int i
= 0; i
< e
->num_choices
; ++i
) {
1905 std::string choice_name
= e
->NameForChoice(i
);
1906 if (enabled_experiments
.find(choice_name
) !=
1907 enabled_experiments
.end()) {
1908 needs_restart_
= true;
1909 enabled_experiments
.erase(choice_name
);
1910 // Continue on just in case there's a bug and more than one
1911 // experiment for this choice was enabled.
1917 SetEnabledFlags(prefs
, enabled_experiments
);
1920 void FlagsState::RemoveFlagsSwitches(
1921 std::map
<std::string
, CommandLine::StringType
>* switch_list
) {
1922 for (std::map
<std::string
, std::string
>::const_iterator
1923 it
= flags_switches_
.begin(); it
!= flags_switches_
.end(); ++it
) {
1924 switch_list
->erase(it
->first
);
1928 void FlagsState::ResetAllFlags(PrefService
* prefs
) {
1929 needs_restart_
= true;
1931 std::set
<std::string
> no_experiments
;
1932 SetEnabledFlags(prefs
, no_experiments
);
1935 void FlagsState::reset() {
1936 needs_restart_
= false;
1937 flags_switches_
.clear();
1944 // WARNING: '@' is also used in the html file. If you update this constant you
1945 // also need to update the html file.
1946 const char kMultiSeparator
[] = "@";
1949 FlagsState::GetInstance()->reset();
1952 void SetExperiments(const Experiment
* e
, size_t count
) {
1954 experiments
= kExperiments
;
1955 num_experiments
= arraysize(kExperiments
);
1958 num_experiments
= count
;
1962 const Experiment
* GetExperiments(size_t* count
) {
1963 *count
= num_experiments
;
1967 } // namespace testing
1969 } // namespace about_flags