Chromium Code Reviews| 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 {IDS_FLAGS_ENABLE_DEFAULT_MEDIA_SESSION_ENABLED, | 633 {IDS_FLAGS_ENABLE_DEFAULT_MEDIA_SESSION_ENABLED, |
| 633 switches::kEnableDefaultMediaSession, ""}, | 634 switches::kEnableDefaultMediaSession, ""}, |
| 634 #if BUILDFLAG(ENABLE_PLUGINS) | 635 #if BUILDFLAG(ENABLE_PLUGINS) |
| 635 {IDS_FLAGS_ENABLE_DEFAULT_MEDIA_SESSION_ENABLED_DUCK_FLASH, | 636 {IDS_FLAGS_ENABLE_DEFAULT_MEDIA_SESSION_ENABLED_DUCK_FLASH, |
| 636 switches::kEnableDefaultMediaSession, | 637 switches::kEnableDefaultMediaSession, |
| 637 switches::kEnableDefaultMediaSessionDuckFlash}, | 638 switches::kEnableDefaultMediaSessionDuckFlash}, |
| 638 #endif // BUILDFLAG(ENABLE_PLUGINS) | 639 #endif // BUILDFLAG(ENABLE_PLUGINS) |
| 639 }; | 640 }; |
| 640 #endif // !defined(OS_ANDROID) | 641 #endif // !defined(OS_ANDROID) |
| 641 | 642 |
| 643 const FeatureEntry::FeatureParam kNoStatePrefetchEnabled[] = { | |
| 644 {prerender::kNoStatePrefetchFeatureModeParameterName, | |
| 645 prerender::kNoStatePrefetchFeatureModeParameterPrefetch}}; | |
| 646 | |
| 647 const FeatureEntry::FeatureParam kNoStatePrefetchPrerender[] = { | |
| 648 {prerender::kNoStatePrefetchFeatureModeParameterName, | |
| 649 prerender::kNoStatePrefetchFeatureModeParameterPrerender}}; | |
| 650 | |
| 651 const FeatureEntry::FeatureParam kNoStatePrefetchSimpleLoad[] = { | |
| 652 {prerender::kNoStatePrefetchFeatureModeParameterName, | |
| 653 prerender::kNoStatePrefetchFeatureModeParameterSimpleLoad}}; | |
| 654 | |
| 655 const FeatureEntry::FeatureVariation kNoStatePrefetchFeatureVariations[] = { | |
| 656 {"No-state prefetch", kNoStatePrefetchEnabled, | |
| 657 arraysize(kNoStatePrefetchEnabled), nullptr}, | |
| 658 {"Prerender", kNoStatePrefetchPrerender, | |
| 659 arraysize(kNoStatePrefetchPrerender), nullptr}, | |
| 660 {"Simple load", kNoStatePrefetchSimpleLoad, | |
| 661 arraysize(kNoStatePrefetchSimpleLoad), nullptr}}; | |
| 662 | |
| 642 // RECORDING USER METRICS FOR FLAGS: | 663 // RECORDING USER METRICS FOR FLAGS: |
| 643 // ----------------------------------------------------------------------------- | 664 // ----------------------------------------------------------------------------- |
| 644 // The first line of the entry is the internal name. | 665 // The first line of the entry is the internal name. |
| 645 // | 666 // |
| 646 // To add a new entry, add to the end of kFeatureEntries. There are two | 667 // To add a new entry, add to the end of kFeatureEntries. There are two |
| 647 // distinct types of entries: | 668 // distinct types of entries: |
| 648 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE | 669 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE |
| 649 // macro for this type supplying the command line to the macro. | 670 // macro for this type supplying the command line to the macro. |
| 650 // . MULTI_VALUE: a list of choices, the first of which should correspond to a | 671 // . MULTI_VALUE: a list of choices, the first of which should correspond to a |
| 651 // deactivated state for this lab (i.e. no command line option). To specify | 672 // deactivated state for this lab (i.e. no command line option). To specify |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2105 IDS_FLAGS_CROSS_PROCESS_GUEST_VIEW_ISOLATION_DESCRIPTION, kOsDesktop, | 2126 IDS_FLAGS_CROSS_PROCESS_GUEST_VIEW_ISOLATION_DESCRIPTION, kOsDesktop, |
| 2106 FEATURE_VALUE_TYPE(features::kGuestViewCrossProcessFrames)}, | 2127 FEATURE_VALUE_TYPE(features::kGuestViewCrossProcessFrames)}, |
| 2107 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 2128 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 2108 {"media-remoting", IDS_FLAGS_MEDIA_REMOTING_NAME, | 2129 {"media-remoting", IDS_FLAGS_MEDIA_REMOTING_NAME, |
| 2109 IDS_FLAGS_MEDIA_REMOTING_DESCRIPTION, kOsDesktop, | 2130 IDS_FLAGS_MEDIA_REMOTING_DESCRIPTION, kOsDesktop, |
| 2110 FEATURE_VALUE_TYPE(features::kMediaRemoting)}, | 2131 FEATURE_VALUE_TYPE(features::kMediaRemoting)}, |
| 2111 {"media-remoting-encrypted", IDS_FLAGS_MEDIA_REMOTING_ENCRYPTED_NAME, | 2132 {"media-remoting-encrypted", IDS_FLAGS_MEDIA_REMOTING_ENCRYPTED_NAME, |
| 2112 IDS_FLAGS_MEDIA_REMOTING_ENCRYPTED_DESCRIPTION, kOsDesktop, | 2133 IDS_FLAGS_MEDIA_REMOTING_ENCRYPTED_DESCRIPTION, kOsDesktop, |
| 2113 FEATURE_VALUE_TYPE(features::kMediaRemotingEncrypted)}, | 2134 FEATURE_VALUE_TYPE(features::kMediaRemotingEncrypted)}, |
| 2114 #endif | 2135 #endif |
| 2136 {"enable-nostate-prefetch", IDS_FLAGS_NOSTATE_PREFETCH, | |
| 2137 IDS_FLAGS_NOSTATE_PREFETCH_DESCRIPTION, kOsAll, | |
| 2138 FEATURE_WITH_VARIATIONS_VALUE_TYPE(prerender::kNoStatePrefetchFeature, | |
| 2139 kNoStatePrefetchFeatureVariations, | |
| 2140 "NoStatePrefetchValidation")}, | |
| 2115 | 2141 |
| 2116 // NOTE: Adding new command-line switches requires adding corresponding | 2142 // NOTE: Adding new command-line switches requires adding corresponding |
| 2117 // entries to enum "LoginCustomFlags" in histograms.xml. See note in | 2143 // entries to enum "LoginCustomFlags" in histograms.xml. See note in |
| 2118 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. | 2144 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. |
|
droger
2016/12/06 12:01:55
Note: I am not sure if I have to do this or not, s
droger
2016/12/07 14:08:09
+asvitkine: do you know what I should do here?
droger
2016/12/07 14:51:22
I think I figured it out and updated histograms.xm
| |
| 2119 }; | 2145 }; |
| 2120 | 2146 |
| 2121 class FlagsStateSingleton { | 2147 class FlagsStateSingleton { |
| 2122 public: | 2148 public: |
| 2123 FlagsStateSingleton() | 2149 FlagsStateSingleton() |
| 2124 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {} | 2150 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {} |
| 2125 ~FlagsStateSingleton() {} | 2151 ~FlagsStateSingleton() {} |
| 2126 | 2152 |
| 2127 static FlagsStateSingleton* GetInstance() { | 2153 static FlagsStateSingleton* GetInstance() { |
| 2128 return base::Singleton<FlagsStateSingleton>::get(); | 2154 return base::Singleton<FlagsStateSingleton>::get(); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2314 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; | 2340 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; |
| 2315 | 2341 |
| 2316 const FeatureEntry* GetFeatureEntries(size_t* count) { | 2342 const FeatureEntry* GetFeatureEntries(size_t* count) { |
| 2317 *count = arraysize(kFeatureEntries); | 2343 *count = arraysize(kFeatureEntries); |
| 2318 return kFeatureEntries; | 2344 return kFeatureEntries; |
| 2319 } | 2345 } |
| 2320 | 2346 |
| 2321 } // namespace testing | 2347 } // namespace testing |
| 2322 | 2348 |
| 2323 } // namespace about_flags | 2349 } // namespace about_flags |
| OLD | NEW |