Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: chrome/browser/about_flags.cc

Issue 12326019: Refactor about_flags.cc to make defining enabled/disabled/default flags easier. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/about_flags.h ('k') | chrome/browser/about_flags_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/about_flags.h" 5 #include "chrome/browser/about_flags.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <utility>
11 12
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
14 #include "base/prefs/pref_service.h" 15 #include "base/prefs/pref_service.h"
15 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
17 #include "base/values.h" 18 #include "base/values.h"
18 #include "cc/switches.h" 19 #include "cc/switches.h"
19 #include "chrome/browser/prefs/scoped_user_pref_update.h" 20 #include "chrome/browser/prefs/scoped_user_pref_update.h"
20 #include "chrome/common/chrome_content_client.h" 21 #include "chrome/common/chrome_content_client.h"
(...skipping 22 matching lines...) Expand all
43 #if defined(OS_CHROMEOS) 44 #if defined(OS_CHROMEOS)
44 #include "chromeos/chromeos_switches.h" 45 #include "chromeos/chromeos_switches.h"
45 #endif 46 #endif
46 47
47 using content::UserMetricsAction; 48 using content::UserMetricsAction;
48 49
49 namespace about_flags { 50 namespace about_flags {
50 51
51 // Macros to simplify specifying the type. 52 // Macros to simplify specifying the type.
52 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ 53 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
53 Experiment::SINGLE_VALUE, command_line_switch, switch_value, NULL, 0 54 Experiment::SINGLE_VALUE, \
55 command_line_switch, switch_value, NULL, NULL, NULL, 0
54 #define SINGLE_VALUE_TYPE(command_line_switch) \ 56 #define SINGLE_VALUE_TYPE(command_line_switch) \
55 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") 57 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "")
58 #define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \
59 disable_switch, disable_value) \
60 Experiment::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \
61 disable_switch, disable_value, NULL, 3
62 #define ENABLE_DISABLE_VALUE_TYPE(enable_switch, disable_switch) \
63 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, "", disable_switch, "")
56 #define MULTI_VALUE_TYPE(choices) \ 64 #define MULTI_VALUE_TYPE(choices) \
57 Experiment::MULTI_VALUE, "", "", choices, arraysize(choices) 65 Experiment::MULTI_VALUE, NULL, NULL, NULL, NULL, choices, arraysize(choices)
58 66
59 namespace { 67 namespace {
60 68
61 const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS | kOsAndroid; 69 const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS | kOsAndroid;
62 const unsigned kOsDesktop = kOsMac | kOsWin | kOsLinux | kOsCrOS; 70 const unsigned kOsDesktop = kOsMac | kOsWin | kOsLinux | kOsCrOS;
63 71
64 // Adds a |StringValue| to |list| for each platform where |bitmask| indicates 72 // Adds a |StringValue| to |list| for each platform where |bitmask| indicates
65 // whether the experiment is available on that platform. 73 // whether the experiment is available on that platform.
66 void AddOsStrings(unsigned bitmask, ListValue* list) { 74 void AddOsStrings(unsigned bitmask, ListValue* list) {
67 struct { 75 struct {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 const Experiment::Choice kOmniboxInlineHistoryQuickProviderChoices[] = { 113 const Experiment::Choice kOmniboxInlineHistoryQuickProviderChoices[] = {
106 { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_AUTOMATIC, "", "" }, 114 { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_AUTOMATIC, "", "" },
107 { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_ALLOWED, 115 { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_ALLOWED,
108 switches::kOmniboxInlineHistoryQuickProvider, 116 switches::kOmniboxInlineHistoryQuickProvider,
109 switches::kOmniboxInlineHistoryQuickProviderAllowed }, 117 switches::kOmniboxInlineHistoryQuickProviderAllowed },
110 { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_PROHIBITED, 118 { IDS_FLAGS_OMNIBOX_INLINE_HISTORY_QUICK_PROVIDER_PROHIBITED,
111 switches::kOmniboxInlineHistoryQuickProvider, 119 switches::kOmniboxInlineHistoryQuickProvider,
112 switches::kOmniboxInlineHistoryQuickProviderProhibited } 120 switches::kOmniboxInlineHistoryQuickProviderProhibited }
113 }; 121 };
114 122
115 const Experiment::Choice kFixedPositionCreatesStackingContextChoices[] = {
116 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
117 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
118 switches::kEnableFixedPositionCreatesStackingContext, ""},
119 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
120 switches::kDisableFixedPositionCreatesStackingContext, ""}
121 };
122
123 const Experiment::Choice kEnableCompositingForFixedPositionChoices[] = { 123 const Experiment::Choice kEnableCompositingForFixedPositionChoices[] = {
124 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 124 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
125 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 125 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
126 switches::kEnableCompositingForFixedPosition, ""}, 126 switches::kEnableCompositingForFixedPosition, ""},
127 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 127 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
128 switches::kDisableCompositingForFixedPosition, ""}, 128 switches::kDisableCompositingForFixedPosition, ""},
129 { IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_HIGH_DPI, 129 { IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_HIGH_DPI,
130 switches::kEnableHighDpiCompositingForFixedPosition, ""} 130 switches::kEnableHighDpiCompositingForFixedPosition, ""}
131 }; 131 };
132 132
133 const Experiment::Choice kForceCompositingModeChoices[] = {
134 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
135 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
136 switches::kForceCompositingMode, ""},
137 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
138 switches::kDisableForceCompositingMode, ""}
139 };
140
141 const Experiment::Choice kThreadedCompositingModeChoices[] = {
142 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
143 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
144 switches::kDisableThreadedCompositing, ""},
145 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
146 switches::kEnableThreadedCompositing, ""}
147 };
148
149 const Experiment::Choice kForceAcceleratedOverflowScrollModeChoices[] = {
150 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
151 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
152 switches::kDisableAcceleratedOverflowScroll, ""},
153 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
154 switches::kEnableAcceleratedOverflowScroll, ""}
155 };
156
157 const Experiment::Choice kGDIPresentChoices[] = { 133 const Experiment::Choice kGDIPresentChoices[] = {
158 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 134 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
159 { IDS_FLAGS_PRESENT_WITH_GDI_FIRST_SHOW, 135 { IDS_FLAGS_PRESENT_WITH_GDI_FIRST_SHOW,
160 switches::kDoFirstShowPresentWithGDI, ""}, 136 switches::kDoFirstShowPresentWithGDI, ""},
161 { IDS_FLAGS_PRESENT_WITH_GDI_ALL_SHOW, 137 { IDS_FLAGS_PRESENT_WITH_GDI_ALL_SHOW,
162 switches::kDoAllShowPresentWithGDI, ""} 138 switches::kDoAllShowPresentWithGDI, ""}
163 }; 139 };
164 140
165
166 const Experiment::Choice kTouchEventsChoices[] = { 141 const Experiment::Choice kTouchEventsChoices[] = {
167 { IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC, "", "" }, 142 { IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC, "", "" },
168 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 143 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
169 switches::kTouchEvents, 144 switches::kTouchEvents,
170 switches::kTouchEventsEnabled }, 145 switches::kTouchEventsEnabled },
171 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 146 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
172 switches::kTouchEvents, 147 switches::kTouchEvents,
173 switches::kTouchEventsDisabled } 148 switches::kTouchEventsDisabled }
174 }; 149 };
175 150
176 const Experiment::Choice kTouchOptimizedUIChoices[] = { 151 const Experiment::Choice kTouchOptimizedUIChoices[] = {
177 { IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC, "", "" }, 152 { IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC, "", "" },
178 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 153 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
179 switches::kTouchOptimizedUI, 154 switches::kTouchOptimizedUI,
180 switches::kTouchOptimizedUIEnabled }, 155 switches::kTouchOptimizedUIEnabled },
181 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 156 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
182 switches::kTouchOptimizedUI, 157 switches::kTouchOptimizedUI,
183 switches::kTouchOptimizedUIDisabled } 158 switches::kTouchOptimizedUIDisabled }
184 }; 159 };
185 160
186 const Experiment::Choice kAsyncDnsChoices[] = {
187 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
188 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
189 switches::kDisableAsyncDns, ""},
190 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
191 switches::kEnableAsyncDns, ""}
192 };
193
194 const Experiment::Choice kNaClDebugMaskChoices[] = { 161 const Experiment::Choice kNaClDebugMaskChoices[] = {
195 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 162 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
196 // Secure shell can be used on ChromeOS for forwarding the TCP port opened by 163 // Secure shell can be used on ChromeOS for forwarding the TCP port opened by
197 // debug stub to a remote machine. Since secure shell uses NaCl, we provide 164 // debug stub to a remote machine. Since secure shell uses NaCl, we provide
198 // an option to switch off its debugging. 165 // an option to switch off its debugging.
199 { IDS_NACL_DEBUG_MASK_CHOICE_EXCLUDE_UTILS, 166 { IDS_NACL_DEBUG_MASK_CHOICE_EXCLUDE_UTILS,
200 switches::kNaClDebugMask, "!*://*/*ssh_client.nmf" }, 167 switches::kNaClDebugMask, "!*://*/*ssh_client.nmf" },
201 { IDS_NACL_DEBUG_MASK_CHOICE_INCLUDE_DEBUG, 168 { IDS_NACL_DEBUG_MASK_CHOICE_INCLUDE_DEBUG,
202 switches::kNaClDebugMask, "*://*/*debug.nmf" } 169 switches::kNaClDebugMask, "*://*/*debug.nmf" }
203 }; 170 };
204 171
205 const Experiment::Choice kActionBoxChoices[] = {
206 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
207 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
208 switches::kActionBox, "0"},
209 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
210 switches::kActionBox, "1"}
211 };
212
213 const Experiment::Choice kScriptBubbleChoices[] = {
214 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
215 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
216 switches::kScriptBubble, "0"},
217 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
218 switches::kScriptBubble, "1"}
219 };
220
221 const Experiment::Choice kTabCaptureChoices[] = {
222 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
223 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
224 switches::kTabCapture, "0"},
225 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
226 switches::kTabCapture, "1"}
227 };
228
229 #if defined(OS_CHROMEOS) 172 #if defined(OS_CHROMEOS)
230 const Experiment::Choice kAshBootAnimationFunction[] = { 173 const Experiment::Choice kAshBootAnimationFunction[] = {
231 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 174 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
232 { IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION2, 175 { IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION2,
233 ash::switches::kAshBootAnimationFunction2, ""}, 176 ash::switches::kAshBootAnimationFunction2, ""},
234 { IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION3, 177 { IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION3,
235 ash::switches::kAshBootAnimationFunction3, ""} 178 ash::switches::kAshBootAnimationFunction3, ""}
236 }; 179 };
237 180
238 const Experiment::Choice kChromeCaptivePortalDetectionChoices[] = { 181 const Experiment::Choice kChromeCaptivePortalDetectionChoices[] = {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 IDS_FLAGS_IGNORE_GPU_BLACKLIST_NAME, 287 IDS_FLAGS_IGNORE_GPU_BLACKLIST_NAME,
345 IDS_FLAGS_IGNORE_GPU_BLACKLIST_DESCRIPTION, 288 IDS_FLAGS_IGNORE_GPU_BLACKLIST_DESCRIPTION,
346 kOsAll, 289 kOsAll,
347 SINGLE_VALUE_TYPE(switches::kIgnoreGpuBlacklist) 290 SINGLE_VALUE_TYPE(switches::kIgnoreGpuBlacklist)
348 }, 291 },
349 { 292 {
350 "force-compositing-mode-2", 293 "force-compositing-mode-2",
351 IDS_FLAGS_FORCE_COMPOSITING_MODE_NAME, 294 IDS_FLAGS_FORCE_COMPOSITING_MODE_NAME,
352 IDS_FLAGS_FORCE_COMPOSITING_MODE_DESCRIPTION, 295 IDS_FLAGS_FORCE_COMPOSITING_MODE_DESCRIPTION,
353 kOsMac | kOsWin | kOsLinux, 296 kOsMac | kOsWin | kOsLinux,
354 MULTI_VALUE_TYPE(kForceCompositingModeChoices) 297 ENABLE_DISABLE_VALUE_TYPE(switches::kForceCompositingMode,
298 switches::kDisableForceCompositingMode)
355 }, 299 },
356 { 300 {
357 "threaded-compositing-mode", 301 "threaded-compositing-mode",
358 IDS_FLAGS_THREADED_COMPOSITING_MODE_NAME, 302 IDS_FLAGS_THREADED_COMPOSITING_MODE_NAME,
359 IDS_FLAGS_THREADED_COMPOSITING_MODE_DESCRIPTION, 303 IDS_FLAGS_THREADED_COMPOSITING_MODE_DESCRIPTION,
360 kOsDesktop & ~kOsCrOS, 304 kOsDesktop & ~kOsCrOS,
361 MULTI_VALUE_TYPE(kThreadedCompositingModeChoices) 305 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableThreadedCompositing,
306 switches::kDisableThreadedCompositing)
362 }, 307 },
363 { 308 {
364 "force-accelerated-composited-scrolling", 309 "force-accelerated-composited-scrolling",
365 IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_NAME, 310 IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_NAME,
366 IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_DESCRIPTION, 311 IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_DESCRIPTION,
367 kOsAll, 312 kOsAll,
368 MULTI_VALUE_TYPE(kForceAcceleratedOverflowScrollModeChoices) 313 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableAcceleratedOverflowScroll,
314 switches::kDisableAcceleratedOverflowScroll)
369 }, 315 },
370 { 316 {
371 "present-with-GDI", 317 "present-with-GDI",
372 IDS_FLAGS_PRESENT_WITH_GDI_NAME, 318 IDS_FLAGS_PRESENT_WITH_GDI_NAME,
373 IDS_FLAGS_PRESENT_WITH_GDI_DESCRIPTION, 319 IDS_FLAGS_PRESENT_WITH_GDI_DESCRIPTION,
374 kOsWin, 320 kOsWin,
375 MULTI_VALUE_TYPE(kGDIPresentChoices) 321 MULTI_VALUE_TYPE(kGDIPresentChoices)
376 }, 322 },
377 { 323 {
378 "disable-accelerated-2d-canvas", 324 "disable-accelerated-2d-canvas",
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 SINGLE_VALUE_TYPE(switches::kEnableWebRTC) 400 SINGLE_VALUE_TYPE(switches::kEnableWebRTC)
455 #else 401 #else
456 SINGLE_VALUE_TYPE("") 402 SINGLE_VALUE_TYPE("")
457 #endif 403 #endif
458 }, 404 },
459 { 405 {
460 "fixed-position-creates-stacking-context", 406 "fixed-position-creates-stacking-context",
461 IDS_FLAGS_FIXED_POSITION_CREATES_STACKING_CONTEXT_NAME, 407 IDS_FLAGS_FIXED_POSITION_CREATES_STACKING_CONTEXT_NAME,
462 IDS_FLAGS_FIXED_POSITION_CREATES_STACKING_CONTEXT_DESCRIPTION, 408 IDS_FLAGS_FIXED_POSITION_CREATES_STACKING_CONTEXT_DESCRIPTION,
463 kOsAll, 409 kOsAll,
464 MULTI_VALUE_TYPE(kFixedPositionCreatesStackingContextChoices) 410 ENABLE_DISABLE_VALUE_TYPE(
411 switches::kEnableFixedPositionCreatesStackingContext,
412 switches::kDisableFixedPositionCreatesStackingContext)
465 }, 413 },
466 { 414 {
467 "enable-compositing-for-fixed-position", 415 "enable-compositing-for-fixed-position",
468 IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_NAME, 416 IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_NAME,
469 IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_DESCRIPTION, 417 IDS_FLAGS_COMPOSITING_FOR_FIXED_POSITION_DESCRIPTION,
470 kOsAll, 418 kOsAll,
471 MULTI_VALUE_TYPE(kEnableCompositingForFixedPositionChoices) 419 MULTI_VALUE_TYPE(kEnableCompositingForFixedPositionChoices)
472 }, 420 },
473 // TODO(bbudge): When NaCl is on by default, remove this flag entry. 421 // TODO(bbudge): When NaCl is on by default, remove this flag entry.
474 { 422 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_NAME, 461 IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_NAME,
514 IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_DESCRIPTION, 462 IDS_FLAGS_EXPERIMENTAL_EXTENSION_APIS_DESCRIPTION,
515 kOsDesktop, 463 kOsDesktop,
516 SINGLE_VALUE_TYPE(switches::kEnableExperimentalExtensionApis) 464 SINGLE_VALUE_TYPE(switches::kEnableExperimentalExtensionApis)
517 }, 465 },
518 { 466 {
519 "action-box", 467 "action-box",
520 IDS_FLAGS_ACTION_BOX_NAME, 468 IDS_FLAGS_ACTION_BOX_NAME,
521 IDS_FLAGS_ACTION_BOX_DESCRIPTION, 469 IDS_FLAGS_ACTION_BOX_DESCRIPTION,
522 kOsDesktop, 470 kOsDesktop,
523 MULTI_VALUE_TYPE(kActionBoxChoices), 471 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kActionBox, "1",
472 switches::kActionBox, "0")
524 }, 473 },
525 { 474 {
526 "script-badges", 475 "script-badges",
527 IDS_FLAGS_SCRIPT_BADGES_NAME, 476 IDS_FLAGS_SCRIPT_BADGES_NAME,
528 IDS_FLAGS_SCRIPT_BADGES_DESCRIPTION, 477 IDS_FLAGS_SCRIPT_BADGES_DESCRIPTION,
529 kOsDesktop, 478 kOsDesktop,
530 SINGLE_VALUE_TYPE(switches::kScriptBadges) 479 SINGLE_VALUE_TYPE(switches::kScriptBadges)
531 }, 480 },
532 { 481 {
533 "script-bubble", 482 "script-bubble",
534 IDS_FLAGS_SCRIPT_BUBBLE_NAME, 483 IDS_FLAGS_SCRIPT_BUBBLE_NAME,
535 IDS_FLAGS_SCRIPT_BUBBLE_DESCRIPTION, 484 IDS_FLAGS_SCRIPT_BUBBLE_DESCRIPTION,
536 kOsDesktop, 485 kOsDesktop,
537 MULTI_VALUE_TYPE(kScriptBubbleChoices), 486 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kScriptBubble, "1",
487 switches::kScriptBubble, "0")
538 }, 488 },
539 { 489 {
540 "apps-new-install-bubble", 490 "apps-new-install-bubble",
541 IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_NAME, 491 IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_NAME,
542 IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_DESCRIPTION, 492 IDS_FLAGS_APPS_NEW_INSTALL_BUBBLE_DESCRIPTION,
543 kOsDesktop, 493 kOsDesktop,
544 SINGLE_VALUE_TYPE(switches::kAppsNewInstallBubble) 494 SINGLE_VALUE_TYPE(switches::kAppsNewInstallBubble)
545 }, 495 },
546 { 496 {
547 "disable-hyperlink-auditing", 497 "disable-hyperlink-auditing",
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 IDS_FLAGS_ENABLE_SPDY3_NAME, 632 IDS_FLAGS_ENABLE_SPDY3_NAME,
683 IDS_FLAGS_ENABLE_SPDY3_DESCRIPTION, 633 IDS_FLAGS_ENABLE_SPDY3_DESCRIPTION,
684 kOsAll, 634 kOsAll,
685 SINGLE_VALUE_TYPE(switches::kEnableSpdy3) 635 SINGLE_VALUE_TYPE(switches::kEnableSpdy3)
686 }, 636 },
687 { 637 {
688 "enable-async-dns", 638 "enable-async-dns",
689 IDS_FLAGS_ENABLE_ASYNC_DNS_NAME, 639 IDS_FLAGS_ENABLE_ASYNC_DNS_NAME,
690 IDS_FLAGS_ENABLE_ASYNC_DNS_DESCRIPTION, 640 IDS_FLAGS_ENABLE_ASYNC_DNS_DESCRIPTION,
691 kOsWin | kOsMac | kOsLinux | kOsCrOS, 641 kOsWin | kOsMac | kOsLinux | kOsCrOS,
692 MULTI_VALUE_TYPE(kAsyncDnsChoices) 642 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableAsyncDns,
643 switches::kDisableAsyncDns)
693 }, 644 },
694 { 645 {
695 "disable-media-source", 646 "disable-media-source",
696 IDS_FLAGS_DISABLE_MEDIA_SOURCE_NAME, 647 IDS_FLAGS_DISABLE_MEDIA_SOURCE_NAME,
697 IDS_FLAGS_DISABLE_MEDIA_SOURCE_DESCRIPTION, 648 IDS_FLAGS_DISABLE_MEDIA_SOURCE_DESCRIPTION,
698 kOsAll, 649 kOsAll,
699 SINGLE_VALUE_TYPE(switches::kDisableMediaSource) 650 SINGLE_VALUE_TYPE(switches::kDisableMediaSource)
700 }, 651 },
701 { 652 {
702 "disable-encrypted-media", 653 "disable-encrypted-media",
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 IDS_DISABLE_TOUCH_ADJUSTMENT_NAME, 820 IDS_DISABLE_TOUCH_ADJUSTMENT_NAME,
870 IDS_DISABLE_TOUCH_ADJUSTMENT_DESCRIPTION, 821 IDS_DISABLE_TOUCH_ADJUSTMENT_DESCRIPTION,
871 kOsWin | kOsLinux | kOsCrOS, 822 kOsWin | kOsLinux | kOsCrOS,
872 SINGLE_VALUE_TYPE(switches::kDisableTouchAdjustment) 823 SINGLE_VALUE_TYPE(switches::kDisableTouchAdjustment)
873 }, 824 },
874 { 825 {
875 "enable-tab-capture", 826 "enable-tab-capture",
876 IDS_ENABLE_TAB_CAPTURE_NAME, 827 IDS_ENABLE_TAB_CAPTURE_NAME,
877 IDS_ENABLE_TAB_CAPTURE_DESCRIPTION, 828 IDS_ENABLE_TAB_CAPTURE_DESCRIPTION,
878 kOsWin | kOsMac | kOsLinux | kOsCrOS, 829 kOsWin | kOsMac | kOsLinux | kOsCrOS,
879 MULTI_VALUE_TYPE(kTabCaptureChoices) 830 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kTabCapture, "1",
831 switches::kTabCapture, "0")
880 }, 832 },
881 #if defined(OS_CHROMEOS) 833 #if defined(OS_CHROMEOS)
882 { 834 {
883 "enable-background-loader", 835 "enable-background-loader",
884 IDS_ENABLE_BACKLOADER_NAME, 836 IDS_ENABLE_BACKLOADER_NAME,
885 IDS_ENABLE_BACKLOADER_DESCRIPTION, 837 IDS_ENABLE_BACKLOADER_DESCRIPTION,
886 kOsCrOS, 838 kOsCrOS,
887 SINGLE_VALUE_TYPE(switches::kEnableBackgroundLoader) 839 SINGLE_VALUE_TYPE(switches::kEnableBackgroundLoader)
888 }, 840 },
889 { 841 {
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 ListValue* experiments_list = update.Get(); 1289 ListValue* experiments_list = update.Get();
1338 1290
1339 experiments_list->Clear(); 1291 experiments_list->Clear();
1340 for (std::set<std::string>::const_iterator it = enabled_experiments.begin(); 1292 for (std::set<std::string>::const_iterator it = enabled_experiments.begin();
1341 it != enabled_experiments.end(); 1293 it != enabled_experiments.end();
1342 ++it) { 1294 ++it) {
1343 experiments_list->Append(new StringValue(*it)); 1295 experiments_list->Append(new StringValue(*it));
1344 } 1296 }
1345 } 1297 }
1346 1298
1347 // Returns the name used in prefs for the choice at the specified index.
1348 std::string NameForChoice(const Experiment& e, int index) {
1349 DCHECK_EQ(Experiment::MULTI_VALUE, e.type);
1350 DCHECK_LT(index, e.num_choices);
1351 return std::string(e.internal_name) + about_flags::testing::kMultiSeparator +
1352 base::IntToString(index);
1353 }
1354
1355 // Adds the internal names for the specified experiment to |names|. 1299 // Adds the internal names for the specified experiment to |names|.
1356 void AddInternalName(const Experiment& e, std::set<std::string>* names) { 1300 void AddInternalName(const Experiment& e, std::set<std::string>* names) {
1357 if (e.type == Experiment::SINGLE_VALUE) { 1301 if (e.type == Experiment::SINGLE_VALUE) {
1358 names->insert(e.internal_name); 1302 names->insert(e.internal_name);
1359 } else { 1303 } else {
1360 DCHECK_EQ(Experiment::MULTI_VALUE, e.type); 1304 DCHECK(e.type == Experiment::MULTI_VALUE ||
1305 e.type == Experiment::ENABLE_DISABLE_VALUE);
1361 for (int i = 0; i < e.num_choices; ++i) 1306 for (int i = 0; i < e.num_choices; ++i)
1362 names->insert(NameForChoice(e, i)); 1307 names->insert(e.NameForChoice(i));
1363 } 1308 }
1364 } 1309 }
1365 1310
1366 // Confirms that an experiment is valid, used in a DCHECK in 1311 // Confirms that an experiment is valid, used in a DCHECK in
1367 // SanitizeList below. 1312 // SanitizeList below.
1368 bool ValidateExperiment(const Experiment& e) { 1313 bool ValidateExperiment(const Experiment& e) {
1369 switch (e.type) { 1314 switch (e.type) {
1370 case Experiment::SINGLE_VALUE: 1315 case Experiment::SINGLE_VALUE:
1371 DCHECK_EQ(0, e.num_choices); 1316 DCHECK_EQ(0, e.num_choices);
1372 DCHECK(!e.choices); 1317 DCHECK(!e.choices);
1373 break; 1318 break;
1374 case Experiment::MULTI_VALUE: 1319 case Experiment::MULTI_VALUE:
1375 DCHECK_GT(e.num_choices, 0); 1320 DCHECK_GT(e.num_choices, 0);
1376 DCHECK(e.choices); 1321 DCHECK(e.choices);
1377 DCHECK(e.choices[0].command_line_switch); 1322 DCHECK(e.choices[0].command_line_switch);
1378 DCHECK_EQ('\0', e.choices[0].command_line_switch[0]); 1323 DCHECK_EQ('\0', e.choices[0].command_line_switch[0]);
1379 break; 1324 break;
1325 case Experiment::ENABLE_DISABLE_VALUE:
1326 DCHECK_EQ(3, e.num_choices);
1327 DCHECK(!e.choices);
1328 DCHECK(e.command_line_switch);
1329 DCHECK(e.command_line_value);
1330 DCHECK(e.disable_command_line_switch);
1331 DCHECK(e.disable_command_line_value);
1332 break;
1380 default: 1333 default:
1381 NOTREACHED(); 1334 NOTREACHED();
1382 } 1335 }
1383 return true; 1336 return true;
1384 } 1337 }
1385 1338
1386 // Removes all experiments from prefs::kEnabledLabsExperiments that are 1339 // Removes all experiments from prefs::kEnabledLabsExperiments that are
1387 // unknown, to prevent this list to become very long as experiments are added 1340 // unknown, to prevent this list to become very long as experiments are added
1388 // and removed. 1341 // and removed.
1389 void SanitizeList(PrefService* prefs) { 1342 void SanitizeList(PrefService* prefs) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 platform_experiments.begin(), platform_experiments.end(), 1386 platform_experiments.begin(), platform_experiments.end(),
1434 result->begin(), result->end(), 1387 result->begin(), result->end(),
1435 std::inserter(new_enabled_experiments, new_enabled_experiments.begin())); 1388 std::inserter(new_enabled_experiments, new_enabled_experiments.begin()));
1436 1389
1437 result->swap(new_enabled_experiments); 1390 result->swap(new_enabled_experiments);
1438 } 1391 }
1439 1392
1440 // Returns the Value representing the choice data in the specified experiment. 1393 // Returns the Value representing the choice data in the specified experiment.
1441 Value* CreateChoiceData(const Experiment& experiment, 1394 Value* CreateChoiceData(const Experiment& experiment,
1442 const std::set<std::string>& enabled_experiments) { 1395 const std::set<std::string>& enabled_experiments) {
1443 DCHECK_EQ(Experiment::MULTI_VALUE, experiment.type); 1396 DCHECK(experiment.type == Experiment::MULTI_VALUE ||
1397 experiment.type == Experiment::ENABLE_DISABLE_VALUE);
1444 ListValue* result = new ListValue; 1398 ListValue* result = new ListValue;
1445 for (int i = 0; i < experiment.num_choices; ++i) { 1399 for (int i = 0; i < experiment.num_choices; ++i) {
1446 const Experiment::Choice& choice = experiment.choices[i];
1447 DictionaryValue* value = new DictionaryValue; 1400 DictionaryValue* value = new DictionaryValue;
1448 std::string name = NameForChoice(experiment, i); 1401 const std::string name = experiment.NameForChoice(i);
1449 value->SetString("description",
1450 l10n_util::GetStringUTF16(choice.description_id));
1451 value->SetString("internal_name", name); 1402 value->SetString("internal_name", name);
1403 value->SetString("description", experiment.DescriptionForChoice(i));
1452 value->SetBoolean("selected", enabled_experiments.count(name) > 0); 1404 value->SetBoolean("selected", enabled_experiments.count(name) > 0);
1453 result->Append(value); 1405 result->Append(value);
1454 } 1406 }
1455 return result; 1407 return result;
1456 } 1408 }
1457 1409
1458 } // namespace 1410 } // namespace
1459 1411
1412 std::string Experiment::NameForChoice(int index) const {
1413 DCHECK(type == Experiment::MULTI_VALUE ||
1414 type == Experiment::ENABLE_DISABLE_VALUE);
1415 DCHECK_LT(index, num_choices);
1416 return std::string(internal_name) + testing::kMultiSeparator +
1417 base::IntToString(index);
1418 }
1419
1420 string16 Experiment::DescriptionForChoice(int index) const {
1421 DCHECK(type == Experiment::MULTI_VALUE ||
1422 type == Experiment::ENABLE_DISABLE_VALUE);
1423 DCHECK_LT(index, num_choices);
1424 int description_id;
1425 if (type == Experiment::ENABLE_DISABLE_VALUE) {
1426 const int kEnableDisableDescriptionIds[] = {
1427 IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT,
1428 IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
1429 IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
1430 };
1431 description_id = kEnableDisableDescriptionIds[index];
1432 } else {
1433 description_id = choices[index].description_id;
1434 }
1435 return l10n_util::GetStringUTF16(description_id);
1436 }
1437
1460 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line) { 1438 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line) {
1461 FlagsState::GetInstance()->ConvertFlagsToSwitches(prefs, command_line); 1439 FlagsState::GetInstance()->ConvertFlagsToSwitches(prefs, command_line);
1462 } 1440 }
1463 1441
1464 ListValue* GetFlagsExperimentsData(PrefService* prefs) { 1442 ListValue* GetFlagsExperimentsData(PrefService* prefs) {
1465 std::set<std::string> enabled_experiments; 1443 std::set<std::string> enabled_experiments;
1466 GetSanitizedEnabledFlags(prefs, &enabled_experiments); 1444 GetSanitizedEnabledFlags(prefs, &enabled_experiments);
1467 1445
1468 int current_platform = GetCurrentPlatform(); 1446 int current_platform = GetCurrentPlatform();
1469 1447
(...skipping 15 matching lines...) Expand all
1485 AddOsStrings(experiment.supported_platforms, supported_platforms); 1463 AddOsStrings(experiment.supported_platforms, supported_platforms);
1486 data->Set("supported_platforms", supported_platforms); 1464 data->Set("supported_platforms", supported_platforms);
1487 1465
1488 switch (experiment.type) { 1466 switch (experiment.type) {
1489 case Experiment::SINGLE_VALUE: 1467 case Experiment::SINGLE_VALUE:
1490 data->SetBoolean( 1468 data->SetBoolean(
1491 "enabled", 1469 "enabled",
1492 enabled_experiments.count(experiment.internal_name) > 0); 1470 enabled_experiments.count(experiment.internal_name) > 0);
1493 break; 1471 break;
1494 case Experiment::MULTI_VALUE: 1472 case Experiment::MULTI_VALUE:
1473 case Experiment::ENABLE_DISABLE_VALUE:
1495 data->Set("choices", CreateChoiceData(experiment, enabled_experiments)); 1474 data->Set("choices", CreateChoiceData(experiment, enabled_experiments));
1496 break; 1475 break;
1497 default: 1476 default:
1498 NOTREACHED(); 1477 NOTREACHED();
1499 } 1478 }
1500 1479
1501 experiments_data->Append(data); 1480 experiments_data->Append(data);
1502 } 1481 }
1503 return experiments_data; 1482 return experiments_data;
1504 } 1483 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 if (flags.size()) 1530 if (flags.size())
1552 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick")); 1531 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick"));
1553 content::RecordAction(UserMetricsAction("StartupTick")); 1532 content::RecordAction(UserMetricsAction("StartupTick"));
1554 } 1533 }
1555 1534
1556 ////////////////////////////////////////////////////////////////////////////// 1535 //////////////////////////////////////////////////////////////////////////////
1557 // FlagsState implementation. 1536 // FlagsState implementation.
1558 1537
1559 namespace { 1538 namespace {
1560 1539
1540 typedef std::map<std::string, std::pair<std::string, std::string> >
1541 NameToSwitchAndValueMap;
1542
1543 void SetFlagToSwitchMapping(const std::string& key,
1544 const std::string& switch_name,
1545 const std::string& switch_value,
1546 NameToSwitchAndValueMap* name_to_switch_map) {
1547 DCHECK(name_to_switch_map->end() == name_to_switch_map->find(key));
1548 (*name_to_switch_map)[key] = std::make_pair(switch_name, switch_value);
1549 }
1550
1561 void FlagsState::ConvertFlagsToSwitches( 1551 void FlagsState::ConvertFlagsToSwitches(
1562 PrefService* prefs, CommandLine* command_line) { 1552 PrefService* prefs, CommandLine* command_line) {
1563 if (command_line->HasSwitch(switches::kNoExperiments)) 1553 if (command_line->HasSwitch(switches::kNoExperiments))
1564 return; 1554 return;
1565 1555
1566 std::set<std::string> enabled_experiments; 1556 std::set<std::string> enabled_experiments;
1567 1557
1568 GetSanitizedEnabledFlagsForCurrentPlatform(prefs, &enabled_experiments); 1558 GetSanitizedEnabledFlagsForCurrentPlatform(prefs, &enabled_experiments);
1569 1559
1570 typedef std::map<std::string, std::pair<std::string, std::string> >
1571 NameToSwitchAndValueMap;
1572 NameToSwitchAndValueMap name_to_switch_map; 1560 NameToSwitchAndValueMap name_to_switch_map;
1573 for (size_t i = 0; i < num_experiments; ++i) { 1561 for (size_t i = 0; i < num_experiments; ++i) {
1574 const Experiment& e = experiments[i]; 1562 const Experiment& e = experiments[i];
1575 if (e.type == Experiment::SINGLE_VALUE) { 1563 if (e.type == Experiment::SINGLE_VALUE) {
1576 name_to_switch_map[e.internal_name] = 1564 SetFlagToSwitchMapping(e.internal_name, e.command_line_switch,
1577 std::pair<std::string, std::string>(e.command_line_switch, 1565 e.command_line_value, &name_to_switch_map);
1578 e.command_line_value); 1566 } else if (e.type == Experiment::MULTI_VALUE) {
1567 for (int j = 0; j < e.num_choices; ++j) {
1568 SetFlagToSwitchMapping(e.NameForChoice(j),
1569 e.choices[j].command_line_switch,
1570 e.choices[j].command_line_value,
1571 &name_to_switch_map);
1572 }
1579 } else { 1573 } else {
1580 for (int j = 0; j < e.num_choices; ++j) 1574 DCHECK_EQ(e.type, Experiment::ENABLE_DISABLE_VALUE);
1581 name_to_switch_map[NameForChoice(e, j)] = 1575 SetFlagToSwitchMapping(e.NameForChoice(0), std::string(), std::string(),
1582 std::pair<std::string, std::string>( 1576 &name_to_switch_map);
1583 e.choices[j].command_line_switch, 1577 SetFlagToSwitchMapping(e.NameForChoice(1), e.command_line_switch,
1584 e.choices[j].command_line_value); 1578 e.command_line_value, &name_to_switch_map);
1579 SetFlagToSwitchMapping(e.NameForChoice(2), e.disable_command_line_switch,
1580 e.disable_command_line_value, &name_to_switch_map);
1585 } 1581 }
1586 } 1582 }
1587 1583
1588 command_line->AppendSwitch(switches::kFlagSwitchesBegin); 1584 command_line->AppendSwitch(switches::kFlagSwitchesBegin);
1589 flags_switches_.insert( 1585 flags_switches_.insert(
1590 std::pair<std::string, std::string>(switches::kFlagSwitchesBegin, 1586 std::pair<std::string, std::string>(switches::kFlagSwitchesBegin,
1591 std::string())); 1587 std::string()));
1592 for (std::set<std::string>::iterator it = enabled_experiments.begin(); 1588 for (std::set<std::string>::iterator it = enabled_experiments.begin();
1593 it != enabled_experiments.end(); 1589 it != enabled_experiments.end();
1594 ++it) { 1590 ++it) {
(...skipping 19 matching lines...) Expand all
1614 } 1610 }
1615 1611
1616 bool FlagsState::IsRestartNeededToCommitChanges() { 1612 bool FlagsState::IsRestartNeededToCommitChanges() {
1617 return needs_restart_; 1613 return needs_restart_;
1618 } 1614 }
1619 1615
1620 void FlagsState::SetExperimentEnabled( 1616 void FlagsState::SetExperimentEnabled(
1621 PrefService* prefs, const std::string& internal_name, bool enable) { 1617 PrefService* prefs, const std::string& internal_name, bool enable) {
1622 needs_restart_ = true; 1618 needs_restart_ = true;
1623 1619
1624 size_t at_index = internal_name.find(about_flags::testing::kMultiSeparator); 1620 size_t at_index = internal_name.find(testing::kMultiSeparator);
1625 if (at_index != std::string::npos) { 1621 if (at_index != std::string::npos) {
1626 DCHECK(enable); 1622 DCHECK(enable);
1627 // We're being asked to enable a multi-choice experiment. Disable the 1623 // We're being asked to enable a multi-choice experiment. Disable the
1628 // currently selected choice. 1624 // currently selected choice.
1629 DCHECK_NE(at_index, 0u); 1625 DCHECK_NE(at_index, 0u);
1630 const std::string experiment_name = internal_name.substr(0, at_index); 1626 const std::string experiment_name = internal_name.substr(0, at_index);
1631 SetExperimentEnabled(prefs, experiment_name, false); 1627 SetExperimentEnabled(prefs, experiment_name, false);
1632 1628
1633 // And enable the new choice, if it is not the default first choice. 1629 // And enable the new choice, if it is not the default first choice.
1634 if (internal_name != experiment_name + "@0") { 1630 if (internal_name != experiment_name + "@0") {
(...skipping 18 matching lines...) Expand all
1653 DCHECK(e); 1649 DCHECK(e);
1654 1650
1655 if (e->type == Experiment::SINGLE_VALUE) { 1651 if (e->type == Experiment::SINGLE_VALUE) {
1656 if (enable) 1652 if (enable)
1657 enabled_experiments.insert(internal_name); 1653 enabled_experiments.insert(internal_name);
1658 else 1654 else
1659 enabled_experiments.erase(internal_name); 1655 enabled_experiments.erase(internal_name);
1660 } else { 1656 } else {
1661 if (enable) { 1657 if (enable) {
1662 // Enable the first choice. 1658 // Enable the first choice.
1663 enabled_experiments.insert(NameForChoice(*e, 0)); 1659 enabled_experiments.insert(e->NameForChoice(0));
1664 } else { 1660 } else {
1665 // Find the currently enabled choice and disable it. 1661 // Find the currently enabled choice and disable it.
1666 for (int i = 0; i < e->num_choices; ++i) { 1662 for (int i = 0; i < e->num_choices; ++i) {
1667 std::string choice_name = NameForChoice(*e, i); 1663 std::string choice_name = e->NameForChoice(i);
1668 if (enabled_experiments.find(choice_name) != 1664 if (enabled_experiments.find(choice_name) !=
1669 enabled_experiments.end()) { 1665 enabled_experiments.end()) {
1670 enabled_experiments.erase(choice_name); 1666 enabled_experiments.erase(choice_name);
1671 // Continue on just in case there's a bug and more than one 1667 // Continue on just in case there's a bug and more than one
1672 // experiment for this choice was enabled. 1668 // experiment for this choice was enabled.
1673 } 1669 }
1674 } 1670 }
1675 } 1671 }
1676 } 1672 }
1677 1673
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 } 1717 }
1722 1718
1723 const Experiment* GetExperiments(size_t* count) { 1719 const Experiment* GetExperiments(size_t* count) {
1724 *count = num_experiments; 1720 *count = num_experiments;
1725 return experiments; 1721 return experiments;
1726 } 1722 }
1727 1723
1728 } // namespace testing 1724 } // namespace testing
1729 1725
1730 } // namespace about_flags 1726 } // namespace about_flags
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.h ('k') | chrome/browser/about_flags_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698