| 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> | 
| 11 | 11 | 
| 12 #include "base/bind.h" | 12 #include "base/bind.h" | 
| 13 #include "base/callback.h" | 13 #include "base/callback.h" | 
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" | 
| 15 #include "base/feature_list.h" | 15 #include "base/feature_list.h" | 
| 16 #include "base/i18n/base_i18n_switches.h" | 16 #include "base/i18n/base_i18n_switches.h" | 
| 17 #include "base/macros.h" | 17 #include "base/macros.h" | 
| 18 #include "base/memory/singleton.h" | 18 #include "base/memory/singleton.h" | 
| 19 #include "base/metrics/histogram_macros.h" | 19 #include "base/metrics/histogram_macros.h" | 
| 20 #include "base/metrics/metrics_hashes.h" | 20 #include "base/metrics/metrics_hashes.h" | 
| 21 #include "base/stl_util.h" | 21 #include "base/stl_util.h" | 
| 22 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" | 
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" | 
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" | 
| 25 #include "base/task_scheduler/switches.h" | 25 #include "base/task_scheduler/switches.h" | 
| 26 #include "base/values.h" | 26 #include "base/values.h" | 
| 27 #include "build/build_config.h" | 27 #include "build/build_config.h" | 
| 28 #include "cc/base/switches.h" | 28 #include "cc/base/switches.h" | 
| 29 #include "chrome/browser/ntp_snippets/ntp_snippets_features.h" | 29 #include "chrome/browser/ntp_snippets/ntp_snippets_features.h" | 
|  | 30 #include "chrome/browser/page_load_metrics/experiments/delay_navigation_throttle
      .h" | 
