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