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