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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // ----------------------------------------------------------------------------- | 192 // ----------------------------------------------------------------------------- |
193 // The first line of the experiment is the internal name. If you'd like to | 193 // The first line of the experiment is the internal name. If you'd like to |
194 // gather statistics about the usage of your flag, you should append a marker | 194 // gather statistics about the usage of your flag, you should append a marker |
195 // comment to the end of the feature name, like so: | 195 // comment to the end of the feature name, like so: |
196 // "my-special-feature", // FLAGS:RECORD_UMA | 196 // "my-special-feature", // FLAGS:RECORD_UMA |
197 // | 197 // |
198 // After doing that, run //chrome/tools/extract_actions.py (see instructions at | 198 // After doing that, run //chrome/tools/extract_actions.py (see instructions at |
199 // the top of that file for details) to update the chromeactions.txt file, which | 199 // the top of that file for details) to update the chromeactions.txt file, which |
200 // will enable UMA to record your feature flag. | 200 // will enable UMA to record your feature flag. |
201 // | 201 // |
202 // After your feature has shipped under a flag, you can locate the metrics | 202 // After your feature has shipped under a flag, you can locate the metrics under |
203 // under the action name AboutFlags_internal-action-name. Actions are recorded | 203 // the action name AboutFlags_internal-action-name. Actions are recorded once |
204 // once per startup, so you should divide this number by AboutFlags_StartupTick | 204 // per startup, so you should divide this number by AboutFlags_StartupTick to |
205 // to get a sense of usage. Note that this will not be the same as number of | 205 // get a sense of usage. Note that this will not be the same as number of users |
206 // users with a given feature enabled because users can quit and relaunch | 206 // with a given feature enabled because users can quit and relaunch the |
207 // the application multiple times over a given time interval. | 207 // application multiple times over a given time interval. The dashboard also |
208 // TODO(rsesek): See if there's a way to count per-user, rather than | 208 // shows you how many (metrics reporting) users have enabled the flag over the |
209 // per-startup. | 209 // last seven days. However, note that this is not the same as the number of |
| 210 // users who have the flag enabled, since enabling the flag happens once, |
| 211 // whereas running with the flag enabled happens until the user flips the flag |
| 212 // again. |
210 | 213 |
211 // To add a new experiment add to the end of kExperiments. There are two | 214 // To add a new experiment add to the end of kExperiments. There are two |
212 // distinct types of experiments: | 215 // distinct types of experiments: |
213 // . SINGLE_VALUE: experiment is either on or off. Use the SINGLE_VALUE_TYPE | 216 // . SINGLE_VALUE: experiment is either on or off. Use the SINGLE_VALUE_TYPE |
214 // macro for this type supplying the command line to the macro. | 217 // macro for this type supplying the command line to the macro. |
215 // . MULTI_VALUE: a list of choices, the first of which should correspond to a | 218 // . MULTI_VALUE: a list of choices, the first of which should correspond to a |
216 // deactivated state for this lab (i.e. no command line option). To specify | 219 // deactivated state for this lab (i.e. no command line option). To specify |
217 // this type of experiment use the macro MULTI_VALUE_TYPE supplying it the | 220 // this type of experiment use the macro MULTI_VALUE_TYPE supplying it the |
218 // array of choices. | 221 // array of choices. |
219 // See the documentation of Experiment for details on the fields. | 222 // See the documentation of Experiment for details on the fields. |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 kOsWin | kOsLinux | kOsCrOS, | 978 kOsWin | kOsLinux | kOsCrOS, |
976 SINGLE_VALUE_TYPE(switches::kEnablePasswordGeneration) | 979 SINGLE_VALUE_TYPE(switches::kEnablePasswordGeneration) |
977 }, | 980 }, |
978 { | 981 { |
979 "crash-on-gpu-hang", | 982 "crash-on-gpu-hang", |
980 IDS_FLAGS_CRASH_ON_GPU_HANG_NAME, | 983 IDS_FLAGS_CRASH_ON_GPU_HANG_NAME, |
981 IDS_FLAGS_CRASH_ON_GPU_HANG_DESCRIPTION, | 984 IDS_FLAGS_CRASH_ON_GPU_HANG_DESCRIPTION, |
982 kOsAll, | 985 kOsAll, |
983 SINGLE_VALUE_TYPE(switches::kCrashOnGpuHang) | 986 SINGLE_VALUE_TYPE(switches::kCrashOnGpuHang) |
984 }, | 987 }, |
| 988 { |
| 989 "enable-new-autofill-ui", |
| 990 IDS_FLAGS_ENABLE_NEW_AUTOFILL_UI_NAME, |
| 991 IDS_FLAGS_ENABLE_NEW_AUTOFILL_UI_DESCRIPTION, |
| 992 kOsWin | kOsLinux, |
| 993 SINGLE_VALUE_TYPE(switches::kEnableNewAutofillUi) |
| 994 }, |
| 995 { |
| 996 "enable-new-autofill-heuristics", |
| 997 IDS_FLAGS_ENABLE_NEW_AUTOFILL_HEURISTICS_NAME, |
| 998 IDS_FLAGS_ENABLE_NEW_AUTOFILL_HEURISTICS_DESCRIPTION, |
| 999 kOsAll, |
| 1000 SINGLE_VALUE_TYPE(switches::kEnableNewAutofillHeuristics) |
| 1001 }, |
985 }; | 1002 }; |
986 | 1003 |
987 const Experiment* experiments = kExperiments; | 1004 const Experiment* experiments = kExperiments; |
988 size_t num_experiments = arraysize(kExperiments); | 1005 size_t num_experiments = arraysize(kExperiments); |
989 | 1006 |
990 // Stores and encapsulates the little state that about:flags has. | 1007 // Stores and encapsulates the little state that about:flags has. |
991 class FlagsState { | 1008 class FlagsState { |
992 public: | 1009 public: |
993 FlagsState() : needs_restart_(false) {} | 1010 FlagsState() : needs_restart_(false) {} |
994 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line); | 1011 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line); |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 } | 1428 } |
1412 | 1429 |
1413 const Experiment* GetExperiments(size_t* count) { | 1430 const Experiment* GetExperiments(size_t* count) { |
1414 *count = num_experiments; | 1431 *count = num_experiments; |
1415 return experiments; | 1432 return experiments; |
1416 } | 1433 } |
1417 | 1434 |
1418 } // namespace testing | 1435 } // namespace testing |
1419 | 1436 |
1420 } // namespace about_flags | 1437 } // namespace about_flags |
OLD | NEW |