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/prerender/prerender_field_trial.h" |
29 #include "chrome/common/channel_info.h" | 30 #include "chrome/common/channel_info.h" |
30 #include "chrome/common/chrome_content_client.h" | 31 #include "chrome/common/chrome_content_client.h" |
31 #include "chrome/common/chrome_features.h" | 32 #include "chrome/common/chrome_features.h" |
32 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/features.h" | 34 #include "chrome/common/features.h" |
34 #include "chrome/grit/chromium_strings.h" | 35 #include "chrome/grit/chromium_strings.h" |
35 #include "chrome/grit/generated_resources.h" | 36 #include "chrome/grit/generated_resources.h" |
36 #include "components/autofill/core/browser/autofill_experiments.h" | 37 #include "components/autofill/core/browser/autofill_experiments.h" |
37 #include "components/autofill/core/common/autofill_switches.h" | 38 #include "components/autofill/core/common/autofill_switches.h" |
38 #include "components/browser_sync/browser_sync_switches.h" | 39 #include "components/browser_sync/browser_sync_switches.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 {IDS_FLAGS_ENABLE_DEFAULT_MEDIA_SESSION_ENABLED, | 635 {IDS_FLAGS_ENABLE_DEFAULT_MEDIA_SESSION_ENABLED, |
635 switches::kEnableDefaultMediaSession, ""}, | 636 switches::kEnableDefaultMediaSession, ""}, |
636 #if BUILDFLAG(ENABLE_PLUGINS) | 637 #if BUILDFLAG(ENABLE_PLUGINS) |
637 {IDS_FLAGS_ENABLE_DEFAULT_MEDIA_SESSION_ENABLED_DUCK_FLASH, | 638 {IDS_FLAGS_ENABLE_DEFAULT_MEDIA_SESSION_ENABLED_DUCK_FLASH, |
638 switches::kEnableDefaultMediaSession, | 639 switches::kEnableDefaultMediaSession, |
639 switches::kEnableDefaultMediaSessionDuckFlash}, | 640 switches::kEnableDefaultMediaSessionDuckFlash}, |
640 #endif // BUILDFLAG(ENABLE_PLUGINS) | 641 #endif // BUILDFLAG(ENABLE_PLUGINS) |
641 }; | 642 }; |
642 #endif // !defined(OS_ANDROID) | 643 #endif // !defined(OS_ANDROID) |
643 | 644 |
| 645 const FeatureEntry::FeatureParam kNoStatePrefetchEnabled[] = { |
| 646 {prerender::kNoStatePrefetchFeatureModeParameterName, |
| 647 prerender::kNoStatePrefetchFeatureModeParameterPrefetch}}; |
| 648 |
| 649 const FeatureEntry::FeatureParam kNoStatePrefetchPrerender[] = { |
| 650 {prerender::kNoStatePrefetchFeatureModeParameterName, |
| 651 prerender::kNoStatePrefetchFeatureModeParameterPrerender}}; |
| 652 |
| 653 const FeatureEntry::FeatureParam kNoStatePrefetchSimpleLoad[] = { |
| 654 {prerender::kNoStatePrefetchFeatureModeParameterName, |
| 655 prerender::kNoStatePrefetchFeatureModeParameterSimpleLoad}}; |
| 656 |
| 657 const FeatureEntry::FeatureVariation kNoStatePrefetchFeatureVariations[] = { |
| 658 {"No-state prefetch", kNoStatePrefetchEnabled, |
| 659 arraysize(kNoStatePrefetchEnabled), nullptr}, |
| 660 {"Prerender", kNoStatePrefetchPrerender, |
| 661 arraysize(kNoStatePrefetchPrerender), nullptr}, |
| 662 {"Simple load", kNoStatePrefetchSimpleLoad, |
| 663 arraysize(kNoStatePrefetchSimpleLoad), nullptr}}; |
| 664 |
644 // RECORDING USER METRICS FOR FLAGS: | 665 // RECORDING USER METRICS FOR FLAGS: |
645 // ----------------------------------------------------------------------------- | 666 // ----------------------------------------------------------------------------- |
646 // The first line of the entry is the internal name. | 667 // The first line of the entry is the internal name. |
647 // | 668 // |
648 // To add a new entry, add to the end of kFeatureEntries. There are two | 669 // To add a new entry, add to the end of kFeatureEntries. There are two |
649 // distinct types of entries: | 670 // distinct types of entries: |
650 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE | 671 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE |
651 // macro for this type supplying the command line to the macro. | 672 // macro for this type supplying the command line to the macro. |
652 // . MULTI_VALUE: a list of choices, the first of which should correspond to a | 673 // . MULTI_VALUE: a list of choices, the first of which should correspond to a |
653 // deactivated state for this lab (i.e. no command line option). To specify | 674 // deactivated state for this lab (i.e. no command line option). To specify |
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 FEATURE_VALUE_TYPE(media::kVideoFullscreenOrientationLock)}, | 2131 FEATURE_VALUE_TYPE(media::kVideoFullscreenOrientationLock)}, |
2111 #endif | 2132 #endif |
2112 #if defined(OS_CHROMEOS) | 2133 #if defined(OS_CHROMEOS) |
2113 {"cros-comp-updates", IDS_FLAGS_CROS_COMP_UPDATES_NAME, | 2134 {"cros-comp-updates", IDS_FLAGS_CROS_COMP_UPDATES_NAME, |
2114 IDS_FLAGS_CROS_COMP_UPDATES_DESCRIPTION, kOsCrOS, | 2135 IDS_FLAGS_CROS_COMP_UPDATES_DESCRIPTION, kOsCrOS, |
2115 FEATURE_VALUE_TYPE(features::kCrosCompUpdates)}, | 2136 FEATURE_VALUE_TYPE(features::kCrosCompUpdates)}, |
2116 {"component-flash-only", IDS_FLAGS_COMPONENT_FLASH_ONLY_NAME, | 2137 {"component-flash-only", IDS_FLAGS_COMPONENT_FLASH_ONLY_NAME, |
2117 IDS_FLAGS_COMPONENT_FLASH_ONLY_DESCRIPTION, kOsCrOS, | 2138 IDS_FLAGS_COMPONENT_FLASH_ONLY_DESCRIPTION, kOsCrOS, |
2118 FEATURE_VALUE_TYPE(features::kComponentFlashOnly)}, | 2139 FEATURE_VALUE_TYPE(features::kComponentFlashOnly)}, |
2119 #endif | 2140 #endif |
| 2141 {"enable-nostate-prefetch", IDS_FLAGS_NOSTATE_PREFETCH, |
| 2142 IDS_FLAGS_NOSTATE_PREFETCH_DESCRIPTION, kOsAll, |
| 2143 FEATURE_WITH_VARIATIONS_VALUE_TYPE(prerender::kNoStatePrefetchFeature, |
| 2144 kNoStatePrefetchFeatureVariations, |
| 2145 "NoStatePrefetchValidation")}, |
2120 | 2146 |
2121 // NOTE: Adding new command-line switches requires adding corresponding | 2147 // NOTE: Adding new command-line switches requires adding corresponding |
2122 // entries to enum "LoginCustomFlags" in histograms.xml. See note in | 2148 // entries to enum "LoginCustomFlags" in histograms.xml. See note in |
2123 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. | 2149 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. |
2124 }; | 2150 }; |
2125 | 2151 |
2126 class FlagsStateSingleton { | 2152 class FlagsStateSingleton { |
2127 public: | 2153 public: |
2128 FlagsStateSingleton() | 2154 FlagsStateSingleton() |
2129 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {} | 2155 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {} |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2319 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; | 2345 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; |
2320 | 2346 |
2321 const FeatureEntry* GetFeatureEntries(size_t* count) { | 2347 const FeatureEntry* GetFeatureEntries(size_t* count) { |
2322 *count = arraysize(kFeatureEntries); | 2348 *count = arraysize(kFeatureEntries); |
2323 return kFeatureEntries; | 2349 return kFeatureEntries; |
2324 } | 2350 } |
2325 | 2351 |
2326 } // namespace testing | 2352 } // namespace testing |
2327 | 2353 |
2328 } // namespace about_flags | 2354 } // namespace about_flags |
OLD | NEW |