| 30 #include "chrome/browser/predictors/resource_prefetch_common.h" | 31 #include "chrome/browser/predictors/resource_prefetch_common.h" | 
| 31 #include "chrome/browser/prerender/prerender_field_trial.h" | 32 #include "chrome/browser/prerender/prerender_field_trial.h" | 
| 32 #include "chrome/common/channel_info.h" | 33 #include "chrome/common/channel_info.h" | 
| 33 #include "chrome/common/chrome_content_client.h" | 34 #include "chrome/common/chrome_content_client.h" | 
| 34 #include "chrome/common/chrome_features.h" | 35 #include "chrome/common/chrome_features.h" | 
| 35 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" | 
| 36 #include "chrome/common/features.h" | 37 #include "chrome/common/features.h" | 
| 37 #include "chrome/grit/chromium_strings.h" | 38 #include "chrome/grit/chromium_strings.h" | 
| 38 #include "chrome/grit/generated_resources.h" | 39 #include "chrome/grit/generated_resources.h" | 
| 39 #include "components/autofill/core/browser/autofill_experiments.h" | 40 #include "components/autofill/core/browser/autofill_experiments.h" | 
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 749     kAutofillCreditCardLastUsedDateFeatureVariationExpDate[] = { | 750     kAutofillCreditCardLastUsedDateFeatureVariationExpDate[] = { | 
| 750         {"show_expiration_date", "true"}}; | 751         {"show_expiration_date", "true"}}; | 
| 751 | 752 | 
| 752 const FeatureEntry::FeatureVariation | 753 const FeatureEntry::FeatureVariation | 
| 753     kAutofillCreditCardLastUsedDateFeatureVariations[] = { | 754     kAutofillCreditCardLastUsedDateFeatureVariations[] = { | 
| 754         {"Display expiration date", | 755         {"Display expiration date", | 
| 755          kAutofillCreditCardLastUsedDateFeatureVariationExpDate, | 756          kAutofillCreditCardLastUsedDateFeatureVariationExpDate, | 
| 756          arraysize(kAutofillCreditCardLastUsedDateFeatureVariationExpDate), | 757          arraysize(kAutofillCreditCardLastUsedDateFeatureVariationExpDate), | 
| 757          nullptr}}; | 758          nullptr}}; | 
| 758 | 759 | 
|  | 760 const FeatureEntry::FeatureParam kDelayNavigation5SecondDelay[] = { | 
|  | 761     {DelayNavigationThrottle::kParamDelayNavigationDurationMillis, "5000"}, | 
|  | 762     {DelayNavigationThrottle::kParamDelayNavigationProbability, "1"}}; | 
|  | 763 | 
|  | 764 const FeatureEntry::FeatureParam kDelayNavigation5SecondDelay25Percent[] = { | 
|  | 765     {DelayNavigationThrottle::kParamDelayNavigationDurationMillis, "5000"}, | 
|  | 766     {DelayNavigationThrottle::kParamDelayNavigationProbability, "0.25"}}; | 
|  | 767 | 
|  | 768 const FeatureEntry::FeatureParam kDelayNavigation5SecondDelayRandomize[] = { | 
|  | 769     {DelayNavigationThrottle::kParamDelayNavigationDurationMillis, "5000"}, | 
|  | 770     {DelayNavigationThrottle::kParamDelayNavigationProbability, "1"}, | 
|  | 771     {DelayNavigationThrottle::kParamDelayNavigationRandomize, "true"}}; | 
|  | 772 | 
|  | 773 const FeatureEntry::FeatureVariation kDelayNavigationFeatureVariations[] = { | 
|  | 774     {"(5 second delay, 100% probability)", kDelayNavigation5SecondDelay, | 
|  | 775      arraysize(kDelayNavigation5SecondDelay), nullptr}, | 
|  | 776     {"(5 second delay, 25% probability)", kDelayNavigation5SecondDelay25Percent, | 
|  | 777      arraysize(kDelayNavigation5SecondDelay25Percent), nullptr}, | 
|  | 778     {"(0-5 second randomized delay)", kDelayNavigation5SecondDelayRandomize, | 
|  | 779      arraysize(kDelayNavigation5SecondDelayRandomize), nullptr}}; | 
|  | 780 | 
| 759 // RECORDING USER METRICS FOR FLAGS: | 781 // RECORDING USER METRICS FOR FLAGS: | 
| 760 // ----------------------------------------------------------------------------- | 782 // ----------------------------------------------------------------------------- | 
| 761 // The first line of the entry is the internal name. | 783 // The first line of the entry is the internal name. | 
| 762 // | 784 // | 
| 763 // To add a new entry, add to the end of kFeatureEntries. There are two | 785 // To add a new entry, add to the end of kFeatureEntries. There are two | 
| 764 // distinct types of entries: | 786 // distinct types of entries: | 
| 765 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE | 787 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE | 
| 766 //   macro for this type supplying the command line to the macro. | 788 //   macro for this type supplying the command line to the macro. | 
| 767 // . MULTI_VALUE: a list of choices, the first of which should correspond to a | 789 // . MULTI_VALUE: a list of choices, the first of which should correspond to a | 
| 768 //   deactivated state for this lab (i.e. no command line option).  To specify | 790 //   deactivated state for this lab (i.e. no command line option).  To specify | 
| (...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2390      IDS_FLAGS_FORCE_TABLET_MODE_DESCRIPTION, kOsCrOS, | 2412      IDS_FLAGS_FORCE_TABLET_MODE_DESCRIPTION, kOsCrOS, | 
| 2391      MULTI_VALUE_TYPE(kForceTabletModeChoices)}, | 2413      MULTI_VALUE_TYPE(kForceTabletModeChoices)}, | 
| 2392 #endif  // OS_CHROMEOS | 2414 #endif  // OS_CHROMEOS | 
| 2393 | 2415 | 
| 2394 #if defined(OS_ANDROID) | 2416 #if defined(OS_ANDROID) | 
| 2395     {"use-new-doodle-api", IDS_FLAGS_USE_NEW_DOODLE_API_NAME, | 2417     {"use-new-doodle-api", IDS_FLAGS_USE_NEW_DOODLE_API_NAME, | 
| 2396      IDS_FLAGS_USE_NEW_DOODLE_API_DESCRIPTION, kOsAndroid, | 2418      IDS_FLAGS_USE_NEW_DOODLE_API_DESCRIPTION, kOsAndroid, | 
| 2397      FEATURE_VALUE_TYPE(chrome::android::kUseNewDoodleApi)}, | 2419      FEATURE_VALUE_TYPE(chrome::android::kUseNewDoodleApi)}, | 
| 2398 #endif  // OS_ANDROID | 2420 #endif  // OS_ANDROID | 
| 2399 | 2421 | 
|  | 2422     {"delay-navigation", IDS_FLAGS_DELAY_NAVIGATION_NAME, | 
|  | 2423      IDS_FLAGS_DELAY_NAVIGATION_DESCRIPTION, kOsAll, | 
|  | 2424      FEATURE_WITH_PARAMS_VALUE_TYPE(kDelayNavigationFeature, | 
|  | 2425                                     kDelayNavigationFeatureVariations, | 
|  | 2426                                     "DelayNavigation")}, | 
|  | 2427 | 
| 2400     // NOTE: Adding new command-line switches requires adding corresponding | 2428     // NOTE: Adding new command-line switches requires adding corresponding | 
| 2401     // entries to enum "LoginCustomFlags" in histograms.xml. See note in | 2429     // entries to enum "LoginCustomFlags" in histograms.xml. See note in | 
| 2402     // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. | 2430     // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. | 
| 2403 }; | 2431 }; | 
| 2404 | 2432 | 
| 2405 class FlagsStateSingleton { | 2433 class FlagsStateSingleton { | 
| 2406  public: | 2434  public: | 
| 2407   FlagsStateSingleton() | 2435   FlagsStateSingleton() | 
| 2408       : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {} | 2436       : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {} | 
| 2409   ~FlagsStateSingleton() {} | 2437   ~FlagsStateSingleton() {} | 
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2598 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; | 2626 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; | 
| 2599 | 2627 | 
| 2600 const FeatureEntry* GetFeatureEntries(size_t* count) { | 2628 const FeatureEntry* GetFeatureEntries(size_t* count) { | 
| 2601   *count = arraysize(kFeatureEntries); | 2629   *count = arraysize(kFeatureEntries); | 
| 2602   return kFeatureEntries; | 2630   return kFeatureEntries; | 
| 2603 } | 2631 } | 
| 2604 | 2632 | 
| 2605 }  // namespace testing | 2633 }  // namespace testing | 
| 2606 | 2634 | 
| 2607 }  // namespace about_flags | 2635 }  // namespace about_flags | 
| OLD | NEW | 
|---|