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

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

Issue 1407753002: Clean up terminology used in about_flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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 <iterator> 7 #include <iterator>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "ui/base/l10n/l10n_util.h" 48 #include "ui/base/l10n/l10n_util.h"
49 #include "ui/base/ui_base_switches.h" 49 #include "ui/base/ui_base_switches.h"
50 #include "ui/display/display_switches.h" 50 #include "ui/display/display_switches.h"
51 #include "ui/events/event_switches.h" 51 #include "ui/events/event_switches.h"
52 #include "ui/gfx/switches.h" 52 #include "ui/gfx/switches.h"
53 #include "ui/gl/gl_switches.h" 53 #include "ui/gl/gl_switches.h"
54 #include "ui/keyboard/keyboard_switches.h" 54 #include "ui/keyboard/keyboard_switches.h"
55 #include "ui/native_theme/native_theme_switches.h" 55 #include "ui/native_theme/native_theme_switches.h"
56 #include "ui/views/views_switches.h" 56 #include "ui/views/views_switches.h"
57 57
58 #if defined(OS_ANDROID) 58 #if !defined(OS_ANDROID)
59 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc hes.h"
60 #else
61 #include "ui/message_center/message_center_switches.h" 59 #include "ui/message_center/message_center_switches.h"
62 #endif 60 #endif
63 61
64 #if defined(USE_ASH) 62 #if defined(USE_ASH)
65 #include "ash/ash_switches.h" 63 #include "ash/ash_switches.h"
66 #endif 64 #endif
67 65
68 #if defined(OS_CHROMEOS) 66 #if defined(OS_CHROMEOS)
69 #include "chromeos/chromeos_switches.h" 67 #include "chromeos/chromeos_switches.h"
70 #include "third_party/cros_system_api/switches/chrome_switches.h" 68 #include "third_party/cros_system_api/switches/chrome_switches.h"
71 #endif 69 #endif
72 70
73 #if defined(ENABLE_APP_LIST) 71 #if defined(ENABLE_APP_LIST)
74 #include "ui/app_list/app_list_switches.h" 72 #include "ui/app_list/app_list_switches.h"
75 #endif 73 #endif
76 74
77 #if defined(ENABLE_EXTENSIONS) 75 #if defined(ENABLE_EXTENSIONS)
78 #include "extensions/common/switches.h" 76 #include "extensions/common/switches.h"
79 #endif 77 #endif
80 78
81 #if defined(USE_OZONE) 79 #if defined(USE_OZONE)
82 #include "ui/ozone/public/ozone_switches.h" 80 #include "ui/ozone/public/ozone_switches.h"
83 #endif 81 #endif
84 82
85 namespace about_flags { 83 namespace about_flags {
86 84
87 // Macros to simplify specifying the type. 85 // Macros to simplify specifying the type.
88 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ 86 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
89 Experiment::SINGLE_VALUE, \ 87 FeatureEntry::SINGLE_VALUE, \
90 command_line_switch, switch_value, NULL, NULL, NULL, 0 88 command_line_switch, switch_value, NULL, NULL, NULL, 0
91 #define SINGLE_VALUE_TYPE(command_line_switch) \ 89 #define SINGLE_VALUE_TYPE(command_line_switch) \
92 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") 90 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "")
93 #define SINGLE_DISABLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ 91 #define SINGLE_DISABLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
94 Experiment::SINGLE_DISABLE_VALUE, \ 92 FeatureEntry::SINGLE_DISABLE_VALUE, \
95 command_line_switch, switch_value, NULL, NULL, NULL, 0 93 command_line_switch, switch_value, NULL, NULL, NULL, 0
96 #define SINGLE_DISABLE_VALUE_TYPE(command_line_switch) \ 94 #define SINGLE_DISABLE_VALUE_TYPE(command_line_switch) \
97 SINGLE_DISABLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") 95 SINGLE_DISABLE_VALUE_TYPE_AND_VALUE(command_line_switch, "")
98 #define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \ 96 #define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \
99 disable_switch, disable_value) \ 97 disable_switch, disable_value) \
100 Experiment::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \ 98 FeatureEntry::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \
101 disable_switch, disable_value, NULL, 3 99 disable_switch, disable_value, NULL, 3
102 #define ENABLE_DISABLE_VALUE_TYPE(enable_switch, disable_switch) \ 100 #define ENABLE_DISABLE_VALUE_TYPE(enable_switch, disable_switch) \
103 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, "", disable_switch, "") 101 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, "", disable_switch, "")
104 #define MULTI_VALUE_TYPE(choices) \ 102 #define MULTI_VALUE_TYPE(choices) \
105 Experiment::MULTI_VALUE, NULL, NULL, NULL, NULL, choices, arraysize(choices) 103 FeatureEntry::MULTI_VALUE, NULL, NULL, NULL, NULL, choices, \
104 arraysize(choices)
106 105
107 namespace { 106 namespace {
108 107
109 // Enumeration of OSs. 108 // Enumeration of OSs.
110 enum { 109 enum {
111 kOsMac = 1 << 0, 110 kOsMac = 1 << 0,
112 kOsWin = 1 << 1, 111 kOsWin = 1 << 1,
113 kOsLinux = 1 << 2, 112 kOsLinux = 1 << 2,
114 kOsCrOS = 1 << 3, 113 kOsCrOS = 1 << 3,
115 kOsAndroid = 1 << 4, 114 kOsAndroid = 1 << 4,
116 kOsCrOSOwnerOnly = 1 << 5 115 kOsCrOSOwnerOnly = 1 << 5
117 }; 116 };
118 117
119 const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS | kOsAndroid; 118 const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS | kOsAndroid;
120 const unsigned kOsDesktop = kOsMac | kOsWin | kOsLinux | kOsCrOS; 119 const unsigned kOsDesktop = kOsMac | kOsWin | kOsLinux | kOsCrOS;
121 120
122 // Adds a |StringValue| to |list| for each platform where |bitmask| indicates 121 // Adds a |StringValue| to |list| for each platform where |bitmask| indicates
123 // whether the experiment is available on that platform. 122 // whether the entry is available on that platform.
124 void AddOsStrings(unsigned bitmask, base::ListValue* list) { 123 void AddOsStrings(unsigned bitmask, base::ListValue* list) {
125 struct { 124 struct {
126 unsigned bit; 125 unsigned bit;
127 const char* const name; 126 const char* const name;
128 } kBitsToOs[] = { 127 } kBitsToOs[] = {
129 {kOsMac, "Mac"}, 128 {kOsMac, "Mac"},
130 {kOsWin, "Windows"}, 129 {kOsWin, "Windows"},
131 {kOsLinux, "Linux"}, 130 {kOsLinux, "Linux"},
132 {kOsCrOS, "Chrome OS"}, 131 {kOsCrOS, "Chrome OS"},
133 {kOsAndroid, "Android"}, 132 {kOsAndroid, "Android"},
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 first = std::find(cmdline.argv().begin(), cmdline.argv().end(), 164 first = std::find(cmdline.argv().begin(), cmdline.argv().end(),
166 GetSwitchString(chromeos::switches::kPolicySwitchesBegin)); 165 GetSwitchString(chromeos::switches::kPolicySwitchesBegin));
167 last = std::find(cmdline.argv().begin(), cmdline.argv().end(), 166 last = std::find(cmdline.argv().begin(), cmdline.argv().end(),
168 GetSwitchString(chromeos::switches::kPolicySwitchesEnd)); 167 GetSwitchString(chromeos::switches::kPolicySwitchesEnd));
169 if (first != cmdline.argv().end() && last != cmdline.argv().end()) 168 if (first != cmdline.argv().end() && last != cmdline.argv().end())
170 flags.insert(first + 1, last); 169 flags.insert(first + 1, last);
171 #endif 170 #endif
172 return flags; 171 return flags;
173 } 172 }
174 173
175 const Experiment::Choice kTouchEventsChoices[] = { 174 const FeatureEntry::Choice kTouchEventsChoices[] = {
176 { IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC, "", "" }, 175 { IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC, "", "" },
177 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 176 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
178 switches::kTouchEvents, 177 switches::kTouchEvents,
179 switches::kTouchEventsEnabled }, 178 switches::kTouchEventsEnabled },
180 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 179 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
181 switches::kTouchEvents, 180 switches::kTouchEvents,
182 switches::kTouchEventsDisabled } 181 switches::kTouchEventsDisabled }
183 }; 182 };
184 183
185 #if defined(USE_AURA) 184 #if defined(USE_AURA)
186 const Experiment::Choice kOverscrollHistoryNavigationChoices[] = { 185 const FeatureEntry::Choice kOverscrollHistoryNavigationChoices[] = {
187 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, "", "" }, 186 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, "", "" },
188 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 187 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
189 switches::kOverscrollHistoryNavigation, 188 switches::kOverscrollHistoryNavigation,
190 "0" }, 189 "0" },
191 { IDS_OVERSCROLL_HISTORY_NAVIGATION_SIMPLE_UI, 190 { IDS_OVERSCROLL_HISTORY_NAVIGATION_SIMPLE_UI,
192 switches::kOverscrollHistoryNavigation, 191 switches::kOverscrollHistoryNavigation,
193 "2" } 192 "2" }
194 }; 193 };
195 #endif 194 #endif
196 195
197 const Experiment::Choice kTouchTextSelectionStrategyChoices[] = { 196 const FeatureEntry::Choice kTouchTextSelectionStrategyChoices[] = {
198 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 197 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
199 { IDS_TOUCH_SELECTION_STRATEGY_CHARACTER, 198 { IDS_TOUCH_SELECTION_STRATEGY_CHARACTER,
200 switches::kTouchTextSelectionStrategy, 199 switches::kTouchTextSelectionStrategy,
201 "character" }, 200 "character" },
202 { IDS_TOUCH_SELECTION_STRATEGY_DIRECTION, 201 { IDS_TOUCH_SELECTION_STRATEGY_DIRECTION,
203 switches::kTouchTextSelectionStrategy, 202 switches::kTouchTextSelectionStrategy,
204 "direction" } 203 "direction" }
205 }; 204 };
206 205
207 const Experiment::Choice kTraceUploadURL[] = { 206 const FeatureEntry::Choice kTraceUploadURL[] = {
208 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, "", "" }, 207 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, "", "" },
209 { IDS_TRACE_UPLOAD_URL_CHOICE_OTHER, switches::kTraceUploadURL, 208 { IDS_TRACE_UPLOAD_URL_CHOICE_OTHER, switches::kTraceUploadURL,
210 "https://performance-insights.appspot.com/upload?tags=flags,Other"}, 209 "https://performance-insights.appspot.com/upload?tags=flags,Other"},
211 { IDS_TRACE_UPLOAD_URL_CHOICE_EMLOADING, switches::kTraceUploadURL, 210 { IDS_TRACE_UPLOAD_URL_CHOICE_EMLOADING, switches::kTraceUploadURL,
212 "https://performance-insights.appspot.com/upload?tags=flags,emloading" }, 211 "https://performance-insights.appspot.com/upload?tags=flags,emloading" },
213 { IDS_TRACE_UPLOAD_URL_CHOICE_QA, switches::kTraceUploadURL, 212 { IDS_TRACE_UPLOAD_URL_CHOICE_QA, switches::kTraceUploadURL,
214 "https://performance-insights.appspot.com/upload?tags=flags,QA" }, 213 "https://performance-insights.appspot.com/upload?tags=flags,QA" },
215 { IDS_TRACE_UPLOAD_URL_CHOICE_TESTING, switches::kTraceUploadURL, 214 { IDS_TRACE_UPLOAD_URL_CHOICE_TESTING, switches::kTraceUploadURL,
216 "https://performance-insights.appspot.com/upload?tags=flags,TestingTeam" } 215 "https://performance-insights.appspot.com/upload?tags=flags,TestingTeam" }
217 }; 216 };
218 217
219 #if !defined(DISABLE_NACL) 218 #if !defined(DISABLE_NACL)
220 const Experiment::Choice kNaClDebugMaskChoices[] = { 219 const FeatureEntry::Choice kNaClDebugMaskChoices[] = {
221 // Secure shell can be used on ChromeOS for forwarding the TCP port opened by 220 // Secure shell can be used on ChromeOS for forwarding the TCP port opened by
222 // debug stub to a remote machine. Since secure shell uses NaCl, we usually 221 // debug stub to a remote machine. Since secure shell uses NaCl, we usually
223 // want to avoid debugging that. The PNaCl translator is also a NaCl module, 222 // want to avoid debugging that. The PNaCl translator is also a NaCl module,
224 // so by default we want to avoid debugging that. 223 // so by default we want to avoid debugging that.
225 // NOTE: As the default value must be the empty string, the mask excluding 224 // NOTE: As the default value must be the empty string, the mask excluding
226 // the PNaCl translator and secure shell is substituted elsewhere. 225 // the PNaCl translator and secure shell is substituted elsewhere.
227 { IDS_NACL_DEBUG_MASK_CHOICE_EXCLUDE_UTILS_PNACL, "", "" }, 226 { IDS_NACL_DEBUG_MASK_CHOICE_EXCLUDE_UTILS_PNACL, "", "" },
228 { IDS_NACL_DEBUG_MASK_CHOICE_DEBUG_ALL, switches::kNaClDebugMask, "*://*" }, 227 { IDS_NACL_DEBUG_MASK_CHOICE_DEBUG_ALL, switches::kNaClDebugMask, "*://*" },
229 { IDS_NACL_DEBUG_MASK_CHOICE_INCLUDE_DEBUG, 228 { IDS_NACL_DEBUG_MASK_CHOICE_INCLUDE_DEBUG,
230 switches::kNaClDebugMask, "*://*/*debug.nmf" } 229 switches::kNaClDebugMask, "*://*/*debug.nmf" }
231 }; 230 };
232 #endif 231 #endif
233 232
234 const Experiment::Choice kMarkNonSecureAsChoices[] = { 233 const FeatureEntry::Choice kMarkNonSecureAsChoices[] = {
235 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 234 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
236 { IDS_MARK_NON_SECURE_AS_NEUTRAL, 235 { IDS_MARK_NON_SECURE_AS_NEUTRAL,
237 switches::kMarkNonSecureAs, switches::kMarkNonSecureAsNeutral}, 236 switches::kMarkNonSecureAs, switches::kMarkNonSecureAsNeutral},
238 { IDS_MARK_NON_SECURE_AS_NON_SECURE, 237 { IDS_MARK_NON_SECURE_AS_NON_SECURE,
239 switches::kMarkNonSecureAs, switches::kMarkNonSecureAsNonSecure} 238 switches::kMarkNonSecureAs, switches::kMarkNonSecureAsNonSecure}
240 }; 239 };
241 240
242 const Experiment::Choice kDataReductionProxyLoFiChoices[] = { 241 const FeatureEntry::Choice kDataReductionProxyLoFiChoices[] = {
243 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 242 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
244 { IDS_FLAGS_DATA_REDUCTION_PROXY_LO_FI_ALWAYS_ON, 243 { IDS_FLAGS_DATA_REDUCTION_PROXY_LO_FI_ALWAYS_ON,
245 data_reduction_proxy::switches::kDataReductionProxyLoFi, 244 data_reduction_proxy::switches::kDataReductionProxyLoFi,
246 data_reduction_proxy::switches::kDataReductionProxyLoFiValueAlwaysOn}, 245 data_reduction_proxy::switches::kDataReductionProxyLoFiValueAlwaysOn},
247 { IDS_FLAGS_DATA_REDUCTION_PROXY_LO_FI_CELLULAR_ONLY, 246 { IDS_FLAGS_DATA_REDUCTION_PROXY_LO_FI_CELLULAR_ONLY,
248 data_reduction_proxy::switches::kDataReductionProxyLoFi, 247 data_reduction_proxy::switches::kDataReductionProxyLoFi,
249 data_reduction_proxy::switches:: 248 data_reduction_proxy::switches::
250 kDataReductionProxyLoFiValueCellularOnly}, 249 kDataReductionProxyLoFiValueCellularOnly},
251 { IDS_FLAGS_DATA_REDUCTION_PROXY_LO_FI_DISABLED, 250 { IDS_FLAGS_DATA_REDUCTION_PROXY_LO_FI_DISABLED,
252 data_reduction_proxy::switches::kDataReductionProxyLoFi, 251 data_reduction_proxy::switches::kDataReductionProxyLoFi,
253 data_reduction_proxy::switches::kDataReductionProxyLoFiValueDisabled}, 252 data_reduction_proxy::switches::kDataReductionProxyLoFiValueDisabled},
254 { IDS_FLAGS_DATA_REDUCTION_PROXY_LO_FI_SLOW_CONNECTIONS_ONLY, 253 { IDS_FLAGS_DATA_REDUCTION_PROXY_LO_FI_SLOW_CONNECTIONS_ONLY,
255 data_reduction_proxy::switches::kDataReductionProxyLoFi, 254 data_reduction_proxy::switches::kDataReductionProxyLoFi,
256 data_reduction_proxy::switches:: 255 data_reduction_proxy::switches::
257 kDataReductionProxyLoFiValueSlowConnectionsOnly} 256 kDataReductionProxyLoFiValueSlowConnectionsOnly}
258 }; 257 };
259 258
260 const Experiment::Choice kShowSavedCopyChoices[] = { 259 const FeatureEntry::Choice kShowSavedCopyChoices[] = {
261 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 260 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
262 { IDS_FLAGS_ENABLE_SHOW_SAVED_COPY_PRIMARY, 261 { IDS_FLAGS_ENABLE_SHOW_SAVED_COPY_PRIMARY,
263 switches::kShowSavedCopy, switches::kEnableShowSavedCopyPrimary }, 262 switches::kShowSavedCopy, switches::kEnableShowSavedCopyPrimary },
264 { IDS_FLAGS_ENABLE_SHOW_SAVED_COPY_SECONDARY, 263 { IDS_FLAGS_ENABLE_SHOW_SAVED_COPY_SECONDARY,
265 switches::kShowSavedCopy, switches::kEnableShowSavedCopySecondary }, 264 switches::kShowSavedCopy, switches::kEnableShowSavedCopySecondary },
266 { IDS_FLAGS_DISABLE_SHOW_SAVED_COPY, 265 { IDS_FLAGS_DISABLE_SHOW_SAVED_COPY,
267 switches::kShowSavedCopy, switches::kDisableShowSavedCopy } 266 switches::kShowSavedCopy, switches::kDisableShowSavedCopy }
268 }; 267 };
269 268
270 const Experiment::Choice kDefaultTileWidthChoices[] = { 269 const FeatureEntry::Choice kDefaultTileWidthChoices[] = {
271 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 270 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
272 { IDS_FLAGS_DEFAULT_TILE_WIDTH_SHORT, 271 { IDS_FLAGS_DEFAULT_TILE_WIDTH_SHORT,
273 switches::kDefaultTileWidth, "128"}, 272 switches::kDefaultTileWidth, "128"},
274 { IDS_FLAGS_DEFAULT_TILE_WIDTH_TALL, 273 { IDS_FLAGS_DEFAULT_TILE_WIDTH_TALL,
275 switches::kDefaultTileWidth, "256"}, 274 switches::kDefaultTileWidth, "256"},
276 { IDS_FLAGS_DEFAULT_TILE_WIDTH_GRANDE, 275 { IDS_FLAGS_DEFAULT_TILE_WIDTH_GRANDE,
277 switches::kDefaultTileWidth, "512"}, 276 switches::kDefaultTileWidth, "512"},
278 { IDS_FLAGS_DEFAULT_TILE_WIDTH_VENTI, 277 { IDS_FLAGS_DEFAULT_TILE_WIDTH_VENTI,
279 switches::kDefaultTileWidth, "1024"} 278 switches::kDefaultTileWidth, "1024"}
280 }; 279 };
281 280
282 const Experiment::Choice kDefaultTileHeightChoices[] = { 281 const FeatureEntry::Choice kDefaultTileHeightChoices[] = {
283 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 282 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
284 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_SHORT, 283 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_SHORT,
285 switches::kDefaultTileHeight, "128"}, 284 switches::kDefaultTileHeight, "128"},
286 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_TALL, 285 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_TALL,
287 switches::kDefaultTileHeight, "256"}, 286 switches::kDefaultTileHeight, "256"},
288 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_GRANDE, 287 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_GRANDE,
289 switches::kDefaultTileHeight, "512"}, 288 switches::kDefaultTileHeight, "512"},
290 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_VENTI, 289 { IDS_FLAGS_DEFAULT_TILE_HEIGHT_VENTI,
291 switches::kDefaultTileHeight, "1024"} 290 switches::kDefaultTileHeight, "1024"}
292 }; 291 };
293 292
294 const Experiment::Choice kSimpleCacheBackendChoices[] = { 293 const FeatureEntry::Choice kSimpleCacheBackendChoices[] = {
295 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 294 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
296 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 295 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
297 switches::kUseSimpleCacheBackend, "off" }, 296 switches::kUseSimpleCacheBackend, "off" },
298 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 297 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
299 switches::kUseSimpleCacheBackend, "on"} 298 switches::kUseSimpleCacheBackend, "on"}
300 }; 299 };
301 300
302 #if defined(USE_AURA) 301 #if defined(USE_AURA)
303 const Experiment::Choice kTabCaptureUpscaleQualityChoices[] = { 302 const FeatureEntry::Choice kTabCaptureUpscaleQualityChoices[] = {
304 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 303 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
305 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_FAST, 304 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_FAST,
306 switches::kTabCaptureUpscaleQuality, "fast" }, 305 switches::kTabCaptureUpscaleQuality, "fast" },
307 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_GOOD, 306 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_GOOD,
308 switches::kTabCaptureUpscaleQuality, "good" }, 307 switches::kTabCaptureUpscaleQuality, "good" },
309 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_BEST, 308 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_BEST,
310 switches::kTabCaptureUpscaleQuality, "best" }, 309 switches::kTabCaptureUpscaleQuality, "best" },
311 }; 310 };
312 311
313 const Experiment::Choice kTabCaptureDownscaleQualityChoices[] = { 312 const FeatureEntry::Choice kTabCaptureDownscaleQualityChoices[] = {
314 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 313 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
315 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_FAST, 314 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_FAST,
316 switches::kTabCaptureDownscaleQuality, "fast" }, 315 switches::kTabCaptureDownscaleQuality, "fast" },
317 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_GOOD, 316 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_GOOD,
318 switches::kTabCaptureDownscaleQuality, "good" }, 317 switches::kTabCaptureDownscaleQuality, "good" },
319 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_BEST, 318 { IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_BEST,
320 switches::kTabCaptureDownscaleQuality, "best" }, 319 switches::kTabCaptureDownscaleQuality, "best" },
321 }; 320 };
322 #endif 321 #endif
323 322
324 #if defined(OS_ANDROID) 323 #if defined(OS_ANDROID)
325 const Experiment::Choice kReaderModeHeuristicsChoices[] = { 324 const FeatureEntry::Choice kReaderModeHeuristicsChoices[] = {
326 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, 325 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""},
327 { IDS_FLAGS_READER_MODE_HEURISTICS_MARKUP, 326 { IDS_FLAGS_READER_MODE_HEURISTICS_MARKUP,
328 switches::kReaderModeHeuristics, 327 switches::kReaderModeHeuristics,
329 switches::reader_mode_heuristics::kOGArticle }, 328 switches::reader_mode_heuristics::kOGArticle },
330 { IDS_FLAGS_READER_MODE_HEURISTICS_ADABOOST, 329 { IDS_FLAGS_READER_MODE_HEURISTICS_ADABOOST,
331 switches::kReaderModeHeuristics, 330 switches::kReaderModeHeuristics,
332 switches::reader_mode_heuristics::kAdaBoost }, 331 switches::reader_mode_heuristics::kAdaBoost },
333 { IDS_FLAGS_READER_MODE_HEURISTICS_ALWAYS_ON, 332 { IDS_FLAGS_READER_MODE_HEURISTICS_ALWAYS_ON,
334 switches::kReaderModeHeuristics, 333 switches::kReaderModeHeuristics,
335 switches::reader_mode_heuristics::kAlwaysTrue }, 334 switches::reader_mode_heuristics::kAlwaysTrue },
336 { IDS_FLAGS_READER_MODE_HEURISTICS_ALWAYS_OFF, 335 { IDS_FLAGS_READER_MODE_HEURISTICS_ALWAYS_OFF,
337 switches::kReaderModeHeuristics, 336 switches::kReaderModeHeuristics,
338 switches::reader_mode_heuristics::kNone }, 337 switches::reader_mode_heuristics::kNone },
339 }; 338 };
340 #endif 339 #endif
341 340
342 const Experiment::Choice kNumRasterThreadsChoices[] = { 341 const FeatureEntry::Choice kNumRasterThreadsChoices[] = {
343 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 342 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
344 { IDS_FLAGS_NUM_RASTER_THREADS_ONE, switches::kNumRasterThreads, "1" }, 343 { IDS_FLAGS_NUM_RASTER_THREADS_ONE, switches::kNumRasterThreads, "1" },
345 { IDS_FLAGS_NUM_RASTER_THREADS_TWO, switches::kNumRasterThreads, "2" }, 344 { IDS_FLAGS_NUM_RASTER_THREADS_TWO, switches::kNumRasterThreads, "2" },
346 { IDS_FLAGS_NUM_RASTER_THREADS_THREE, switches::kNumRasterThreads, "3" }, 345 { IDS_FLAGS_NUM_RASTER_THREADS_THREE, switches::kNumRasterThreads, "3" },
347 { IDS_FLAGS_NUM_RASTER_THREADS_FOUR, switches::kNumRasterThreads, "4" } 346 { IDS_FLAGS_NUM_RASTER_THREADS_FOUR, switches::kNumRasterThreads, "4" }
348 }; 347 };
349 348
350 const Experiment::Choice kGpuRasterizationMSAASampleCountChoices[] = { 349 const FeatureEntry::Choice kGpuRasterizationMSAASampleCountChoices[] = {
351 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, 350 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT,
352 "", 351 "",
353 "" }, 352 "" },
354 { IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_ZERO, 353 { IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_ZERO,
355 switches::kGpuRasterizationMSAASampleCount, "0" }, 354 switches::kGpuRasterizationMSAASampleCount, "0" },
356 { IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_TWO, 355 { IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_TWO,
357 switches::kGpuRasterizationMSAASampleCount, "2" }, 356 switches::kGpuRasterizationMSAASampleCount, "2" },
358 { IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_FOUR, 357 { IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_FOUR,
359 switches::kGpuRasterizationMSAASampleCount, "4" }, 358 switches::kGpuRasterizationMSAASampleCount, "4" },
360 { IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_EIGHT, 359 { IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_EIGHT,
361 switches::kGpuRasterizationMSAASampleCount, "8" }, 360 switches::kGpuRasterizationMSAASampleCount, "8" },
362 { IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_SIXTEEN, 361 { IDS_FLAGS_GPU_RASTERIZATION_MSAA_SAMPLE_COUNT_SIXTEEN,
363 switches::kGpuRasterizationMSAASampleCount, "16" }, 362 switches::kGpuRasterizationMSAASampleCount, "16" },
364 }; 363 };
365 364
366 const Experiment::Choice kEnableGpuRasterizationChoices[] = { 365 const FeatureEntry::Choice kEnableGpuRasterizationChoices[] = {
367 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 366 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
368 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 367 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
369 switches::kEnableGpuRasterization, "" }, 368 switches::kEnableGpuRasterization, "" },
370 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 369 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
371 switches::kDisableGpuRasterization, "" }, 370 switches::kDisableGpuRasterization, "" },
372 { IDS_FLAGS_FORCE_GPU_RASTERIZATION, 371 { IDS_FLAGS_FORCE_GPU_RASTERIZATION,
373 switches::kForceGpuRasterization, "" }, 372 switches::kForceGpuRasterization, "" },
374 }; 373 };
375 374
376 #if defined(OS_CHROMEOS) 375 #if defined(OS_CHROMEOS)
377 const Experiment::Choice kMemoryPressureThresholdChoices[] = { 376 const FeatureEntry::Choice kMemoryPressureThresholdChoices[] = {
378 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 377 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
379 { IDS_FLAGS_CONSERVATIVE_THRESHOLDS, 378 { IDS_FLAGS_CONSERVATIVE_THRESHOLDS,
380 chromeos::switches::kMemoryPressureThresholds, 379 chromeos::switches::kMemoryPressureThresholds,
381 chromeos::switches::kConservativeThreshold }, 380 chromeos::switches::kConservativeThreshold },
382 { IDS_FLAGS_AGGRESSIVE_CACHE_DISCARD_THRESHOLDS, 381 { IDS_FLAGS_AGGRESSIVE_CACHE_DISCARD_THRESHOLDS,
383 chromeos::switches::kMemoryPressureThresholds, 382 chromeos::switches::kMemoryPressureThresholds,
384 chromeos::switches::kAggressiveCacheDiscardThreshold }, 383 chromeos::switches::kAggressiveCacheDiscardThreshold },
385 { IDS_FLAGS_AGGRESSIVE_TAB_DISCARD_THRESHOLDS, 384 { IDS_FLAGS_AGGRESSIVE_TAB_DISCARD_THRESHOLDS,
386 chromeos::switches::kMemoryPressureThresholds, 385 chromeos::switches::kMemoryPressureThresholds,
387 chromeos::switches::kAggressiveTabDiscardThreshold }, 386 chromeos::switches::kAggressiveTabDiscardThreshold },
388 { IDS_FLAGS_AGGRESSIVE_THRESHOLDS, 387 { IDS_FLAGS_AGGRESSIVE_THRESHOLDS,
389 chromeos::switches::kMemoryPressureThresholds, 388 chromeos::switches::kMemoryPressureThresholds,
390 chromeos::switches::kAggressiveThreshold }, 389 chromeos::switches::kAggressiveThreshold },
391 }; 390 };
392 #endif 391 #endif
393 392
394 const Experiment::Choice kExtensionContentVerificationChoices[] = { 393 const FeatureEntry::Choice kExtensionContentVerificationChoices[] = {
395 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 394 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
396 { IDS_FLAGS_EXTENSION_CONTENT_VERIFICATION_BOOTSTRAP, 395 { IDS_FLAGS_EXTENSION_CONTENT_VERIFICATION_BOOTSTRAP,
397 switches::kExtensionContentVerification, 396 switches::kExtensionContentVerification,
398 switches::kExtensionContentVerificationBootstrap }, 397 switches::kExtensionContentVerificationBootstrap },
399 { IDS_FLAGS_EXTENSION_CONTENT_VERIFICATION_ENFORCE, 398 { IDS_FLAGS_EXTENSION_CONTENT_VERIFICATION_ENFORCE,
400 switches::kExtensionContentVerification, 399 switches::kExtensionContentVerification,
401 switches::kExtensionContentVerificationEnforce }, 400 switches::kExtensionContentVerificationEnforce },
402 { IDS_FLAGS_EXTENSION_CONTENT_VERIFICATION_ENFORCE_STRICT, 401 { IDS_FLAGS_EXTENSION_CONTENT_VERIFICATION_ENFORCE_STRICT,
403 switches::kExtensionContentVerification, 402 switches::kExtensionContentVerification,
404 switches::kExtensionContentVerificationEnforceStrict }, 403 switches::kExtensionContentVerificationEnforceStrict },
405 }; 404 };
406 405
407 const Experiment::Choice kAutofillSyncCredentialChoices[] = { 406 const FeatureEntry::Choice kAutofillSyncCredentialChoices[] = {
408 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, 407 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""},
409 { IDS_ALLOW_AUTOFILL_SYNC_CREDENTIAL, 408 { IDS_ALLOW_AUTOFILL_SYNC_CREDENTIAL,
410 password_manager::switches::kAllowAutofillSyncCredential, ""}, 409 password_manager::switches::kAllowAutofillSyncCredential, ""},
411 { IDS_DISALLOW_AUTOFILL_SYNC_CREDENTIAL_FOR_REAUTH, 410 { IDS_DISALLOW_AUTOFILL_SYNC_CREDENTIAL_FOR_REAUTH,
412 password_manager::switches::kDisallowAutofillSyncCredentialForReauth, ""}, 411 password_manager::switches::kDisallowAutofillSyncCredentialForReauth, ""},
413 { IDS_DISALLOW_AUTOFILL_SYNC_CREDENTIAL, 412 { IDS_DISALLOW_AUTOFILL_SYNC_CREDENTIAL,
414 password_manager::switches::kDisallowAutofillSyncCredential, ""}, 413 password_manager::switches::kDisallowAutofillSyncCredential, ""},
415 }; 414 };
416 415
417 const Experiment::Choice kFillOnAccountSelectChoices[] = { 416 const FeatureEntry::Choice kFillOnAccountSelectChoices[] = {
418 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 417 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
419 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 418 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
420 autofill::switches::kDisableFillOnAccountSelect, "" }, 419 autofill::switches::kDisableFillOnAccountSelect, "" },
421 { IDS_FLAGS_FILL_ON_ACCOUNT_SELECT_ENABLE_HIGHLIGHTING, 420 { IDS_FLAGS_FILL_ON_ACCOUNT_SELECT_ENABLE_HIGHLIGHTING,
422 autofill::switches::kEnableFillOnAccountSelect, "" }, 421 autofill::switches::kEnableFillOnAccountSelect, "" },
423 { IDS_FLAGS_FILL_ON_ACCOUNT_SELECT_ENABLE_NO_HIGHLIGHTING, 422 { IDS_FLAGS_FILL_ON_ACCOUNT_SELECT_ENABLE_NO_HIGHLIGHTING,
424 autofill::switches::kEnableFillOnAccountSelectNoHighlighting, "" }, 423 autofill::switches::kEnableFillOnAccountSelectNoHighlighting, "" },
425 }; 424 };
426 425
427 #if defined(ENABLE_TOPCHROME_MD) 426 #if defined(ENABLE_TOPCHROME_MD)
428 const Experiment::Choice kTopChromeMaterialDesignChoices[] = { 427 const FeatureEntry::Choice kTopChromeMaterialDesignChoices[] = {
429 {IDS_FLAGS_TOP_CHROME_MD_NON_MATERIAL, "", ""}, 428 {IDS_FLAGS_TOP_CHROME_MD_NON_MATERIAL, "", ""},
430 {IDS_FLAGS_TOP_CHROME_MD_MATERIAL, 429 {IDS_FLAGS_TOP_CHROME_MD_MATERIAL,
431 switches::kTopChromeMD, 430 switches::kTopChromeMD,
432 switches::kTopChromeMDMaterial}, 431 switches::kTopChromeMDMaterial},
433 {IDS_FLAGS_TOP_CHROME_MD_MATERIAL_HYBRID, 432 {IDS_FLAGS_TOP_CHROME_MD_MATERIAL_HYBRID,
434 switches::kTopChromeMD, 433 switches::kTopChromeMD,
435 switches::kTopChromeMDMaterialHybrid}}; 434 switches::kTopChromeMDMaterialHybrid}};
436 #endif 435 #endif
437 436
438 #if defined(OS_CHROMEOS) 437 #if defined(OS_CHROMEOS)
439 const Experiment::Choice kAshMaterialDesignInkDropAnimationSpeed[] = { 438 const FeatureEntry::Choice kAshMaterialDesignInkDropAnimationSpeed[] = {
440 {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, 439 {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""},
441 {IDS_FLAGS_MATERIAL_DESIGN_INK_DROP_ANIMATION_FAST, 440 {IDS_FLAGS_MATERIAL_DESIGN_INK_DROP_ANIMATION_FAST,
442 switches::kMaterialDesignInkDropAnimationSpeed, 441 switches::kMaterialDesignInkDropAnimationSpeed,
443 switches::kMaterialDesignInkDropAnimationSpeedFast}, 442 switches::kMaterialDesignInkDropAnimationSpeedFast},
444 {IDS_FLAGS_MATERIAL_DESIGN_INK_DROP_ANIMATION_SLOW, 443 {IDS_FLAGS_MATERIAL_DESIGN_INK_DROP_ANIMATION_SLOW,
445 switches::kMaterialDesignInkDropAnimationSpeed, 444 switches::kMaterialDesignInkDropAnimationSpeed,
446 switches::kMaterialDesignInkDropAnimationSpeedSlow}}; 445 switches::kMaterialDesignInkDropAnimationSpeedSlow}};
447 446
448 const Experiment::Choice kDataSaverPromptChoices[] = { 447 const FeatureEntry::Choice kDataSaverPromptChoices[] = {
449 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 448 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
450 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 449 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
451 chromeos::switches::kEnableDataSaverPrompt, "" }, 450 chromeos::switches::kEnableDataSaverPrompt, "" },
452 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 451 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
453 chromeos::switches::kDisableDataSaverPrompt, "" }, 452 chromeos::switches::kDisableDataSaverPrompt, "" },
454 { IDS_FLAGS_DATASAVER_PROMPT_DEMO_MODE, 453 { IDS_FLAGS_DATASAVER_PROMPT_DEMO_MODE,
455 chromeos::switches::kEnableDataSaverPrompt, 454 chromeos::switches::kEnableDataSaverPrompt,
456 chromeos::switches::kDataSaverPromptDemoMode }, 455 chromeos::switches::kDataSaverPromptDemoMode },
457 }; 456 };
458 457
459 const Experiment::Choice kFloatingVirtualKeyboardChoices[] = { 458 const FeatureEntry::Choice kFloatingVirtualKeyboardChoices[] = {
460 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 459 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
461 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 460 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
462 keyboard::switches::kFloatingVirtualKeyboard, 461 keyboard::switches::kFloatingVirtualKeyboard,
463 keyboard::switches::kFloatingVirtualKeyboardDisabled}, 462 keyboard::switches::kFloatingVirtualKeyboardDisabled},
464 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 463 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
465 keyboard::switches::kFloatingVirtualKeyboard, 464 keyboard::switches::kFloatingVirtualKeyboard,
466 keyboard::switches::kFloatingVirtualKeyboardEnabled}, 465 keyboard::switches::kFloatingVirtualKeyboardEnabled},
467 }; 466 };
468 467
469 const Experiment::Choice kSmartVirtualKeyboardChoices[] = { 468 const FeatureEntry::Choice kSmartVirtualKeyboardChoices[] = {
470 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 469 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
471 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 470 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
472 keyboard::switches::kSmartVirtualKeyboard, 471 keyboard::switches::kSmartVirtualKeyboard,
473 keyboard::switches::kSmartVirtualKeyboardDisabled}, 472 keyboard::switches::kSmartVirtualKeyboardDisabled},
474 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 473 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
475 keyboard::switches::kSmartVirtualKeyboard, 474 keyboard::switches::kSmartVirtualKeyboard,
476 keyboard::switches::kSmartVirtualKeyboardEnabled}, 475 keyboard::switches::kSmartVirtualKeyboardEnabled},
477 }; 476 };
478 477
479 const Experiment::Choice kGestureTypingChoices[] = { 478 const FeatureEntry::Choice kGestureTypingChoices[] = {
480 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 479 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
481 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 480 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
482 keyboard::switches::kGestureTyping, 481 keyboard::switches::kGestureTyping,
483 keyboard::switches::kGestureTypingDisabled}, 482 keyboard::switches::kGestureTypingDisabled},
484 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 483 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
485 keyboard::switches::kGestureTyping, 484 keyboard::switches::kGestureTyping,
486 keyboard::switches::kGestureTypingEnabled}, 485 keyboard::switches::kGestureTypingEnabled},
487 }; 486 };
488 487
489 const Experiment::Choice kGestureEditingChoices[] = { 488 const FeatureEntry::Choice kGestureEditingChoices[] = {
490 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 489 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
491 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 490 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
492 keyboard::switches::kGestureEditing, 491 keyboard::switches::kGestureEditing,
493 keyboard::switches::kGestureEditingDisabled}, 492 keyboard::switches::kGestureEditingDisabled},
494 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 493 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
495 keyboard::switches::kGestureEditing, 494 keyboard::switches::kGestureEditing,
496 keyboard::switches::kGestureEditingEnabled}, 495 keyboard::switches::kGestureEditingEnabled},
497 }; 496 };
498 497
499 const Experiment::Choice kDownloadNotificationChoices[] = { 498 const FeatureEntry::Choice kDownloadNotificationChoices[] = {
500 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 499 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
501 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 500 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
502 switches::kEnableDownloadNotification, 501 switches::kEnableDownloadNotification,
503 "enabled" }, 502 "enabled" },
504 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 503 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
505 switches::kEnableDownloadNotification, 504 switches::kEnableDownloadNotification,
506 "disabled" } 505 "disabled" }
507 }; 506 };
508 #endif 507 #endif
509 508
510 const Experiment::Choice kSupervisedUserSafeSitesChoices[] = { 509 const FeatureEntry::Choice kSupervisedUserSafeSitesChoices[] = {
511 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 510 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
512 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 511 { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
513 switches::kSupervisedUserSafeSites, 512 switches::kSupervisedUserSafeSites,
514 "enabled" }, 513 "enabled" },
515 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 514 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
516 switches::kSupervisedUserSafeSites, 515 switches::kSupervisedUserSafeSites,
517 "disabled" }, 516 "disabled" },
518 { IDS_SUPERVISED_USER_SAFESITES_BLACKLIST_ONLY, 517 { IDS_SUPERVISED_USER_SAFESITES_BLACKLIST_ONLY,
519 switches::kSupervisedUserSafeSites, 518 switches::kSupervisedUserSafeSites,
520 "blacklist-only" }, 519 "blacklist-only" },
521 { IDS_SUPERVISED_USER_SAFESITES_ONLINE_CHECK_ONLY, 520 { IDS_SUPERVISED_USER_SAFESITES_ONLINE_CHECK_ONLY,
522 switches::kSupervisedUserSafeSites, 521 switches::kSupervisedUserSafeSites,
523 "online-check-only" } 522 "online-check-only" }
524 }; 523 };
525 524
526 const Experiment::Choice kV8CacheOptionsChoices[] = { 525 const FeatureEntry::Choice kV8CacheOptionsChoices[] = {
527 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 526 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
528 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, switches::kV8CacheOptions, "none" }, 527 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, switches::kV8CacheOptions, "none" },
529 { IDS_FLAGS_V8_CACHE_OPTIONS_PARSE, switches::kV8CacheOptions, "parse" }, 528 { IDS_FLAGS_V8_CACHE_OPTIONS_PARSE, switches::kV8CacheOptions, "parse" },
530 { IDS_FLAGS_V8_CACHE_OPTIONS_CODE, switches::kV8CacheOptions, "code" }, 529 { IDS_FLAGS_V8_CACHE_OPTIONS_CODE, switches::kV8CacheOptions, "code" },
531 }; 530 };
532 531
533 #if defined(OS_ANDROID) 532 #if defined(OS_ANDROID)
534 const Experiment::Choice kProgressBarAnimationChoices[] = { 533 const FeatureEntry::Choice kProgressBarAnimationChoices[] = {
535 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, 534 { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
536 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 535 { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
537 switches::kProgressBarAnimation, "disabled" }, 536 switches::kProgressBarAnimation, "disabled" },
538 { IDS_FLAGS_PROGRESS_BAR_ANIMATION_LINEAR, 537 { IDS_FLAGS_PROGRESS_BAR_ANIMATION_LINEAR,
539 switches::kProgressBarAnimation, "linear" }, 538 switches::kProgressBarAnimation, "linear" },
540 { IDS_FLAGS_PROGRESS_BAR_ANIMATION_SMOOTH, 539 { IDS_FLAGS_PROGRESS_BAR_ANIMATION_SMOOTH,
541 switches::kProgressBarAnimation, "smooth" }, 540 switches::kProgressBarAnimation, "smooth" },
542 { IDS_FLAGS_PROGRESS_BAR_ANIMATION_FAST_START, 541 { IDS_FLAGS_PROGRESS_BAR_ANIMATION_FAST_START,
543 switches::kProgressBarAnimation, "fast-start" }, 542 switches::kProgressBarAnimation, "fast-start" },
544 }; 543 };
545 #endif // defined(OS_ANDROID) 544 #endif // defined(OS_ANDROID)
546 545
547 #if defined(OS_CHROMEOS) 546 #if defined(OS_CHROMEOS)
548 const Experiment::Choice kCrosRegionsModeChoices[] = { 547 const FeatureEntry::Choice kCrosRegionsModeChoices[] = {
549 { IDS_FLAGS_CROS_REGIONS_MODE_DEFAULT, "", "" }, 548 { IDS_FLAGS_CROS_REGIONS_MODE_DEFAULT, "", "" },
550 { IDS_FLAGS_CROS_REGIONS_MODE_OVERRIDE, chromeos::switches::kCrosRegionsMode, 549 { IDS_FLAGS_CROS_REGIONS_MODE_OVERRIDE, chromeos::switches::kCrosRegionsMode,
551 chromeos::switches::kCrosRegionsModeOverride }, 550 chromeos::switches::kCrosRegionsModeOverride },
552 { IDS_FLAGS_CROS_REGIONS_MODE_HIDE, chromeos::switches::kCrosRegionsMode, 551 { IDS_FLAGS_CROS_REGIONS_MODE_HIDE, chromeos::switches::kCrosRegionsMode,
553 chromeos::switches::kCrosRegionsModeHide }, 552 chromeos::switches::kCrosRegionsModeHide },
554 }; 553 };
555 #endif // defined(OS_CHROMEOS) 554 #endif // defined(OS_CHROMEOS)
556 555
557 #if defined(OS_WIN) 556 #if defined(OS_WIN)
558 const Experiment::Choice kPpapiWin32kLockdown[] = { 557 const FeatureEntry::Choice kPpapiWin32kLockdown[] = {
559 {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, 558 {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""},
560 {IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 559 {IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
561 switches::kEnableWin32kLockDownMimeTypes, ""}, 560 switches::kEnableWin32kLockDownMimeTypes, ""},
562 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_FLASH_ONLY, 561 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_FLASH_ONLY,
563 switches::kEnableWin32kLockDownMimeTypes, 562 switches::kEnableWin32kLockDownMimeTypes,
564 "application/x-shockwave-flash,application/futuresplash"}, 563 "application/x-shockwave-flash,application/futuresplash"},
565 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_PDF_ONLY, 564 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_PDF_ONLY,
566 switches::kEnableWin32kLockDownMimeTypes, 565 switches::kEnableWin32kLockDownMimeTypes,
567 "application/x-google-chrome-pdf,application/pdf"}, 566 "application/x-google-chrome-pdf,application/pdf"},
568 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_FLASH_AND_PDF, 567 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_FLASH_AND_PDF,
569 switches::kEnableWin32kLockDownMimeTypes, 568 switches::kEnableWin32kLockDownMimeTypes,
570 "application/x-shockwave-flash,application/futuresplash," 569 "application/x-shockwave-flash,application/futuresplash,"
571 "application/x-google-chrome-pdf,application/pdf"}, 570 "application/x-google-chrome-pdf,application/pdf"},
572 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_ALL, 571 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_ALL,
573 switches::kEnableWin32kLockDownMimeTypes, "*"}, 572 switches::kEnableWin32kLockDownMimeTypes, "*"},
574 }; 573 };
575 #endif // defined(OS_WIN) 574 #endif // defined(OS_WIN)
576 575
577 // RECORDING USER METRICS FOR FLAGS: 576 // RECORDING USER METRICS FOR FLAGS:
578 // ----------------------------------------------------------------------------- 577 // -----------------------------------------------------------------------------
579 // The first line of the experiment is the internal name. If you'd like to 578 // The first line of the entry is the internal name. If you'd like to gather
580 // gather statistics about the usage of your flag, you should append a marker 579 // statistics about the usage of your flag, you should append a marker comment
581 // comment to the end of the feature name, like so: 580 // to the end of the feature name, like so:
582 // "my-special-feature", // FLAGS:RECORD_UMA 581 // "my-special-feature", // FLAGS:RECORD_UMA
583 // 582 //
584 // After doing that, run 583 // After doing that, run
585 // tools/metrics/actions/extract_actions.py 584 // tools/metrics/actions/extract_actions.py
586 // to add the metric to actions.xml (which will enable UMA to record your 585 // to add the metric to actions.xml (which will enable UMA to record your
587 // feature flag), then update the <owner>s and <description> sections. Make sure 586 // feature flag), then update the <owner>s and <description> sections. Make sure
588 // to include the actions.xml file when you upload your code for review! 587 // to include the actions.xml file when you upload your code for review!
589 // 588 //
590 // After your feature has shipped under a flag, you can locate the metrics under 589 // After your feature has shipped under a flag, you can locate the metrics under
591 // the action name AboutFlags_internal-action-name. Actions are recorded once 590 // the action name AboutFlags_internal-action-name. Actions are recorded once
592 // per startup, so you should divide this number by AboutFlags_StartupTick to 591 // per startup, so you should divide this number by AboutFlags_StartupTick to
593 // get a sense of usage. Note that this will not be the same as number of users 592 // get a sense of usage. Note that this will not be the same as number of users
594 // with a given feature enabled because users can quit and relaunch the 593 // with a given feature enabled because users can quit and relaunch the
595 // application multiple times over a given time interval. The dashboard also 594 // application multiple times over a given time interval. The dashboard also
596 // shows you how many (metrics reporting) users have enabled the flag over the 595 // shows you how many (metrics reporting) users have enabled the flag over the
597 // last seven days. However, note that this is not the same as the number of 596 // last seven days. However, note that this is not the same as the number of
598 // users who have the flag enabled, since enabling the flag happens once, 597 // users who have the flag enabled, since enabling the flag happens once,
599 // whereas running with the flag enabled happens until the user flips the flag 598 // whereas running with the flag enabled happens until the user flips the flag
600 // again. 599 // again.
601 600
602 // To add a new experiment add to the end of kExperiments. There are two 601 // To add a new entry, add to the end of kFeatureEntries. There are two
603 // distinct types of experiments: 602 // distinct types of entries:
604 // . SINGLE_VALUE: experiment is either on or off. Use the SINGLE_VALUE_TYPE 603 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE
605 // macro for this type supplying the command line to the macro. 604 // macro for this type supplying the command line to the macro.
606 // . MULTI_VALUE: a list of choices, the first of which should correspond to a 605 // . MULTI_VALUE: a list of choices, the first of which should correspond to a
607 // deactivated state for this lab (i.e. no command line option). To specify 606 // deactivated state for this lab (i.e. no command line option). To specify
608 // this type of experiment use the macro MULTI_VALUE_TYPE supplying it the 607 // this type of entry use the macro MULTI_VALUE_TYPE supplying it the
609 // array of choices. 608 // array of choices.
610 // See the documentation of Experiment for details on the fields. 609 // See the documentation of FeatureEntry for details on the fields.
611 // 610 //
612 // Command-line switches must have entries in enum "LoginCustomFlags" in 611 // Command-line switches must have entries in enum "LoginCustomFlags" in
613 // histograms.xml. See note in histograms.xml and don't forget to run 612 // histograms.xml. See note in histograms.xml and don't forget to run
614 // AboutFlagsHistogramTest unit test to calculate and verify checksum. 613 // AboutFlagsHistogramTest unit test to calculate and verify checksum.
615 // 614 //
616 // When adding a new choice, add it to the end of the list. 615 // When adding a new choice, add it to the end of the list.
617 const Experiment kExperiments[] = { 616 const FeatureEntry kFeatureEntries[] = {
618 {"ignore-gpu-blacklist", 617 {"ignore-gpu-blacklist",
619 IDS_FLAGS_IGNORE_GPU_BLACKLIST_NAME, 618 IDS_FLAGS_IGNORE_GPU_BLACKLIST_NAME,
620 IDS_FLAGS_IGNORE_GPU_BLACKLIST_DESCRIPTION, 619 IDS_FLAGS_IGNORE_GPU_BLACKLIST_DESCRIPTION,
621 kOsAll, 620 kOsAll,
622 SINGLE_VALUE_TYPE(switches::kIgnoreGpuBlacklist)}, 621 SINGLE_VALUE_TYPE(switches::kIgnoreGpuBlacklist)},
623 #if defined(OS_WIN) 622 #if defined(OS_WIN)
624 {"disable-direct-write", 623 {"disable-direct-write",
625 IDS_FLAGS_DISABLE_DIRECT_WRITE_NAME, 624 IDS_FLAGS_DISABLE_DIRECT_WRITE_NAME,
626 IDS_FLAGS_DISABLE_DIRECT_WRITE_DESCRIPTION, 625 IDS_FLAGS_DISABLE_DIRECT_WRITE_DESCRIPTION,
627 kOsWin, 626 kOsWin,
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 {"enable-ppapi-win32k-lockdown", 2122 {"enable-ppapi-win32k-lockdown",
2124 IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_NAME, 2123 IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_NAME,
2125 IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_DESCRIPTION, kOsWin, 2124 IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_DESCRIPTION, kOsWin,
2126 MULTI_VALUE_TYPE(kPpapiWin32kLockdown)}, 2125 MULTI_VALUE_TYPE(kPpapiWin32kLockdown)},
2127 #endif // defined(OS_WIN) 2126 #endif // defined(OS_WIN)
2128 // NOTE: Adding new command-line switches requires adding corresponding 2127 // NOTE: Adding new command-line switches requires adding corresponding
2129 // entries to enum "LoginCustomFlags" in histograms.xml. See note in 2128 // entries to enum "LoginCustomFlags" in histograms.xml. See note in
2130 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. 2129 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test.
2131 }; 2130 };
2132 2131
2133 const Experiment* experiments = kExperiments; 2132 const FeatureEntry* g_entries = kFeatureEntries;
2134 size_t num_experiments = arraysize(kExperiments); 2133 size_t g_num_entries = arraysize(kFeatureEntries);
2135 2134
2136 // Stores and encapsulates the little state that about:flags has. 2135 // Stores and encapsulates the little state that about:flags has.
2137 class FlagsState { 2136 class FlagsState {
2138 public: 2137 public:
2139 FlagsState() : needs_restart_(false) {} 2138 FlagsState() : needs_restart_(false) {}
2140 void ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage, 2139 void ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage,
2141 base::CommandLine* command_line, 2140 base::CommandLine* command_line,
2142 SentinelsMode sentinels); 2141 SentinelsMode sentinels);
2143 bool IsRestartNeededToCommitChanges(); 2142 bool IsRestartNeededToCommitChanges();
2144 void SetExperimentEnabled(flags_ui::FlagsStorage* flags_storage, 2143 void SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage,
2145 const std::string& internal_name, 2144 const std::string& internal_name,
2146 bool enable); 2145 bool enable);
2147 void RemoveFlagsSwitches( 2146 void RemoveFlagsSwitches(
2148 std::map<std::string, base::CommandLine::StringType>* switch_list); 2147 std::map<std::string, base::CommandLine::StringType>* switch_list);
2149 void ResetAllFlags(flags_ui::FlagsStorage* flags_storage); 2148 void ResetAllFlags(flags_ui::FlagsStorage* flags_storage);
2150 void reset(); 2149 void reset();
2151 2150
2152 // Returns the singleton instance of this class 2151 // Returns the singleton instance of this class
2153 static FlagsState* GetInstance() { 2152 static FlagsState* GetInstance() {
2154 return base::Singleton<FlagsState>::get(); 2153 return base::Singleton<FlagsState>::get();
2155 } 2154 }
2156 2155
2157 private: 2156 private:
2158 bool needs_restart_; 2157 bool needs_restart_;
2159 std::map<std::string, std::string> flags_switches_; 2158 std::map<std::string, std::string> flags_switches_;
2160 2159
2161 DISALLOW_COPY_AND_ASSIGN(FlagsState); 2160 DISALLOW_COPY_AND_ASSIGN(FlagsState);
2162 }; 2161 };
2163 2162
2164 // Adds the internal names for the specified experiment to |names|. 2163 // Adds the internal names for the specified entry to |names|.
2165 void AddInternalName(const Experiment& e, std::set<std::string>* names) { 2164 void AddInternalName(const FeatureEntry& e, std::set<std::string>* names) {
2166 if (e.type == Experiment::SINGLE_VALUE || 2165 if (e.type == FeatureEntry::SINGLE_VALUE ||
2167 e.type == Experiment::SINGLE_DISABLE_VALUE) { 2166 e.type == FeatureEntry::SINGLE_DISABLE_VALUE) {
2168 names->insert(e.internal_name); 2167 names->insert(e.internal_name);
2169 } else { 2168 } else {
2170 DCHECK(e.type == Experiment::MULTI_VALUE || 2169 DCHECK(e.type == FeatureEntry::MULTI_VALUE ||
2171 e.type == Experiment::ENABLE_DISABLE_VALUE); 2170 e.type == FeatureEntry::ENABLE_DISABLE_VALUE);
2172 for (int i = 0; i < e.num_choices; ++i) 2171 for (int i = 0; i < e.num_choices; ++i)
2173 names->insert(e.NameForChoice(i)); 2172 names->insert(e.NameForChoice(i));
2174 } 2173 }
2175 } 2174 }
2176 2175
2177 // Confirms that an experiment is valid, used in a DCHECK in 2176 // Confirms that an entry is valid, used in a DCHECK in
2178 // SanitizeList below. 2177 // SanitizeList below.
2179 bool ValidateExperiment(const Experiment& e) { 2178 bool ValidateFeatureEntry(const FeatureEntry& e) {
2180 switch (e.type) { 2179 switch (e.type) {
2181 case Experiment::SINGLE_VALUE: 2180 case FeatureEntry::SINGLE_VALUE:
2182 case Experiment::SINGLE_DISABLE_VALUE: 2181 case FeatureEntry::SINGLE_DISABLE_VALUE:
2183 DCHECK_EQ(0, e.num_choices); 2182 DCHECK_EQ(0, e.num_choices);
2184 DCHECK(!e.choices); 2183 DCHECK(!e.choices);
2185 break; 2184 break;
2186 case Experiment::MULTI_VALUE: 2185 case FeatureEntry::MULTI_VALUE:
2187 DCHECK_GT(e.num_choices, 0); 2186 DCHECK_GT(e.num_choices, 0);
2188 DCHECK(e.choices); 2187 DCHECK(e.choices);
2189 DCHECK(e.choices[0].command_line_switch); 2188 DCHECK(e.choices[0].command_line_switch);
2190 DCHECK_EQ('\0', e.choices[0].command_line_switch[0]); 2189 DCHECK_EQ('\0', e.choices[0].command_line_switch[0]);
2191 break; 2190 break;
2192 case Experiment::ENABLE_DISABLE_VALUE: 2191 case FeatureEntry::ENABLE_DISABLE_VALUE:
2193 DCHECK_EQ(3, e.num_choices); 2192 DCHECK_EQ(3, e.num_choices);
2194 DCHECK(!e.choices); 2193 DCHECK(!e.choices);
2195 DCHECK(e.command_line_switch); 2194 DCHECK(e.command_line_switch);
2196 DCHECK(e.command_line_value); 2195 DCHECK(e.command_line_value);
2197 DCHECK(e.disable_command_line_switch); 2196 DCHECK(e.disable_command_line_switch);
2198 DCHECK(e.disable_command_line_value); 2197 DCHECK(e.disable_command_line_value);
2199 break; 2198 break;
2200 default: 2199 default:
2201 NOTREACHED(); 2200 NOTREACHED();
2202 } 2201 }
2203 return true; 2202 return true;
2204 } 2203 }
2205 2204
2206 // Removes all experiments from prefs::kEnabledLabsExperiments that are 2205 // Removes all entries from prefs::kEnabledLabsExperiments that are
2207 // unknown, to prevent this list to become very long as experiments are added 2206 // unknown, to prevent this list to become very long as entries are added
2208 // and removed. 2207 // and removed.
2209 void SanitizeList(flags_ui::FlagsStorage* flags_storage) { 2208 void SanitizeList(flags_ui::FlagsStorage* flags_storage) {
2210 std::set<std::string> known_experiments; 2209 std::set<std::string> known_entries;
2211 for (size_t i = 0; i < num_experiments; ++i) { 2210 for (size_t i = 0; i < g_num_entries; ++i) {
2212 DCHECK(ValidateExperiment(experiments[i])); 2211 DCHECK(ValidateFeatureEntry(g_entries[i]));
2213 AddInternalName(experiments[i], &known_experiments); 2212 AddInternalName(g_entries[i], &known_entries);
2214 } 2213 }
2215 2214
2216 std::set<std::string> enabled_experiments = flags_storage->GetFlags(); 2215 std::set<std::string> enabled_entries = flags_storage->GetFlags();
2217 2216
2218 std::set<std::string> new_enabled_experiments = 2217 std::set<std::string> new_enabled_entries =
2219 base::STLSetIntersection<std::set<std::string> >( 2218 base::STLSetIntersection<std::set<std::string> >(
2220 known_experiments, enabled_experiments); 2219 known_entries, enabled_entries);
2221 2220
2222 if (new_enabled_experiments != enabled_experiments) 2221 if (new_enabled_entries != enabled_entries)
2223 flags_storage->SetFlags(new_enabled_experiments); 2222 flags_storage->SetFlags(new_enabled_entries);
2224 } 2223 }
2225 2224
2226 void GetSanitizedEnabledFlags(flags_ui::FlagsStorage* flags_storage, 2225 void GetSanitizedEnabledFlags(flags_ui::FlagsStorage* flags_storage,
2227 std::set<std::string>* result) { 2226 std::set<std::string>* result) {
2228 SanitizeList(flags_storage); 2227 SanitizeList(flags_storage);
2229 *result = flags_storage->GetFlags(); 2228 *result = flags_storage->GetFlags();
2230 } 2229 }
2231 2230
2232 bool SkipConditionalExperiment(const Experiment& experiment) { 2231 bool SkipConditionalFeatureEntry(const FeatureEntry& entry) {
2233 version_info::Channel channel = chrome::GetChannel(); 2232 version_info::Channel channel = chrome::GetChannel();
2234 2233
2235 #if defined(OS_ANDROID) 2234 #if defined(OS_ANDROID)
2236 // enable-data-reduction-proxy-dev is only available for the Dev/Beta channel. 2235 // enable-data-reduction-proxy-dev is only available for the Dev/Beta channel.
2237 if (!strcmp("enable-data-reduction-proxy-dev", experiment.internal_name) && 2236 if (!strcmp("enable-data-reduction-proxy-dev", entry.internal_name) &&
2238 channel != version_info::Channel::BETA && 2237 channel != version_info::Channel::BETA &&
2239 channel != version_info::Channel::DEV) { 2238 channel != version_info::Channel::DEV) {
2240 return true; 2239 return true;
2241 } 2240 }
2242 // enable-data-reduction-proxy-alt is only available for the Dev channel. 2241 // enable-data-reduction-proxy-alt is only available for the Dev channel.
2243 if (!strcmp("enable-data-reduction-proxy-alt", experiment.internal_name) && 2242 if (!strcmp("enable-data-reduction-proxy-alt", entry.internal_name) &&
2244 channel != version_info::Channel::DEV) { 2243 channel != version_info::Channel::DEV) {
2245 return true; 2244 return true;
2246 } 2245 }
2247 // enable-data-reduction-proxy-carrier-test is only available for Chromium 2246 // enable-data-reduction-proxy-carrier-test is only available for Chromium
2248 // builds and the Canary/Dev channel. 2247 // builds and the Canary/Dev channel.
2249 if (!strcmp("enable-data-reduction-proxy-carrier-test", 2248 if (!strcmp("enable-data-reduction-proxy-carrier-test",
2250 experiment.internal_name) && 2249 entry.internal_name) &&
2251 channel != version_info::Channel::DEV && 2250 channel != version_info::Channel::DEV &&
2252 channel != version_info::Channel::CANARY && 2251 channel != version_info::Channel::CANARY &&
2253 channel != version_info::Channel::UNKNOWN) { 2252 channel != version_info::Channel::UNKNOWN) {
2254 return true; 2253 return true;
2255 } 2254 }
2256 #endif 2255 #endif
2257 2256
2258 // data-reduction-proxy-lo-fi is only available for Chromium builds and 2257 // data-reduction-proxy-lo-fi is only available for Chromium builds and
2259 // the Canary/Dev/Beta channels. 2258 // the Canary/Dev/Beta channels.
2260 if (!strcmp("data-reduction-proxy-lo-fi", experiment.internal_name) && 2259 if (!strcmp("data-reduction-proxy-lo-fi", entry.internal_name) &&
2261 channel != version_info::Channel::BETA && 2260 channel != version_info::Channel::BETA &&
2262 channel != version_info::Channel::DEV && 2261 channel != version_info::Channel::DEV &&
2263 channel != version_info::Channel::CANARY && 2262 channel != version_info::Channel::CANARY &&
2264 channel != version_info::Channel::UNKNOWN) { 2263 channel != version_info::Channel::UNKNOWN) {
2265 return true; 2264 return true;
2266 } 2265 }
2267 2266
2268 // enable-data-reduction-proxy-config-client is only available for Chromium 2267 // enable-data-reduction-proxy-config-client is only available for Chromium
2269 // builds and the Canary/Dev channels. 2268 // builds and the Canary/Dev channels.
2270 if (!strcmp("enable-data-reduction-proxy-config-client", 2269 if (!strcmp("enable-data-reduction-proxy-config-client",
2271 experiment.internal_name) && 2270 entry.internal_name) &&
2272 channel != version_info::Channel::DEV && 2271 channel != version_info::Channel::DEV &&
2273 channel != version_info::Channel::CANARY && 2272 channel != version_info::Channel::CANARY &&
2274 channel != version_info::Channel::UNKNOWN) { 2273 channel != version_info::Channel::UNKNOWN) {
2275 return true; 2274 return true;
2276 } 2275 }
2277 2276
2278 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) 2277 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING)
2279 // enable-data-reduction-proxy-bypass-warning is only available for Chromium 2278 // enable-data-reduction-proxy-bypass-warning is only available for Chromium
2280 // builds and Canary/Dev channel. 2279 // builds and Canary/Dev channel.
2281 if (!strcmp("enable-data-reduction-proxy-bypass-warnings", 2280 if (!strcmp("enable-data-reduction-proxy-bypass-warnings",
2282 experiment.internal_name) && 2281 entry.internal_name) &&
2283 channel != version_info::Channel::UNKNOWN && 2282 channel != version_info::Channel::UNKNOWN &&
2284 channel != version_info::Channel::CANARY && 2283 channel != version_info::Channel::CANARY &&
2285 channel != version_info::Channel::DEV) { 2284 channel != version_info::Channel::DEV) {
2286 return true; 2285 return true;
2287 } 2286 }
2288 #endif 2287 #endif
2289 2288
2290 return false; 2289 return false;
2291 } 2290 }
2292 2291
2293 2292
2294 // Variant of GetSanitizedEnabledFlags that also removes any flags that aren't 2293 // Variant of GetSanitizedEnabledFlags that also removes any flags that aren't
2295 // enabled on the current platform. 2294 // enabled on the current platform.
2296 void GetSanitizedEnabledFlagsForCurrentPlatform( 2295 void GetSanitizedEnabledFlagsForCurrentPlatform(
2297 flags_ui::FlagsStorage* flags_storage, 2296 flags_ui::FlagsStorage* flags_storage,
2298 std::set<std::string>* result) { 2297 std::set<std::string>* result) {
2299 GetSanitizedEnabledFlags(flags_storage, result); 2298 GetSanitizedEnabledFlags(flags_storage, result);
2300 2299
2301 // Filter out any experiments that aren't enabled on the current platform. We 2300 // Filter out any entries that aren't enabled on the current platform. We
2302 // don't remove these from prefs else syncing to a platform with a different 2301 // don't remove these from prefs else syncing to a platform with a different
2303 // set of experiments would be lossy. 2302 // set of entries would be lossy.
2304 std::set<std::string> platform_experiments; 2303 std::set<std::string> platform_entries;
2305 int current_platform = GetCurrentPlatform(); 2304 int current_platform = GetCurrentPlatform();
2306 for (size_t i = 0; i < num_experiments; ++i) { 2305 for (size_t i = 0; i < g_num_entries; ++i) {
2307 if (experiments[i].supported_platforms & current_platform) 2306 const FeatureEntry& entry = g_entries[i];
2308 AddInternalName(experiments[i], &platform_experiments); 2307 if (entry.supported_platforms & current_platform)
2308 AddInternalName(entry, &platform_entries);
2309 #if defined(OS_CHROMEOS) 2309 #if defined(OS_CHROMEOS)
2310 if (experiments[i].supported_platforms & kOsCrOSOwnerOnly) 2310 if (g_entries[i].supported_platforms & kOsCrOSOwnerOnly)
2311 AddInternalName(experiments[i], &platform_experiments); 2311 AddInternalName(entry, &platform_entries);
2312 #endif 2312 #endif
2313 } 2313 }
2314 2314
2315 std::set<std::string> new_enabled_experiments = 2315 std::set<std::string> new_enabled_entries =
2316 base::STLSetIntersection<std::set<std::string> >( 2316 base::STLSetIntersection<std::set<std::string> >(
2317 platform_experiments, *result); 2317 platform_entries, *result);
2318 2318
2319 result->swap(new_enabled_experiments); 2319 result->swap(new_enabled_entries);
2320 } 2320 }
2321 2321
2322 // Returns true if none of this experiment's options have been enabled. 2322 // Returns true if none of this entry's options have been enabled.
2323 bool IsDefaultValue( 2323 bool IsDefaultValue(
2324 const Experiment& experiment, 2324 const FeatureEntry& entry,
2325 const std::set<std::string>& enabled_experiments) { 2325 const std::set<std::string>& enabled_entries) {
2326 switch (experiment.type) { 2326 switch (entry.type) {
2327 case Experiment::SINGLE_VALUE: 2327 case FeatureEntry::SINGLE_VALUE:
2328 case Experiment::SINGLE_DISABLE_VALUE: 2328 case FeatureEntry::SINGLE_DISABLE_VALUE:
2329 return enabled_experiments.count(experiment.internal_name) == 0; 2329 return enabled_entries.count(entry.internal_name) == 0;
2330 case Experiment::MULTI_VALUE: 2330 case FeatureEntry::MULTI_VALUE:
2331 case Experiment::ENABLE_DISABLE_VALUE: 2331 case FeatureEntry::ENABLE_DISABLE_VALUE:
2332 for (int i = 0; i < experiment.num_choices; ++i) { 2332 for (int i = 0; i < entry.num_choices; ++i) {
2333 if (enabled_experiments.count(experiment.NameForChoice(i)) > 0) 2333 if (enabled_entries.count(entry.NameForChoice(i)) > 0)
2334 return false; 2334 return false;
2335 } 2335 }
2336 break; 2336 break;
2337 default: 2337 default:
2338 NOTREACHED(); 2338 NOTREACHED();
2339 } 2339 }
2340 return true; 2340 return true;
2341 } 2341 }
2342 2342
2343 // Returns the Value representing the choice data in the specified experiment. 2343 // Returns the Value representing the choice data in the specified entry.
2344 base::Value* CreateChoiceData( 2344 base::Value* CreateChoiceData(
2345 const Experiment& experiment, 2345 const FeatureEntry& entry,
2346 const std::set<std::string>& enabled_experiments) { 2346 const std::set<std::string>& enabled_entries) {
2347 DCHECK(experiment.type == Experiment::MULTI_VALUE || 2347 DCHECK(entry.type == FeatureEntry::MULTI_VALUE ||
2348 experiment.type == Experiment::ENABLE_DISABLE_VALUE); 2348 entry.type == FeatureEntry::ENABLE_DISABLE_VALUE);
2349 base::ListValue* result = new base::ListValue; 2349 base::ListValue* result = new base::ListValue;
2350 for (int i = 0; i < experiment.num_choices; ++i) { 2350 for (int i = 0; i < entry.num_choices; ++i) {
2351 base::DictionaryValue* value = new base::DictionaryValue; 2351 base::DictionaryValue* value = new base::DictionaryValue;
2352 const std::string name = experiment.NameForChoice(i); 2352 const std::string name = entry.NameForChoice(i);
2353 value->SetString("internal_name", name); 2353 value->SetString("internal_name", name);
2354 value->SetString("description", experiment.DescriptionForChoice(i)); 2354 value->SetString("description", entry.DescriptionForChoice(i));
2355 value->SetBoolean("selected", enabled_experiments.count(name) > 0); 2355 value->SetBoolean("selected", enabled_entries.count(name) > 0);
2356 result->Append(value); 2356 result->Append(value);
2357 } 2357 }
2358 return result; 2358 return result;
2359 } 2359 }
2360 2360
2361 } // namespace 2361 } // namespace
2362 2362
2363 std::string Experiment::NameForChoice(int index) const { 2363 std::string FeatureEntry::NameForChoice(int index) const {
2364 DCHECK(type == Experiment::MULTI_VALUE || 2364 DCHECK(type == FeatureEntry::MULTI_VALUE ||
2365 type == Experiment::ENABLE_DISABLE_VALUE); 2365 type == FeatureEntry::ENABLE_DISABLE_VALUE);
2366 DCHECK_LT(index, num_choices); 2366 DCHECK_LT(index, num_choices);
2367 return std::string(internal_name) + testing::kMultiSeparator + 2367 return std::string(internal_name) + testing::kMultiSeparator +
2368 base::IntToString(index); 2368 base::IntToString(index);
2369 } 2369 }
2370 2370
2371 base::string16 Experiment::DescriptionForChoice(int index) const { 2371 base::string16 FeatureEntry::DescriptionForChoice(int index) const {
2372 DCHECK(type == Experiment::MULTI_VALUE || 2372 DCHECK(type == FeatureEntry::MULTI_VALUE ||
2373 type == Experiment::ENABLE_DISABLE_VALUE); 2373 type == FeatureEntry::ENABLE_DISABLE_VALUE);
2374 DCHECK_LT(index, num_choices); 2374 DCHECK_LT(index, num_choices);
2375 int description_id; 2375 int description_id;
2376 if (type == Experiment::ENABLE_DISABLE_VALUE) { 2376 if (type == FeatureEntry::ENABLE_DISABLE_VALUE) {
2377 const int kEnableDisableDescriptionIds[] = { 2377 const int kEnableDisableDescriptionIds[] = {
2378 IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, 2378 IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT,
2379 IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, 2379 IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
2380 IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, 2380 IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
2381 }; 2381 };
2382 description_id = kEnableDisableDescriptionIds[index]; 2382 description_id = kEnableDisableDescriptionIds[index];
2383 } else { 2383 } else {
2384 description_id = choices[index].description_id; 2384 description_id = choices[index].description_id;
2385 } 2385 }
2386 return l10n_util::GetStringUTF16(description_id); 2386 return l10n_util::GetStringUTF16(description_id);
(...skipping 28 matching lines...) Expand all
2415 new_flags.begin(), 2415 new_flags.begin(),
2416 new_flags.end(), 2416 new_flags.end(),
2417 active_flags.begin(), 2417 active_flags.begin(),
2418 active_flags.end(), 2418 active_flags.end(),
2419 std::inserter(*out_difference, out_difference->begin())); 2419 std::inserter(*out_difference, out_difference->begin()));
2420 } 2420 }
2421 2421
2422 return result; 2422 return result;
2423 } 2423 }
2424 2424
2425 void GetFlagsExperimentsData(flags_ui::FlagsStorage* flags_storage, 2425 void GetFlagFeatureEntries(flags_ui::FlagsStorage* flags_storage,
2426 FlagAccess access, 2426 FlagAccess access,
2427 base::ListValue* supported_experiments, 2427 base::ListValue* supported_entries,
2428 base::ListValue* unsupported_experiments) { 2428 base::ListValue* unsupported_entries) {
2429 std::set<std::string> enabled_experiments; 2429 std::set<std::string> enabled_entries;
2430 GetSanitizedEnabledFlags(flags_storage, &enabled_experiments); 2430 GetSanitizedEnabledFlags(flags_storage, &enabled_entries);
2431 2431
2432 int current_platform = GetCurrentPlatform(); 2432 int current_platform = GetCurrentPlatform();
2433 2433
2434 for (size_t i = 0; i < num_experiments; ++i) { 2434 for (size_t i = 0; i < g_num_entries; ++i) {
2435 const Experiment& experiment = experiments[i]; 2435 const FeatureEntry& entry = g_entries[i];
2436 if (SkipConditionalExperiment(experiment)) 2436 if (SkipConditionalFeatureEntry(entry))
2437 continue; 2437 continue;
2438 2438
2439 base::DictionaryValue* data = new base::DictionaryValue(); 2439 base::DictionaryValue* data = new base::DictionaryValue();
2440 data->SetString("internal_name", experiment.internal_name); 2440 data->SetString("internal_name", entry.internal_name);
2441 data->SetString("name", 2441 data->SetString("name",
2442 l10n_util::GetStringUTF16(experiment.visible_name_id)); 2442 l10n_util::GetStringUTF16(entry.visible_name_id));
2443 data->SetString("description", 2443 data->SetString("description",
2444 l10n_util::GetStringUTF16( 2444 l10n_util::GetStringUTF16(
2445 experiment.visible_description_id)); 2445 entry.visible_description_id));
2446 2446
2447 base::ListValue* supported_platforms = new base::ListValue(); 2447 base::ListValue* supported_platforms = new base::ListValue();
2448 AddOsStrings(experiment.supported_platforms, supported_platforms); 2448 AddOsStrings(entry.supported_platforms, supported_platforms);
2449 data->Set("supported_platforms", supported_platforms); 2449 data->Set("supported_platforms", supported_platforms);
2450 // True if the switch is not currently passed. 2450 // True if the switch is not currently passed.
2451 bool is_default_value = IsDefaultValue(experiment, enabled_experiments); 2451 bool is_default_value = IsDefaultValue(entry, enabled_entries);
2452 data->SetBoolean("is_default", is_default_value); 2452 data->SetBoolean("is_default", is_default_value);
2453 2453
2454 switch (experiment.type) { 2454 switch (entry.type) {
2455 case Experiment::SINGLE_VALUE: 2455 case FeatureEntry::SINGLE_VALUE:
2456 case Experiment::SINGLE_DISABLE_VALUE: 2456 case FeatureEntry::SINGLE_DISABLE_VALUE:
2457 data->SetBoolean( 2457 data->SetBoolean(
2458 "enabled", 2458 "enabled",
2459 (!is_default_value && 2459 (!is_default_value &&
2460 experiment.type == Experiment::SINGLE_VALUE) || 2460 entry.type == FeatureEntry::SINGLE_VALUE) ||
2461 (is_default_value && 2461 (is_default_value &&
2462 experiment.type == Experiment::SINGLE_DISABLE_VALUE)); 2462 entry.type == FeatureEntry::SINGLE_DISABLE_VALUE));
2463 break; 2463 break;
2464 case Experiment::MULTI_VALUE: 2464 case FeatureEntry::MULTI_VALUE:
2465 case Experiment::ENABLE_DISABLE_VALUE: 2465 case FeatureEntry::ENABLE_DISABLE_VALUE:
2466 data->Set("choices", CreateChoiceData(experiment, enabled_experiments)); 2466 data->Set("choices", CreateChoiceData(entry, enabled_entries));
2467 break; 2467 break;
2468 default: 2468 default:
2469 NOTREACHED(); 2469 NOTREACHED();
2470 } 2470 }
2471 2471
2472 bool supported = (experiment.supported_platforms & current_platform) != 0; 2472 bool supported = (entry.supported_platforms & current_platform) != 0;
2473 #if defined(OS_CHROMEOS) 2473 #if defined(OS_CHROMEOS)
2474 if (access == kOwnerAccessToFlags && 2474 if (access == kOwnerAccessToFlags &&
2475 (experiment.supported_platforms & kOsCrOSOwnerOnly) != 0) { 2475 (entry.supported_platforms & kOsCrOSOwnerOnly) != 0) {
2476 supported = true; 2476 supported = true;
2477 } 2477 }
2478 #endif 2478 #endif
2479 if (supported) 2479 if (supported)
2480 supported_experiments->Append(data); 2480 supported_entries->Append(data);
2481 else 2481 else
2482 unsupported_experiments->Append(data); 2482 unsupported_entries->Append(data);
2483 } 2483 }
2484 } 2484 }
2485 2485
2486 bool IsRestartNeededToCommitChanges() { 2486 bool IsRestartNeededToCommitChanges() {
2487 return FlagsState::GetInstance()->IsRestartNeededToCommitChanges(); 2487 return FlagsState::GetInstance()->IsRestartNeededToCommitChanges();
2488 } 2488 }
2489 2489
2490 void SetExperimentEnabled(flags_ui::FlagsStorage* flags_storage, 2490 void SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage,
2491 const std::string& internal_name, 2491 const std::string& internal_name,
2492 bool enable) { 2492 bool enable) {
2493 FlagsState::GetInstance()->SetExperimentEnabled(flags_storage, 2493 FlagsState::GetInstance()->SetFeatureEntryEnabled(flags_storage,
2494 internal_name, enable); 2494 internal_name, enable);
2495 } 2495 }
2496 2496
2497 void RemoveFlagsSwitches( 2497 void RemoveFlagsSwitches(
2498 std::map<std::string, base::CommandLine::StringType>* switch_list) { 2498 std::map<std::string, base::CommandLine::StringType>* switch_list) {
2499 FlagsState::GetInstance()->RemoveFlagsSwitches(switch_list); 2499 FlagsState::GetInstance()->RemoveFlagsSwitches(switch_list);
2500 } 2500 }
2501 2501
2502 void ResetAllFlags(flags_ui::FlagsStorage* flags_storage) { 2502 void ResetAllFlags(flags_ui::FlagsStorage* flags_storage) {
2503 FlagsState::GetInstance()->ResetAllFlags(flags_storage); 2503 FlagsState::GetInstance()->ResetAllFlags(flags_storage);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 DCHECK(name_to_switch_map->end() == name_to_switch_map->find(key)); 2580 DCHECK(name_to_switch_map->end() == name_to_switch_map->find(key));
2581 (*name_to_switch_map)[key] = std::make_pair(switch_name, switch_value); 2581 (*name_to_switch_map)[key] = std::make_pair(switch_name, switch_value);
2582 } 2582 }
2583 2583
2584 void FlagsState::ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage, 2584 void FlagsState::ConvertFlagsToSwitches(flags_ui::FlagsStorage* flags_storage,
2585 base::CommandLine* command_line, 2585 base::CommandLine* command_line,
2586 SentinelsMode sentinels) { 2586 SentinelsMode sentinels) {
2587 if (command_line->HasSwitch(switches::kNoExperiments)) 2587 if (command_line->HasSwitch(switches::kNoExperiments))
2588 return; 2588 return;
2589 2589
2590 std::set<std::string> enabled_experiments; 2590 std::set<std::string> enabled_entries;
2591 2591
2592 GetSanitizedEnabledFlagsForCurrentPlatform(flags_storage, 2592 GetSanitizedEnabledFlagsForCurrentPlatform(flags_storage,
2593 &enabled_experiments); 2593 &enabled_entries);
2594 2594
2595 NameToSwitchAndValueMap name_to_switch_map; 2595 NameToSwitchAndValueMap name_to_switch_map;
2596 for (size_t i = 0; i < num_experiments; ++i) { 2596 for (size_t i = 0; i < g_num_entries; ++i) {
2597 const Experiment& e = experiments[i]; 2597 const FeatureEntry& e = g_entries[i];
2598 if (e.type == Experiment::SINGLE_VALUE || 2598 if (e.type == FeatureEntry::SINGLE_VALUE ||
2599 e.type == Experiment::SINGLE_DISABLE_VALUE) { 2599 e.type == FeatureEntry::SINGLE_DISABLE_VALUE) {
2600 SetFlagToSwitchMapping(e.internal_name, e.command_line_switch, 2600 SetFlagToSwitchMapping(e.internal_name, e.command_line_switch,
2601 e.command_line_value, &name_to_switch_map); 2601 e.command_line_value, &name_to_switch_map);
2602 } else if (e.type == Experiment::MULTI_VALUE) { 2602 } else if (e.type == FeatureEntry::MULTI_VALUE) {
2603 for (int j = 0; j < e.num_choices; ++j) { 2603 for (int j = 0; j < e.num_choices; ++j) {
2604 SetFlagToSwitchMapping(e.NameForChoice(j), 2604 SetFlagToSwitchMapping(e.NameForChoice(j),
2605 e.choices[j].command_line_switch, 2605 e.choices[j].command_line_switch,
2606 e.choices[j].command_line_value, 2606 e.choices[j].command_line_value,
2607 &name_to_switch_map); 2607 &name_to_switch_map);
2608 } 2608 }
2609 } else { 2609 } else {
2610 DCHECK_EQ(e.type, Experiment::ENABLE_DISABLE_VALUE); 2610 DCHECK_EQ(e.type, FeatureEntry::ENABLE_DISABLE_VALUE);
2611 SetFlagToSwitchMapping(e.NameForChoice(0), std::string(), std::string(), 2611 SetFlagToSwitchMapping(e.NameForChoice(0), std::string(), std::string(),
2612 &name_to_switch_map); 2612 &name_to_switch_map);
2613 SetFlagToSwitchMapping(e.NameForChoice(1), e.command_line_switch, 2613 SetFlagToSwitchMapping(e.NameForChoice(1), e.command_line_switch,
2614 e.command_line_value, &name_to_switch_map); 2614 e.command_line_value, &name_to_switch_map);
2615 SetFlagToSwitchMapping(e.NameForChoice(2), e.disable_command_line_switch, 2615 SetFlagToSwitchMapping(e.NameForChoice(2), e.disable_command_line_switch,
2616 e.disable_command_line_value, &name_to_switch_map); 2616 e.disable_command_line_value, &name_to_switch_map);
2617 } 2617 }
2618 } 2618 }
2619 2619
2620 if (sentinels == kAddSentinels) { 2620 if (sentinels == kAddSentinels) {
2621 command_line->AppendSwitch(switches::kFlagSwitchesBegin); 2621 command_line->AppendSwitch(switches::kFlagSwitchesBegin);
2622 flags_switches_.insert( 2622 flags_switches_.insert(
2623 std::pair<std::string, std::string>(switches::kFlagSwitchesBegin, 2623 std::pair<std::string, std::string>(switches::kFlagSwitchesBegin,
2624 std::string())); 2624 std::string()));
2625 } 2625 }
2626 for (const std::string& experiment_name : enabled_experiments) { 2626 for (const std::string& entry_name : enabled_entries) {
2627 NameToSwitchAndValueMap::const_iterator name_to_switch_it = 2627 NameToSwitchAndValueMap::const_iterator name_to_switch_it =
2628 name_to_switch_map.find(experiment_name); 2628 name_to_switch_map.find(entry_name);
2629 if (name_to_switch_it == name_to_switch_map.end()) { 2629 if (name_to_switch_it == name_to_switch_map.end()) {
2630 NOTREACHED(); 2630 NOTREACHED();
2631 continue; 2631 continue;
2632 } 2632 }
2633 2633
2634 const std::pair<std::string, std::string>& 2634 const std::pair<std::string, std::string>&
2635 switch_and_value_pair = name_to_switch_it->second; 2635 switch_and_value_pair = name_to_switch_it->second;
2636 2636
2637 CHECK(!switch_and_value_pair.first.empty()); 2637 CHECK(!switch_and_value_pair.first.empty());
2638 command_line->AppendSwitchASCII(switch_and_value_pair.first, 2638 command_line->AppendSwitchASCII(switch_and_value_pair.first,
2639 switch_and_value_pair.second); 2639 switch_and_value_pair.second);
2640 flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second; 2640 flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second;
2641 } 2641 }
2642 if (sentinels == kAddSentinels) { 2642 if (sentinels == kAddSentinels) {
2643 command_line->AppendSwitch(switches::kFlagSwitchesEnd); 2643 command_line->AppendSwitch(switches::kFlagSwitchesEnd);
2644 flags_switches_.insert( 2644 flags_switches_.insert(
2645 std::pair<std::string, std::string>(switches::kFlagSwitchesEnd, 2645 std::pair<std::string, std::string>(switches::kFlagSwitchesEnd,
2646 std::string())); 2646 std::string()));
2647 } 2647 }
2648 } 2648 }
2649 2649
2650 bool FlagsState::IsRestartNeededToCommitChanges() { 2650 bool FlagsState::IsRestartNeededToCommitChanges() {
2651 return needs_restart_; 2651 return needs_restart_;
2652 } 2652 }
2653 2653
2654 void FlagsState::SetExperimentEnabled(flags_ui::FlagsStorage* flags_storage, 2654 void FlagsState::SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage,
2655 const std::string& internal_name, 2655 const std::string& internal_name,
2656 bool enable) { 2656 bool enable) {
2657 size_t at_index = internal_name.find(testing::kMultiSeparator); 2657 size_t at_index = internal_name.find(testing::kMultiSeparator);
2658 if (at_index != std::string::npos) { 2658 if (at_index != std::string::npos) {
2659 DCHECK(enable); 2659 DCHECK(enable);
2660 // We're being asked to enable a multi-choice experiment. Disable the 2660 // We're being asked to enable a multi-choice entry. Disable the
2661 // currently selected choice. 2661 // currently selected choice.
2662 DCHECK_NE(at_index, 0u); 2662 DCHECK_NE(at_index, 0u);
2663 const std::string experiment_name = internal_name.substr(0, at_index); 2663 const std::string entry_name = internal_name.substr(0, at_index);
2664 SetExperimentEnabled(flags_storage, experiment_name, false); 2664 SetFeatureEntryEnabled(flags_storage, entry_name, false);
2665 2665
2666 // And enable the new choice, if it is not the default first choice. 2666 // And enable the new choice, if it is not the default first choice.
2667 if (internal_name != experiment_name + "@0") { 2667 if (internal_name != entry_name + "@0") {
2668 std::set<std::string> enabled_experiments; 2668 std::set<std::string> enabled_entries;
2669 GetSanitizedEnabledFlags(flags_storage, &enabled_experiments); 2669 GetSanitizedEnabledFlags(flags_storage, &enabled_entries);
2670 needs_restart_ |= enabled_experiments.insert(internal_name).second; 2670 needs_restart_ |= enabled_entries.insert(internal_name).second;
2671 flags_storage->SetFlags(enabled_experiments); 2671 flags_storage->SetFlags(enabled_entries);
2672 } 2672 }
2673 return; 2673 return;
2674 } 2674 }
2675 2675
2676 std::set<std::string> enabled_experiments; 2676 std::set<std::string> enabled_entries;
2677 GetSanitizedEnabledFlags(flags_storage, &enabled_experiments); 2677 GetSanitizedEnabledFlags(flags_storage, &enabled_entries);
2678 2678
2679 const Experiment* e = NULL; 2679 const FeatureEntry* e = NULL;
2680 for (size_t i = 0; i < num_experiments; ++i) { 2680 for (size_t i = 0; i < g_num_entries; ++i) {
2681 if (experiments[i].internal_name == internal_name) { 2681 if (g_entries[i].internal_name == internal_name) {
2682 e = experiments + i; 2682 e = g_entries + i;
2683 break; 2683 break;
2684 } 2684 }
2685 } 2685 }
2686 DCHECK(e); 2686 DCHECK(e);
2687 2687
2688 if (e->type == Experiment::SINGLE_VALUE) { 2688 if (e->type == FeatureEntry::SINGLE_VALUE) {
2689 if (enable) 2689 if (enable)
2690 needs_restart_ |= enabled_experiments.insert(internal_name).second; 2690 needs_restart_ |= enabled_entries.insert(internal_name).second;
2691 else 2691 else
2692 needs_restart_ |= (enabled_experiments.erase(internal_name) > 0); 2692 needs_restart_ |= (enabled_entries.erase(internal_name) > 0);
2693 } else if (e->type == Experiment::SINGLE_DISABLE_VALUE) { 2693 } else if (e->type == FeatureEntry::SINGLE_DISABLE_VALUE) {
2694 if (!enable) 2694 if (!enable)
2695 needs_restart_ |= enabled_experiments.insert(internal_name).second; 2695 needs_restart_ |= enabled_entries.insert(internal_name).second;
2696 else 2696 else
2697 needs_restart_ |= (enabled_experiments.erase(internal_name) > 0); 2697 needs_restart_ |= (enabled_entries.erase(internal_name) > 0);
2698 } else { 2698 } else {
2699 if (enable) { 2699 if (enable) {
2700 // Enable the first choice. 2700 // Enable the first choice.
2701 needs_restart_ |= enabled_experiments.insert(e->NameForChoice(0)).second; 2701 needs_restart_ |= enabled_entries.insert(e->NameForChoice(0)).second;
2702 } else { 2702 } else {
2703 // Find the currently enabled choice and disable it. 2703 // Find the currently enabled choice and disable it.
2704 for (int i = 0; i < e->num_choices; ++i) { 2704 for (int i = 0; i < e->num_choices; ++i) {
2705 std::string choice_name = e->NameForChoice(i); 2705 std::string choice_name = e->NameForChoice(i);
2706 if (enabled_experiments.find(choice_name) != 2706 if (enabled_entries.find(choice_name) !=
2707 enabled_experiments.end()) { 2707 enabled_entries.end()) {
2708 needs_restart_ = true; 2708 needs_restart_ = true;
2709 enabled_experiments.erase(choice_name); 2709 enabled_entries.erase(choice_name);
2710 // Continue on just in case there's a bug and more than one 2710 // Continue on just in case there's a bug and more than one
2711 // experiment for this choice was enabled. 2711 // entry for this choice was enabled.
2712 } 2712 }
2713 } 2713 }
2714 } 2714 }
2715 } 2715 }
2716 2716
2717 flags_storage->SetFlags(enabled_experiments); 2717 flags_storage->SetFlags(enabled_entries);
2718 } 2718 }
2719 2719
2720 void FlagsState::RemoveFlagsSwitches( 2720 void FlagsState::RemoveFlagsSwitches(
2721 std::map<std::string, base::CommandLine::StringType>* switch_list) { 2721 std::map<std::string, base::CommandLine::StringType>* switch_list) {
2722 for (const auto& entry : flags_switches_) 2722 for (const auto& entry : flags_switches_)
2723 switch_list->erase(entry.first); 2723 switch_list->erase(entry.first);
2724 } 2724 }
2725 2725
2726 void FlagsState::ResetAllFlags(flags_ui::FlagsStorage* flags_storage) { 2726 void FlagsState::ResetAllFlags(flags_ui::FlagsStorage* flags_storage) {
2727 needs_restart_ = true; 2727 needs_restart_ = true;
2728 2728
2729 std::set<std::string> no_experiments; 2729 std::set<std::string> no_entries;
2730 flags_storage->SetFlags(no_experiments); 2730 flags_storage->SetFlags(no_entries);
2731 } 2731 }
2732 2732
2733 void FlagsState::reset() { 2733 void FlagsState::reset() {
2734 needs_restart_ = false; 2734 needs_restart_ = false;
2735 flags_switches_.clear(); 2735 flags_switches_.clear();
2736 } 2736 }
2737 2737
2738 } // namespace 2738 } // namespace
2739 2739
2740 namespace testing { 2740 namespace testing {
2741 2741
2742 // WARNING: '@' is also used in the html file. If you update this constant you 2742 // WARNING: '@' is also used in the html file. If you update this constant you
2743 // also need to update the html file. 2743 // also need to update the html file.
2744 const char kMultiSeparator[] = "@"; 2744 const char kMultiSeparator[] = "@";
2745 2745
2746 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; 2746 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0;
2747 2747
2748 void ClearState() { 2748 void ClearState() {
2749 FlagsState::GetInstance()->reset(); 2749 FlagsState::GetInstance()->reset();
2750 } 2750 }
2751 2751
2752 void SetExperiments(const Experiment* e, size_t count) { 2752 void SetFeatureEntries(const FeatureEntry* entries, size_t count) {
2753 if (!e) { 2753 if (!entries) {
2754 experiments = kExperiments; 2754 g_entries = kFeatureEntries;
2755 num_experiments = arraysize(kExperiments); 2755 g_num_entries = arraysize(kFeatureEntries);
2756 } else { 2756 } else {
2757 experiments = e; 2757 g_entries = entries;
2758 num_experiments = count; 2758 g_num_entries = count;
2759 } 2759 }
2760 } 2760 }
2761 2761
2762 const Experiment* GetExperiments(size_t* count) { 2762 const FeatureEntry* GetFeatureEntries(size_t* count) {
2763 *count = num_experiments; 2763 *count = g_num_entries;
2764 return experiments; 2764 return g_entries;
2765 } 2765 }
2766 2766
2767 } // namespace testing 2767 } // namespace testing
2768 2768
2769 } // namespace about_flags 2769 } // namespace about_flags
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698