blob: cf32b79a8371ef3b8e8b16ac472c18a2956f1be1 [file] [log] [blame]
[email protected]3828d6f2011-02-24 18:32:211// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]ad2a3ded2010-08-27 13:19:052// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]1a47d7e2010-10-15 00:37:245#include "chrome/browser/about_flags.h"
[email protected]ad2a3ded2010-08-27 13:19:056
7#include <algorithm>
8#include <iterator>
9#include <map>
10#include <set>
11
[email protected]ad2a3ded2010-08-27 13:19:0512#include "base/command_line.h"
[email protected]3b63f8f42011-03-28 01:54:1513#include "base/memory/singleton.h"
[email protected]8a6ff28d2010-12-02 16:35:1914#include "base/string_number_conversions.h"
[email protected]d208f4d82011-05-23 21:52:0315#include "base/utf_string_conversions.h"
[email protected]ad2a3ded2010-08-27 13:19:0516#include "base/values.h"
[email protected]ad2a3ded2010-08-27 13:19:0517#include "chrome/browser/prefs/pref_service.h"
[email protected]1bc78422011-03-31 08:41:3818#include "chrome/browser/prefs/scoped_user_pref_update.h"
[email protected]d208f4d82011-05-23 21:52:0319#include "chrome/common/chrome_content_client.h"
[email protected]ad2a3ded2010-08-27 13:19:0520#include "chrome/common/chrome_switches.h"
21#include "chrome/common/pref_names.h"
[email protected]afd1e522011-04-27 23:29:5922#include "content/browser/user_metrics.h"
[email protected]deaba6d52011-09-23 14:47:1223#include "content/common/content_switches.h"
[email protected]ad2a3ded2010-08-27 13:19:0524#include "grit/generated_resources.h"
[email protected]c051a1b2011-01-21 23:30:1725#include "ui/base/l10n/l10n_util.h"
[email protected]8ff7f342011-05-25 01:49:4726#include "ui/gfx/gl/gl_switches.h"
[email protected]ad2a3ded2010-08-27 13:19:0527
[email protected]1a47d7e2010-10-15 00:37:2428namespace about_flags {
[email protected]ad2a3ded2010-08-27 13:19:0529
[email protected]8a6ff28d2010-12-02 16:35:1930// Macros to simplify specifying the type.
[email protected]a82744532011-02-11 16:15:5331#define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
32 Experiment::SINGLE_VALUE, command_line_switch, switch_value, NULL, 0
33#define SINGLE_VALUE_TYPE(command_line_switch) \
34 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "")
35#define MULTI_VALUE_TYPE(choices) \
[email protected]0e6f56d2011-02-12 23:45:1536 Experiment::MULTI_VALUE, "", "", choices, arraysize(choices)
[email protected]8a6ff28d2010-12-02 16:35:1937
[email protected]e2ddbc92010-10-15 20:02:0738namespace {
39
[email protected]a314ee5a2010-10-26 21:23:2840const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS;
[email protected]ad2a3ded2010-08-27 13:19:0541
[email protected]ba8164242010-11-16 21:31:0042// Names for former Chrome OS Labs experiments, shared with prefs migration
43// code.
44const char kMediaPlayerExperimentName[] = "media-player";
45const char kAdvancedFileSystemExperimentName[] = "advanced-file-system";
46const char kVerticalTabsExperimentName[] = "vertical-tabs";
47
[email protected]4bc5050c2010-11-18 17:55:5448// RECORDING USER METRICS FOR FLAGS:
49// -----------------------------------------------------------------------------
50// The first line of the experiment is the internal name. If you'd like to
51// gather statistics about the usage of your flag, you should append a marker
52// comment to the end of the feature name, like so:
53// "my-special-feature", // FLAGS:RECORD_UMA
54//
55// After doing that, run //chrome/tools/extract_actions.py (see instructions at
56// the top of that file for details) to update the chromeactions.txt file, which
57// will enable UMA to record your feature flag.
58//
59// After your feature has shipped under a flag, you can locate the metrics
60// under the action name AboutFlags_internal-action-name. Actions are recorded
61// once per startup, so you should divide this number by AboutFlags_StartupTick
62// to get a sense of usage. Note that this will not be the same as number of
63// users with a given feature enabled because users can quit and relaunch
64// the application multiple times over a given time interval.
65// TODO(rsesek): See if there's a way to count per-user, rather than
66// per-startup.
67
[email protected]8a6ff28d2010-12-02 16:35:1968// To add a new experiment add to the end of kExperiments. There are two
69// distinct types of experiments:
70// . SINGLE_VALUE: experiment is either on or off. Use the SINGLE_VALUE_TYPE
71// macro for this type supplying the command line to the macro.
[email protected]28e35af2011-02-09 12:56:2272// . MULTI_VALUE: a list of choices, the first of which should correspond to a
73// deactivated state for this lab (i.e. no command line option). To specify
74// this type of experiment use the macro MULTI_VALUE_TYPE supplying it the
75// array of choices.
[email protected]8a6ff28d2010-12-02 16:35:1976// See the documentation of Experiment for details on the fields.
77//
78// When adding a new choice, add it to the end of the list.
[email protected]ad2a3ded2010-08-27 13:19:0579const Experiment kExperiments[] = {
80 {
[email protected]aac169d2011-03-18 19:53:0381 "expose-for-tabs", // FLAGS:RECORD_UMA
82 IDS_FLAGS_TABPOSE_NAME,
83 IDS_FLAGS_TABPOSE_DESCRIPTION,
84 kOsMac,
85#if defined(OS_MACOSX)
86 // The switch exists only on OS X.
87 SINGLE_VALUE_TYPE(switches::kEnableExposeForTabs)
88#else
89 SINGLE_VALUE_TYPE("")
90#endif
91 },
92 {
[email protected]4bc5050c2010-11-18 17:55:5493 "conflicting-modules-check", // FLAGS:RECORD_UMA
[email protected]c1bbaa82010-11-08 11:17:0594 IDS_FLAGS_CONFLICTS_CHECK_NAME,
95 IDS_FLAGS_CONFLICTS_CHECK_DESCRIPTION,
96 kOsWin,
[email protected]8a6ff28d2010-12-02 16:35:1997 SINGLE_VALUE_TYPE(switches::kConflictingModulesCheck)
[email protected]c1bbaa82010-11-08 11:17:0598 },
99 {
[email protected]4bc5050c2010-11-18 17:55:54100 "cloud-print-proxy", // FLAGS:RECORD_UMA
[email protected]9486c1f2010-10-14 19:52:12101 IDS_FLAGS_CLOUD_PRINT_PROXY_NAME,
102 IDS_FLAGS_CLOUD_PRINT_PROXY_DESCRIPTION,
[email protected]9f8872b32011-03-04 19:44:45103 // For a Chrome build, we know we have a PDF plug-in on Windows, so it's
[email protected]4fa24bf2011-08-20 02:15:22104 // fully enabled.
[email protected]5d10d57d2011-07-22 22:16:31105 // Otherwise, where we know Windows could be working if a viable PDF
[email protected]4fa24bf2011-08-20 02:15:22106 // plug-in could be supplied, we'll keep the lab enabled. Mac and Linux
107 // always have PDF rasterization available, so no flag needed there.
108#if !defined(GOOGLE_CHROME_BUILD)
109 kOsWin,
110#else
111 0,
[email protected]fa6d2a2f2010-11-30 21:47:19112#endif
[email protected]8a6ff28d2010-12-02 16:35:19113 SINGLE_VALUE_TYPE(switches::kEnableCloudPrintProxy)
[email protected]8b6588a2010-10-12 02:39:42114 },
[email protected]580939a2010-10-12 18:54:37115 {
[email protected]bb461532010-11-26 21:50:23116 "crxless-web-apps",
117 IDS_FLAGS_CRXLESS_WEB_APPS_NAME,
118 IDS_FLAGS_CRXLESS_WEB_APPS_DESCRIPTION,
119 kOsAll,
[email protected]8a6ff28d2010-12-02 16:35:19120 SINGLE_VALUE_TYPE(switches::kEnableCrxlessWebApps)
[email protected]bb461532010-11-26 21:50:23121 },
122 {
[email protected]f72d0c62011-08-31 16:27:44123 "lazy-background-pages",
124 IDS_FLAGS_LAZY_BACKGROUND_PAGES_NAME,
125 IDS_FLAGS_LAZY_BACKGROUND_PAGES_DESCRIPTION,
126 kOsAll,
127 SINGLE_VALUE_TYPE(switches::kEnableLazyBackgroundPages)
128 },
129 {
[email protected]96c6f4c2011-05-18 19:36:22130 "ignore-gpu-blacklist",
131 IDS_FLAGS_IGNORE_GPU_BLACKLIST_NAME,
132 IDS_FLAGS_IGNORE_GPU_BLACKLIST_DESCRIPTION,
133 kOsAll,
134 SINGLE_VALUE_TYPE(switches::kIgnoreGpuBlacklist)
135 },
136 {
[email protected]0110cf112011-07-02 00:39:43137 "force-compositing-mode-2",
[email protected]96c6f4c2011-05-18 19:36:22138 IDS_FLAGS_FORCE_COMPOSITING_MODE_NAME,
139 IDS_FLAGS_FORCE_COMPOSITING_MODE_DESCRIPTION,
140 kOsAll,
141 SINGLE_VALUE_TYPE(switches::kForceCompositingMode)
142 },
143 {
[email protected]5963b772011-02-09 22:55:38144 "composited-layer-borders",
145 IDS_FLAGS_COMPOSITED_LAYER_BORDERS,
146 IDS_FLAGS_COMPOSITED_LAYER_BORDERS_DESCRIPTION,
147 kOsAll,
148 SINGLE_VALUE_TYPE(switches::kShowCompositedLayerBorders)
149 },
150 {
[email protected]a8f1eaa2011-03-07 19:00:58151 "show-fps-counter",
152 IDS_FLAGS_SHOW_FPS_COUNTER,
153 IDS_FLAGS_SHOW_FPS_COUNTER_DESCRIPTION,
154 kOsAll,
155 SINGLE_VALUE_TYPE(switches::kShowFPSCounter)
156 },
[email protected]8ff7f342011-05-25 01:49:47157 {
158 "disable-gpu-vsync",
159 IDS_FLAGS_DISABLE_GPU_VSYNC_NAME,
160 IDS_FLAGS_DISABLE_GPU_VSYNC_DESCRIPTION,
161 kOsAll,
162 SINGLE_VALUE_TYPE(switches::kDisableGpuVsync)
163 },
[email protected]deaba6d52011-09-23 14:47:12164 {
165 "disable-webgl",
166 IDS_FLAGS_DISABLE_WEBGL_NAME,
167 IDS_FLAGS_DISABLE_WEBGL_DESCRIPTION,
168 kOsAll,
169 SINGLE_VALUE_TYPE(switches::kDisableExperimentalWebGL)
170 },
[email protected]9de0ec12011-08-24 21:57:50171 // Exposed on all platforms until there is a workaround for easy access to
172 // the native print dialog for users that need it. Once that's done, revert
173 // back to:
174 // Only expose this for Chromium builds where users may not have the PDF
175 // plugin. Do not give Google Chrome users the option to disable it here.
176 // Also expose it for Chrome OS where print preview is still experimental.
[email protected]8d260e52010-10-13 01:03:05177 {
[email protected]4bc5050c2010-11-18 17:55:54178 "print-preview", // FLAGS:RECORD_UMA
[email protected]9486c1f2010-10-14 19:52:12179 IDS_FLAGS_PRINT_PREVIEW_NAME,
180 IDS_FLAGS_PRINT_PREVIEW_DESCRIPTION,
[email protected]b579afd2011-07-13 00:01:27181 kOsAll,
[email protected]8a6ff28d2010-12-02 16:35:19182 SINGLE_VALUE_TYPE(switches::kEnablePrintPreview)
[email protected]2fe15fcb2010-10-21 20:39:53183 },
[email protected]313bbf5e2011-08-24 03:31:15184 {
185 "cloud-print", // FLAGS:RECORD_UMA
186 IDS_FLAGS_CLOUD_PRINT_NAME,
187 IDS_FLAGS_CLOUD_PRINT_DESCRIPTION,
[email protected]8ecf70d12011-09-30 01:54:03188 kOsMac,
[email protected]313bbf5e2011-08-24 03:31:15189 SINGLE_VALUE_TYPE(switches::kEnableCloudPrint)
190 },
[email protected]d208f4d82011-05-23 21:52:03191 // TODO(dspringer): When NaCl is on by default, remove this flag entry.
[email protected]2fe15fcb2010-10-21 20:39:53192 {
[email protected]e3791ce92011-08-09 01:03:32193 "enable-nacl", // FLAGS:RECORD_UMA
[email protected]4ff87d202010-11-06 01:28:40194 IDS_FLAGS_ENABLE_NACL_NAME,
195 IDS_FLAGS_ENABLE_NACL_DESCRIPTION,
196 kOsAll,
[email protected]8a6ff28d2010-12-02 16:35:19197 SINGLE_VALUE_TYPE(switches::kEnableNaCl)
[email protected]4ff87d202010-11-06 01:28:40198 },
199 {
[email protected]4bc5050c2010-11-18 17:55:54200 "extension-apis", // FLAGS:RECORD_UMA
[email protected]11dd68cd52010-11-12 01:15:32201 IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_NAME,
202 IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_DESCRIPTION,
203 kOsAll,
[email protected]8a6ff28d2010-12-02 16:35:19204 SINGLE_VALUE_TYPE(switches::kEnableExperimentalExtensionApis)
[email protected]11dd68cd52010-11-12 01:15:32205 },
[email protected]3627b06d2010-11-12 16:36:16206 {
[email protected]cbe224d2011-08-04 22:12:49207 "apps-new-install-bubble",
208 IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_NAME,
209 IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_DESCRIPTION,
210 kOsAll,
211 SINGLE_VALUE_TYPE(switches::kAppsNewInstallBubble)
212 },
213 {
[email protected]4bc5050c2010-11-18 17:55:54214 "click-to-play", // FLAGS:RECORD_UMA
[email protected]3627b06d2010-11-12 16:36:16215 IDS_FLAGS_CLICK_TO_PLAY_NAME,
216 IDS_FLAGS_CLICK_TO_PLAY_DESCRIPTION,
217 kOsAll,
[email protected]8a6ff28d2010-12-02 16:35:19218 SINGLE_VALUE_TYPE(switches::kEnableClickToPlay)
[email protected]3627b06d2010-11-12 16:36:16219 },
[email protected]80bd24e2010-11-30 09:34:38220 {
221 "disable-hyperlink-auditing",
222 IDS_FLAGS_DISABLE_HYPERLINK_AUDITING_NAME,
223 IDS_FLAGS_DISABLE_HYPERLINK_AUDITING_DESCRIPTION,
224 kOsAll,
[email protected]8a6ff28d2010-12-02 16:35:19225 SINGLE_VALUE_TYPE(switches::kNoPings)
[email protected]feb28fef2010-12-01 10:52:51226 },
227 {
228 "experimental-location-features", // FLAGS:RECORD_UMA
229 IDS_FLAGS_EXPERIMENTAL_LOCATION_FEATURES_NAME,
230 IDS_FLAGS_EXPERIMENTAL_LOCATION_FEATURES_DESCRIPTION,
231 kOsMac | kOsWin | kOsLinux, // Currently does nothing on CrOS.
[email protected]8a6ff28d2010-12-02 16:35:19232 SINGLE_VALUE_TYPE(switches::kExperimentalLocationFeatures)
233 },
234 {
[email protected]4c6452d2011-01-12 08:47:57235 "block-reading-third-party-cookies",
236 IDS_FLAGS_BLOCK_ALL_THIRD_PARTY_COOKIES_NAME,
237 IDS_FLAGS_BLOCK_ALL_THIRD_PARTY_COOKIES_DESCRIPTION,
238 kOsAll,
239 SINGLE_VALUE_TYPE(switches::kBlockReadingThirdPartyCookies)
240 },
[email protected]04227962011-01-20 02:03:09241 {
242 "disable-interactive-form-validation",
243 IDS_FLAGS_DISABLE_INTERACTIVE_FORM_VALIDATION_NAME,
244 IDS_FLAGS_DISABLE_INTERACTIVE_FORM_VALIDATION_DESCRIPTION,
245 kOsAll,
246 SINGLE_VALUE_TYPE(switches::kDisableInteractiveFormValidation)
247 },
[email protected]8df51192011-01-22 20:05:03248 {
[email protected]07d490bc2011-03-07 17:05:26249 "focus-existing-tab-on-open", // FLAGS:RECORD_UMA
250 IDS_FLAGS_FOCUS_EXISTING_TAB_ON_OPEN_NAME,
251 IDS_FLAGS_FOCUS_EXISTING_TAB_ON_OPEN_DESCRIPTION,
252 kOsAll,
253 SINGLE_VALUE_TYPE(switches::kFocusExistingTabOnOpen)
254 },
[email protected]d5dcfb32011-03-19 00:49:24255 {
[email protected]5aea1862011-03-23 23:55:39256 "tab-groups-context-menu",
257 IDS_FLAGS_TAB_GROUPS_CONTEXT_MENU_NAME,
258 IDS_FLAGS_TAB_GROUPS_CONTEXT_MENU_DESCRIPTION,
259 kOsWin,
260 SINGLE_VALUE_TYPE(switches::kEnableTabGroupsContextMenu)
261 },
[email protected]e9bf9d92011-03-31 20:57:15262 {
263 "ppapi-flash-in-process",
264 IDS_FLAGS_PPAPI_FLASH_IN_PROCESS_NAME,
265 IDS_FLAGS_PPAPI_FLASH_IN_PROCESS_DESCRIPTION,
[email protected]f2d3ce0d2011-04-01 18:19:30266 kOsAll,
[email protected]e9bf9d92011-03-31 20:57:15267 SINGLE_VALUE_TYPE(switches::kPpapiFlashInProcess)
268 },
[email protected]ce5737142011-04-14 23:35:09269 {
[email protected]20b5df962011-04-18 22:07:43270 "multi-profiles",
271 IDS_FLAGS_MULTI_PROFILES_NAME,
272 IDS_FLAGS_MULTI_PROFILES_DESCRIPTION,
[email protected]5d7a87572011-09-14 22:44:13273 kOsLinux, // This switch is not available in CrOS.
[email protected]20b5df962011-04-18 22:07:43274 SINGLE_VALUE_TYPE(switches::kMultiProfiles)
275 },
[email protected]cc057b02011-04-21 17:19:04276 {
[email protected]f2557bd2011-06-01 02:33:07277 "preload-instant-search",
278 IDS_FLAGS_PRELOAD_INSTANT_SEARCH_NAME,
279 IDS_FLAGS_PRELOAD_INSTANT_SEARCH_DESCRIPTION,
280 kOsAll,
281 SINGLE_VALUE_TYPE(switches::kPreloadInstantSearch)
282 },
[email protected]354e33b2011-06-15 00:29:10283 {
284 "static-ip-config",
285 IDS_FLAGS_STATIC_IP_CONFIG_NAME,
286 IDS_FLAGS_STATIC_IP_CONFIG_DESCRIPTION,
287 kOsCrOS,
288#if defined(OS_CHROMEOS)
289 // This switch exists only on Chrome OS.
290 SINGLE_VALUE_TYPE(switches::kEnableStaticIPConfig)
291#else
292 SINGLE_VALUE_TYPE("")
293#endif
294 },
[email protected]3eb5728c2011-06-20 22:32:24295 {
296 "show-autofill-type-predictions",
297 IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_NAME,
298 IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_DESCRIPTION,
299 kOsAll,
300 SINGLE_VALUE_TYPE(switches::kShowAutofillTypePredictions)
301 },
[email protected]bff4d3e2011-06-21 23:58:52302 {
[email protected]9a6180d7d2011-09-07 01:40:33303 "sync-tabs",
304 IDS_FLAGS_SYNC_TABS_NAME,
305 IDS_FLAGS_SYNC_TABS_DESCRIPTION,
[email protected]5b0ec7f2011-08-11 02:17:17306 kOsAll,
[email protected]9a6180d7d2011-09-07 01:40:33307 SINGLE_VALUE_TYPE(switches::kEnableSyncTabs)
[email protected]5b0ec7f2011-08-11 02:17:17308 },
309 {
[email protected]d9e33092011-09-01 03:34:05310 "sync-search-engines",
311 IDS_FLAGS_SYNC_SEARCH_ENGINES_NAME,
312 IDS_FLAGS_SYNC_SEARCH_ENGINES_DESCRIPTION,
313 kOsAll,
314 SINGLE_VALUE_TYPE(switches::kEnableSyncSearchEngines)
315 },
316 {
[email protected]a22ebd812011-06-23 00:05:39317 "enable-smooth-scrolling", // FLAGS:RECORD_UMA
318 IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_NAME,
319 IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_DESCRIPTION,
320 // Can't expose the switch unless the code is compiled in.
[email protected]554b7062011-09-03 03:09:40321 // On by default for the Mac (different implementation in WebKit).
[email protected]a22ebd812011-06-23 00:05:39322#if defined(ENABLE_SMOOTH_SCROLLING)
[email protected]554b7062011-09-03 03:09:40323 kOsWin | kOsLinux | kOsCrOS,
[email protected]a22ebd812011-06-23 00:05:39324#else
325 0,
326#endif
327 SINGLE_VALUE_TYPE(switches::kEnableSmoothScrolling)
328 },
[email protected]81a6b0b2011-06-24 17:55:40329 {
[email protected]ae1eb29a2011-08-17 17:50:57330 "prerender-from-omnibox", // FLAGS:RECORD_UMA
[email protected]81a6b0b2011-06-24 17:55:40331 IDS_FLAGS_PRERENDER_FROM_OMNIBOX_NAME,
332 IDS_FLAGS_PRERENDER_FROM_OMNIBOX_DESCRIPTION,
333 kOsAll,
334 SINGLE_VALUE_TYPE(switches::kPrerenderFromOmnibox)
335 },
[email protected]40916632011-07-02 01:11:01336 {
[email protected]73fb1fc52011-07-09 00:06:54337 "panels",
338 IDS_FLAGS_ENABLE_PANELS_NAME,
339 IDS_FLAGS_ENABLE_PANELS_DESCRIPTION,
340 kOsAll,
341 SINGLE_VALUE_TYPE(switches::kEnablePanels)
342 },
[email protected]e3749d12011-07-25 22:22:12343 {
344 "enable-shortcuts-provider",
345 IDS_FLAGS_ENABLE_SHORTCUTS_PROVIDER,
346 IDS_FLAGS_ENABLE_SHORTCUTS_PROVIDER_DESCRIPTION,
347 kOsAll,
348 SINGLE_VALUE_TYPE(switches::kEnableShortcutsProvider)
349 },
[email protected]1a2966b92011-08-09 06:50:19350#if defined(OS_CHROMEOS)
351 {
[email protected]35d16db2011-08-26 00:13:12352 "enable-archives",
353 IDS_FILE_BROWSER_MOUNT_ARCHIVE,
354 IDS_FILE_MANAGER,
355 kOsCrOS,
356 SINGLE_VALUE_TYPE(switches::kEnableArchives)
357 },
[email protected]cd681c42011-09-29 02:49:44358 {
359 "enable-bluetooth",
360 IDS_FLAGS_ENABLE_BLUETOOTH_NAME,
361 IDS_FLAGS_ENABLE_BLUETOOTH_DESCRIPTION,
362 kOsCrOS,
363 SINGLE_VALUE_TYPE(switches::kEnableBluetooth)
364 },
[email protected]1a2966b92011-08-09 06:50:19365#endif
[email protected]80eb4262011-08-03 16:10:41366 {
367 "memory-widget",
368 IDS_FLAGS_MEMORY_WIDGET_NAME,
369 IDS_FLAGS_MEMORY_WIDGET_DESCRIPTION,
370 kOsCrOS,
371#if defined(OS_CHROMEOS)
372 // This switch exists only on Chrome OS.
373 SINGLE_VALUE_TYPE(switches::kMemoryWidget)
374#else
375 SINGLE_VALUE_TYPE("")
376#endif
[email protected]a0e4b072011-08-17 01:47:07377 },
[email protected]6ec18e62011-09-10 00:28:18378#if defined(TOUCH_UI)
379 {
380 "touchui-views-desktop",
381 IDS_FLAGS_DISABLE_VIEWS_DESKTOP_NAME,
382 IDS_FLAGS_DISABLE_VIEWS_DESKTOP_DESCRIPTION,
383 kOsCrOS,
384 SINGLE_VALUE_TYPE_AND_VALUE(switches::kViewsDesktop, "disabled")
385 },
386#endif
[email protected]a0e4b072011-08-17 01:47:07387 {
388 "downloads-new-ui", // FLAGS:RECORD_UMA
389 IDS_FLAGS_DOWNLOADS_NEW_UI_NAME,
390 IDS_FLAGS_DOWNLOADS_NEW_UI_DESCRIPTION,
391 kOsAll,
392 SINGLE_VALUE_TYPE(switches::kDownloadsNewUI)
393 },
[email protected]b7bb44f2011-09-01 05:17:03394 {
395 "enable-autologin",
396 IDS_FLAGS_ENABLE_AUTOLOGIN_NAME,
397 IDS_FLAGS_ENABLE_AUTOLOGIN_DESCRIPTION,
398 kOsMac | kOsWin | kOsLinux,
399 SINGLE_VALUE_TYPE(switches::kEnableAutologin)
400 },
[email protected]b9841172011-09-26 23:36:09401 {
402 "use-more-webui",
403 IDS_FLAGS_USE_MORE_WEBUI_NAME,
404 IDS_FLAGS_USE_MORE_WEBUI_DESCRIPTION,
405 kOsAll,
406 SINGLE_VALUE_TYPE(switches::kUseMoreWebUI)
407 },
[email protected]89c64cd2011-10-04 01:41:10408 {
409 "enable-ntp-bookmark-features",
410 IDS_FLAGS_ENABLE_NTP_BOOKMARK_FEATURES_NAME,
411 IDS_FLAGS_ENABLE_NTP_BOOKMARK_FEATURES_DESCRIPTION,
412 kOsAll,
413 SINGLE_VALUE_TYPE(switches::kEnableNTPBookmarkFeatures)
414 },
[email protected]f5da41d2011-10-08 17:40:07415 {
416 "enable-video-track",
417 IDS_FLAGS_ENABLE_VIDEO_TRACK_NAME,
418 IDS_FLAGS_ENABLE_VIDEO_TRACK_DESCRIPTION,
419 kOsAll,
420 SINGLE_VALUE_TYPE(switches::kEnableVideoTrack)
421 },
[email protected]a0e4b072011-08-17 01:47:07422};
[email protected]ad2a3ded2010-08-27 13:19:05423
[email protected]a314ee5a2010-10-26 21:23:28424const Experiment* experiments = kExperiments;
425size_t num_experiments = arraysize(kExperiments);
426
[email protected]e2ddbc92010-10-15 20:02:07427// Stores and encapsulates the little state that about:flags has.
428class FlagsState {
429 public:
430 FlagsState() : needs_restart_(false) {}
431 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line);
432 bool IsRestartNeededToCommitChanges();
433 void SetExperimentEnabled(
[email protected]a314ee5a2010-10-26 21:23:28434 PrefService* prefs, const std::string& internal_name, bool enable);
[email protected]e2ddbc92010-10-15 20:02:07435 void RemoveFlagsSwitches(
436 std::map<std::string, CommandLine::StringType>* switch_list);
437 void reset();
438
439 // Returns the singleton instance of this class
[email protected]8e8bb6d2010-12-13 08:18:55440 static FlagsState* GetInstance() {
[email protected]e2ddbc92010-10-15 20:02:07441 return Singleton<FlagsState>::get();
442 }
443
444 private:
445 bool needs_restart_;
[email protected]a82744532011-02-11 16:15:53446 std::map<std::string, std::string> flags_switches_;
[email protected]e2ddbc92010-10-15 20:02:07447
448 DISALLOW_COPY_AND_ASSIGN(FlagsState);
449};
450
[email protected]c7b7800a2010-10-07 18:51:35451// Extracts the list of enabled lab experiments from preferences and stores them
[email protected]ad2a3ded2010-08-27 13:19:05452// in a set.
[email protected]1a47d7e2010-10-15 00:37:24453void GetEnabledFlags(const PrefService* prefs, std::set<std::string>* result) {
[email protected]ad2a3ded2010-08-27 13:19:05454 const ListValue* enabled_experiments = prefs->GetList(
455 prefs::kEnabledLabsExperiments);
456 if (!enabled_experiments)
457 return;
458
459 for (ListValue::const_iterator it = enabled_experiments->begin();
460 it != enabled_experiments->end();
461 ++it) {
462 std::string experiment_name;
463 if (!(*it)->GetAsString(&experiment_name)) {
464 LOG(WARNING) << "Invalid entry in " << prefs::kEnabledLabsExperiments;
465 continue;
466 }
467 result->insert(experiment_name);
468 }
469}
470
471// Takes a set of enabled lab experiments
[email protected]1a47d7e2010-10-15 00:37:24472void SetEnabledFlags(
[email protected]ad2a3ded2010-08-27 13:19:05473 PrefService* prefs, const std::set<std::string>& enabled_experiments) {
[email protected]1bc78422011-03-31 08:41:38474 ListPrefUpdate update(prefs, prefs::kEnabledLabsExperiments);
475 ListValue* experiments_list = update.Get();
[email protected]ad2a3ded2010-08-27 13:19:05476
477 experiments_list->Clear();
478 for (std::set<std::string>::const_iterator it = enabled_experiments.begin();
479 it != enabled_experiments.end();
480 ++it) {
481 experiments_list->Append(new StringValue(*it));
482 }
483}
484
[email protected]8a6ff28d2010-12-02 16:35:19485// Returns the name used in prefs for the choice at the specified index.
486std::string NameForChoice(const Experiment& e, int index) {
[email protected]2ce9c89752011-02-25 18:24:34487 DCHECK_EQ(Experiment::MULTI_VALUE, e.type);
488 DCHECK_LT(index, e.num_choices);
[email protected]8a6ff28d2010-12-02 16:35:19489 return std::string(e.internal_name) + about_flags::testing::kMultiSeparator +
490 base::IntToString(index);
491}
492
493// Adds the internal names for the specified experiment to |names|.
494void AddInternalName(const Experiment& e, std::set<std::string>* names) {
495 if (e.type == Experiment::SINGLE_VALUE) {
496 names->insert(e.internal_name);
497 } else {
[email protected]2ce9c89752011-02-25 18:24:34498 DCHECK_EQ(Experiment::MULTI_VALUE, e.type);
[email protected]8a6ff28d2010-12-02 16:35:19499 for (int i = 0; i < e.num_choices; ++i)
500 names->insert(NameForChoice(e, i));
501 }
502}
503
[email protected]28e35af2011-02-09 12:56:22504// Confirms that an experiment is valid, used in a DCHECK in
505// SanitizeList below.
506bool ValidateExperiment(const Experiment& e) {
507 switch (e.type) {
508 case Experiment::SINGLE_VALUE:
509 DCHECK_EQ(0, e.num_choices);
510 DCHECK(!e.choices);
511 break;
512 case Experiment::MULTI_VALUE:
513 DCHECK_GT(e.num_choices, 0);
514 DCHECK(e.choices);
[email protected]a82744532011-02-11 16:15:53515 DCHECK(e.choices[0].command_line_switch);
516 DCHECK_EQ('\0', e.choices[0].command_line_switch[0]);
[email protected]28e35af2011-02-09 12:56:22517 break;
518 default:
519 NOTREACHED();
520 }
521 return true;
522}
523
[email protected]ad2a3ded2010-08-27 13:19:05524// Removes all experiments from prefs::kEnabledLabsExperiments that are
525// unknown, to prevent this list to become very long as experiments are added
526// and removed.
527void SanitizeList(PrefService* prefs) {
528 std::set<std::string> known_experiments;
[email protected]28e35af2011-02-09 12:56:22529 for (size_t i = 0; i < num_experiments; ++i) {
530 DCHECK(ValidateExperiment(experiments[i]));
[email protected]8a6ff28d2010-12-02 16:35:19531 AddInternalName(experiments[i], &known_experiments);
[email protected]28e35af2011-02-09 12:56:22532 }
[email protected]ad2a3ded2010-08-27 13:19:05533
534 std::set<std::string> enabled_experiments;
[email protected]1a47d7e2010-10-15 00:37:24535 GetEnabledFlags(prefs, &enabled_experiments);
[email protected]ad2a3ded2010-08-27 13:19:05536
537 std::set<std::string> new_enabled_experiments;
538 std::set_intersection(
539 known_experiments.begin(), known_experiments.end(),
540 enabled_experiments.begin(), enabled_experiments.end(),
541 std::inserter(new_enabled_experiments, new_enabled_experiments.begin()));
542
[email protected]1a47d7e2010-10-15 00:37:24543 SetEnabledFlags(prefs, new_enabled_experiments);
[email protected]ad2a3ded2010-08-27 13:19:05544}
545
[email protected]1a47d7e2010-10-15 00:37:24546void GetSanitizedEnabledFlags(
[email protected]ad2a3ded2010-08-27 13:19:05547 PrefService* prefs, std::set<std::string>* result) {
548 SanitizeList(prefs);
[email protected]1a47d7e2010-10-15 00:37:24549 GetEnabledFlags(prefs, result);
[email protected]ad2a3ded2010-08-27 13:19:05550}
551
[email protected]a314ee5a2010-10-26 21:23:28552// Variant of GetSanitizedEnabledFlags that also removes any flags that aren't
553// enabled on the current platform.
554void GetSanitizedEnabledFlagsForCurrentPlatform(
555 PrefService* prefs, std::set<std::string>* result) {
556 GetSanitizedEnabledFlags(prefs, result);
557
558 // Filter out any experiments that aren't enabled on the current platform. We
559 // don't remove these from prefs else syncing to a platform with a different
560 // set of experiments would be lossy.
561 std::set<std::string> platform_experiments;
562 int current_platform = GetCurrentPlatform();
563 for (size_t i = 0; i < num_experiments; ++i) {
564 if (experiments[i].supported_platforms & current_platform)
[email protected]8a6ff28d2010-12-02 16:35:19565 AddInternalName(experiments[i], &platform_experiments);
[email protected]a314ee5a2010-10-26 21:23:28566 }
567
568 std::set<std::string> new_enabled_experiments;
569 std::set_intersection(
570 platform_experiments.begin(), platform_experiments.end(),
571 result->begin(), result->end(),
572 std::inserter(new_enabled_experiments, new_enabled_experiments.begin()));
573
574 result->swap(new_enabled_experiments);
[email protected]ad2a3ded2010-08-27 13:19:05575}
576
[email protected]8a6ff28d2010-12-02 16:35:19577// Returns the Value representing the choice data in the specified experiment.
[email protected]8a6ff28d2010-12-02 16:35:19578Value* CreateChoiceData(const Experiment& experiment,
[email protected]28e35af2011-02-09 12:56:22579 const std::set<std::string>& enabled_experiments) {
[email protected]2ce9c89752011-02-25 18:24:34580 DCHECK_EQ(Experiment::MULTI_VALUE, experiment.type);
[email protected]8a6ff28d2010-12-02 16:35:19581 ListValue* result = new ListValue;
582 for (int i = 0; i < experiment.num_choices; ++i) {
583 const Experiment::Choice& choice = experiment.choices[i];
584 DictionaryValue* value = new DictionaryValue;
585 std::string name = NameForChoice(experiment, i);
586 value->SetString("description",
587 l10n_util::GetStringUTF16(choice.description_id));
588 value->SetString("internal_name", name);
[email protected]28e35af2011-02-09 12:56:22589 value->SetBoolean("selected", enabled_experiments.count(name) > 0);
[email protected]8a6ff28d2010-12-02 16:35:19590 result->Append(value);
591 }
592 return result;
593}
594
[email protected]e2ddbc92010-10-15 20:02:07595} // namespace
596
[email protected]1a47d7e2010-10-15 00:37:24597void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line) {
[email protected]8e8bb6d2010-12-13 08:18:55598 FlagsState::GetInstance()->ConvertFlagsToSwitches(prefs, command_line);
[email protected]ad2a3ded2010-08-27 13:19:05599}
600
[email protected]1a47d7e2010-10-15 00:37:24601ListValue* GetFlagsExperimentsData(PrefService* prefs) {
[email protected]ad2a3ded2010-08-27 13:19:05602 std::set<std::string> enabled_experiments;
[email protected]1a47d7e2010-10-15 00:37:24603 GetSanitizedEnabledFlags(prefs, &enabled_experiments);
[email protected]ad2a3ded2010-08-27 13:19:05604
605 int current_platform = GetCurrentPlatform();
606
607 ListValue* experiments_data = new ListValue();
[email protected]a314ee5a2010-10-26 21:23:28608 for (size_t i = 0; i < num_experiments; ++i) {
609 const Experiment& experiment = experiments[i];
[email protected]ad2a3ded2010-08-27 13:19:05610 if (!(experiment.supported_platforms & current_platform))
611 continue;
612
613 DictionaryValue* data = new DictionaryValue();
614 data->SetString("internal_name", experiment.internal_name);
615 data->SetString("name",
616 l10n_util::GetStringUTF16(experiment.visible_name_id));
617 data->SetString("description",
618 l10n_util::GetStringUTF16(
619 experiment.visible_description_id));
[email protected]ad2a3ded2010-08-27 13:19:05620
[email protected]28e35af2011-02-09 12:56:22621 switch (experiment.type) {
622 case Experiment::SINGLE_VALUE:
623 data->SetBoolean(
624 "enabled",
625 enabled_experiments.count(experiment.internal_name) > 0);
626 break;
627 case Experiment::MULTI_VALUE:
628 data->Set("choices", CreateChoiceData(experiment, enabled_experiments));
629 break;
630 default:
631 NOTREACHED();
[email protected]8a6ff28d2010-12-02 16:35:19632 }
633
[email protected]ad2a3ded2010-08-27 13:19:05634 experiments_data->Append(data);
635 }
636 return experiments_data;
637}
638
[email protected]ad2a3ded2010-08-27 13:19:05639bool IsRestartNeededToCommitChanges() {
[email protected]8e8bb6d2010-12-13 08:18:55640 return FlagsState::GetInstance()->IsRestartNeededToCommitChanges();
[email protected]ad2a3ded2010-08-27 13:19:05641}
642
643void SetExperimentEnabled(
[email protected]c7b7800a2010-10-07 18:51:35644 PrefService* prefs, const std::string& internal_name, bool enable) {
[email protected]8e8bb6d2010-12-13 08:18:55645 FlagsState::GetInstance()->SetExperimentEnabled(prefs, internal_name, enable);
[email protected]e2ddbc92010-10-15 20:02:07646}
647
648void RemoveFlagsSwitches(
649 std::map<std::string, CommandLine::StringType>* switch_list) {
[email protected]8e8bb6d2010-12-13 08:18:55650 FlagsState::GetInstance()->RemoveFlagsSwitches(switch_list);
[email protected]e2ddbc92010-10-15 20:02:07651}
652
[email protected]a314ee5a2010-10-26 21:23:28653int GetCurrentPlatform() {
654#if defined(OS_MACOSX)
655 return kOsMac;
656#elif defined(OS_WIN)
657 return kOsWin;
658#elif defined(OS_CHROMEOS) // Needs to be before the OS_LINUX check.
659 return kOsCrOS;
660#elif defined(OS_LINUX)
661 return kOsLinux;
662#else
663#error Unknown platform
664#endif
665}
666
[email protected]4bc5050c2010-11-18 17:55:54667void RecordUMAStatistics(const PrefService* prefs) {
668 std::set<std::string> flags;
669 GetEnabledFlags(prefs, &flags);
670 for (std::set<std::string>::iterator it = flags.begin(); it != flags.end();
671 ++it) {
672 std::string action("AboutFlags_");
673 action += *it;
674 UserMetrics::RecordComputedAction(action);
675 }
676 // Since flag metrics are recorded every startup, add a tick so that the
677 // stats can be made meaningful.
678 if (flags.size())
679 UserMetrics::RecordAction(UserMetricsAction("AboutFlags_StartupTick"));
[email protected]970b2fd2011-01-22 18:06:45680 UserMetrics::RecordAction(UserMetricsAction("StartupTick"));
[email protected]4bc5050c2010-11-18 17:55:54681}
682
[email protected]e2ddbc92010-10-15 20:02:07683//////////////////////////////////////////////////////////////////////////////
684// FlagsState implementation.
685
686namespace {
687
688void FlagsState::ConvertFlagsToSwitches(
689 PrefService* prefs, CommandLine* command_line) {
[email protected]e2ddbc92010-10-15 20:02:07690 if (command_line->HasSwitch(switches::kNoExperiments))
691 return;
692
693 std::set<std::string> enabled_experiments;
[email protected]ba8164242010-11-16 21:31:00694
[email protected]a314ee5a2010-10-26 21:23:28695 GetSanitizedEnabledFlagsForCurrentPlatform(prefs, &enabled_experiments);
[email protected]e2ddbc92010-10-15 20:02:07696
[email protected]a82744532011-02-11 16:15:53697 typedef std::map<std::string, std::pair<std::string, std::string> >
698 NameToSwitchAndValueMap;
699 NameToSwitchAndValueMap name_to_switch_map;
[email protected]8a6ff28d2010-12-02 16:35:19700 for (size_t i = 0; i < num_experiments; ++i) {
701 const Experiment& e = experiments[i];
702 if (e.type == Experiment::SINGLE_VALUE) {
[email protected]a82744532011-02-11 16:15:53703 name_to_switch_map[e.internal_name] =
704 std::pair<std::string, std::string>(e.command_line_switch,
705 e.command_line_value);
[email protected]8a6ff28d2010-12-02 16:35:19706 } else {
707 for (int j = 0; j < e.num_choices; ++j)
[email protected]a82744532011-02-11 16:15:53708 name_to_switch_map[NameForChoice(e, j)] =
709 std::pair<std::string, std::string>(
710 e.choices[j].command_line_switch,
711 e.choices[j].command_line_value);
[email protected]8a6ff28d2010-12-02 16:35:19712 }
713 }
[email protected]e2ddbc92010-10-15 20:02:07714
715 command_line->AppendSwitch(switches::kFlagSwitchesBegin);
[email protected]a82744532011-02-11 16:15:53716 flags_switches_.insert(
717 std::pair<std::string, std::string>(switches::kFlagSwitchesBegin,
718 std::string()));
[email protected]e2ddbc92010-10-15 20:02:07719 for (std::set<std::string>::iterator it = enabled_experiments.begin();
720 it != enabled_experiments.end();
721 ++it) {
722 const std::string& experiment_name = *it;
[email protected]a82744532011-02-11 16:15:53723 NameToSwitchAndValueMap::const_iterator name_to_switch_it =
[email protected]8a6ff28d2010-12-02 16:35:19724 name_to_switch_map.find(experiment_name);
725 if (name_to_switch_it == name_to_switch_map.end()) {
726 NOTREACHED();
[email protected]e2ddbc92010-10-15 20:02:07727 continue;
[email protected]8a6ff28d2010-12-02 16:35:19728 }
[email protected]e2ddbc92010-10-15 20:02:07729
[email protected]a82744532011-02-11 16:15:53730 const std::pair<std::string, std::string>&
731 switch_and_value_pair = name_to_switch_it->second;
732
733 command_line->AppendSwitchASCII(switch_and_value_pair.first,
734 switch_and_value_pair.second);
735 flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second;
[email protected]e2ddbc92010-10-15 20:02:07736 }
737 command_line->AppendSwitch(switches::kFlagSwitchesEnd);
[email protected]a82744532011-02-11 16:15:53738 flags_switches_.insert(
739 std::pair<std::string, std::string>(switches::kFlagSwitchesEnd,
740 std::string()));
[email protected]e2ddbc92010-10-15 20:02:07741}
742
743bool FlagsState::IsRestartNeededToCommitChanges() {
744 return needs_restart_;
745}
746
747void FlagsState::SetExperimentEnabled(
748 PrefService* prefs, const std::string& internal_name, bool enable) {
[email protected]ad2a3ded2010-08-27 13:19:05749 needs_restart_ = true;
750
[email protected]8a6ff28d2010-12-02 16:35:19751 size_t at_index = internal_name.find(about_flags::testing::kMultiSeparator);
752 if (at_index != std::string::npos) {
753 DCHECK(enable);
754 // We're being asked to enable a multi-choice experiment. Disable the
755 // currently selected choice.
756 DCHECK_NE(at_index, 0u);
[email protected]28e35af2011-02-09 12:56:22757 const std::string experiment_name = internal_name.substr(0, at_index);
758 SetExperimentEnabled(prefs, experiment_name, false);
[email protected]8a6ff28d2010-12-02 16:35:19759
[email protected]28e35af2011-02-09 12:56:22760 // And enable the new choice, if it is not the default first choice.
761 if (internal_name != experiment_name + "@0") {
762 std::set<std::string> enabled_experiments;
763 GetSanitizedEnabledFlags(prefs, &enabled_experiments);
764 enabled_experiments.insert(internal_name);
765 SetEnabledFlags(prefs, enabled_experiments);
766 }
[email protected]8a6ff28d2010-12-02 16:35:19767 return;
768 }
769
[email protected]ad2a3ded2010-08-27 13:19:05770 std::set<std::string> enabled_experiments;
[email protected]1a47d7e2010-10-15 00:37:24771 GetSanitizedEnabledFlags(prefs, &enabled_experiments);
[email protected]ad2a3ded2010-08-27 13:19:05772
[email protected]8a6ff28d2010-12-02 16:35:19773 const Experiment* e = NULL;
774 for (size_t i = 0; i < num_experiments; ++i) {
775 if (experiments[i].internal_name == internal_name) {
776 e = experiments + i;
777 break;
778 }
779 }
780 DCHECK(e);
781
782 if (e->type == Experiment::SINGLE_VALUE) {
[email protected]8a2713682011-08-19 10:36:59783 if (enable)
[email protected]8a6ff28d2010-12-02 16:35:19784 enabled_experiments.insert(internal_name);
[email protected]8a2713682011-08-19 10:36:59785 else
[email protected]8a6ff28d2010-12-02 16:35:19786 enabled_experiments.erase(internal_name);
787 } else {
788 if (enable) {
789 // Enable the first choice.
790 enabled_experiments.insert(NameForChoice(*e, 0));
791 } else {
792 // Find the currently enabled choice and disable it.
793 for (int i = 0; i < e->num_choices; ++i) {
794 std::string choice_name = NameForChoice(*e, i);
795 if (enabled_experiments.find(choice_name) !=
796 enabled_experiments.end()) {
797 enabled_experiments.erase(choice_name);
798 // Continue on just in case there's a bug and more than one
799 // experiment for this choice was enabled.
800 }
801 }
802 }
803 }
[email protected]ad2a3ded2010-08-27 13:19:05804
[email protected]1a47d7e2010-10-15 00:37:24805 SetEnabledFlags(prefs, enabled_experiments);
[email protected]ad2a3ded2010-08-27 13:19:05806}
807
[email protected]e2ddbc92010-10-15 20:02:07808void FlagsState::RemoveFlagsSwitches(
809 std::map<std::string, CommandLine::StringType>* switch_list) {
[email protected]a82744532011-02-11 16:15:53810 for (std::map<std::string, std::string>::const_iterator
811 it = flags_switches_.begin(); it != flags_switches_.end(); ++it) {
812 switch_list->erase(it->first);
[email protected]e2ddbc92010-10-15 20:02:07813 }
814}
815
816void FlagsState::reset() {
817 needs_restart_ = false;
818 flags_switches_.clear();
819}
820
[email protected]38e46812011-05-09 20:49:22821} // namespace
[email protected]e2ddbc92010-10-15 20:02:07822
823namespace testing {
[email protected]8a6ff28d2010-12-02 16:35:19824
825// WARNING: '@' is also used in the html file. If you update this constant you
826// also need to update the html file.
827const char kMultiSeparator[] = "@";
828
[email protected]e2ddbc92010-10-15 20:02:07829void ClearState() {
[email protected]8e8bb6d2010-12-13 08:18:55830 FlagsState::GetInstance()->reset();
[email protected]e2ddbc92010-10-15 20:02:07831}
[email protected]a314ee5a2010-10-26 21:23:28832
833void SetExperiments(const Experiment* e, size_t count) {
834 if (!e) {
835 experiments = kExperiments;
836 num_experiments = arraysize(kExperiments);
837 } else {
838 experiments = e;
839 num_experiments = count;
840 }
841}
842
[email protected]8a6ff28d2010-12-02 16:35:19843const Experiment* GetExperiments(size_t* count) {
844 *count = num_experiments;
845 return experiments;
846}
847
[email protected]e2ddbc92010-10-15 20:02:07848} // namespace testing
849
[email protected]1a47d7e2010-10-15 00:37:24850} // namespace about_flags