Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2754)

Side by Side Diff: chrome/browser/about_flags.cc

Issue 2763613002: Add DelayNavigationThrottle (Closed)
Patch Set: address some comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/loader/delay_navigation_throttle.h"
29 #include "chrome/browser/ntp_snippets/ntp_snippets_features.h" 30 #include "chrome/browser/ntp_snippets/ntp_snippets_features.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"
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 kAutofillCreditCardLastUsedDateFeatureVariationExpDate[] = { 757 kAutofillCreditCardLastUsedDateFeatureVariationExpDate[] = {
757 {"show_expiration_date", "true"}}; 758 {"show_expiration_date", "true"}};
758 759
759 const FeatureEntry::FeatureVariation 760 const FeatureEntry::FeatureVariation
760 kAutofillCreditCardLastUsedDateFeatureVariations[] = { 761 kAutofillCreditCardLastUsedDateFeatureVariations[] = {
761 {"Display expiration date", 762 {"Display expiration date",
762 kAutofillCreditCardLastUsedDateFeatureVariationExpDate, 763 kAutofillCreditCardLastUsedDateFeatureVariationExpDate,
763 arraysize(kAutofillCreditCardLastUsedDateFeatureVariationExpDate), 764 arraysize(kAutofillCreditCardLastUsedDateFeatureVariationExpDate),
764 nullptr}}; 765 nullptr}};
765 766
767 const FeatureEntry::FeatureParam kDelayNavigation5SecondDelay[] = {
768 {DelayNavigationThrottle::kParamDelayNavigationDurationMillis, "5000"},
Charlie Harrison 2017/03/22 18:06:44 5s seems extreme. Is that going to be an experimen
769 {DelayNavigationThrottle::kParamDelayNavigationProbability, "1"}};
770
771 const FeatureEntry::FeatureParam kDelayNavigation5SecondDelay25Percent[] = {
772 {DelayNavigationThrottle::kParamDelayNavigationDurationMillis, "5000"},
773 {DelayNavigationThrottle::kParamDelayNavigationProbability, "0.25"}};
774
775 const FeatureEntry::FeatureVariation kDelayNavigationFeatureVariations[] = {
776 {"(5 second delay, 100% probability)", kDelayNavigation5SecondDelay,
777 arraysize(kDelayNavigation5SecondDelay), nullptr},
778 {"(5 second delay, 25% probability)", kDelayNavigation5SecondDelay25Percent,
779 arraysize(kDelayNavigation5SecondDelay25Percent), nullptr}};
780
766 // RECORDING USER METRICS FOR FLAGS: 781 // RECORDING USER METRICS FOR FLAGS:
767 // ----------------------------------------------------------------------------- 782 // -----------------------------------------------------------------------------
768 // The first line of the entry is the internal name. 783 // The first line of the entry is the internal name.
769 // 784 //
770 // 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
771 // distinct types of entries: 786 // distinct types of entries:
772 // . 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
773 // macro for this type supplying the command line to the macro. 788 // macro for this type supplying the command line to the macro.
774 // . 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
775 // 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 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after
2400 IDS_FLAGS_FORCE_TABLET_MODE_DESCRIPTION, kOsCrOS, 2415 IDS_FLAGS_FORCE_TABLET_MODE_DESCRIPTION, kOsCrOS,
2401 MULTI_VALUE_TYPE(kForceTabletModeChoices)}, 2416 MULTI_VALUE_TYPE(kForceTabletModeChoices)},
2402 #endif // OS_CHROMEOS 2417 #endif // OS_CHROMEOS
2403 2418
2404 #if defined(OS_ANDROID) 2419 #if defined(OS_ANDROID)
2405 {"use-new-doodle-api", IDS_FLAGS_USE_NEW_DOODLE_API_NAME, 2420 {"use-new-doodle-api", IDS_FLAGS_USE_NEW_DOODLE_API_NAME,
2406 IDS_FLAGS_USE_NEW_DOODLE_API_DESCRIPTION, kOsAndroid, 2421 IDS_FLAGS_USE_NEW_DOODLE_API_DESCRIPTION, kOsAndroid,
2407 FEATURE_VALUE_TYPE(chrome::android::kUseNewDoodleApi)}, 2422 FEATURE_VALUE_TYPE(chrome::android::kUseNewDoodleApi)},
2408 #endif // OS_ANDROID 2423 #endif // OS_ANDROID
2409 2424
2425 {"delay-navigation", IDS_FLAGS_DELAY_NAVIGATION_NAME,
2426 IDS_FLAGS_DELAY_NAVIGATION_DESCRIPTION, kOsAll,
2427 FEATURE_WITH_PARAMS_VALUE_TYPE(kDelayNavigationFeature,
2428 kDelayNavigationFeatureVariations,
2429 "DelayNavigation")},
2430
2410 // NOTE: Adding new command-line switches requires adding corresponding 2431 // NOTE: Adding new command-line switches requires adding corresponding
2411 // entries to enum "LoginCustomFlags" in histograms.xml. See note in 2432 // entries to enum "LoginCustomFlags" in histograms.xml. See note in
2412 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. 2433 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test.
2413 }; 2434 };
2414 2435
2415 class FlagsStateSingleton { 2436 class FlagsStateSingleton {
2416 public: 2437 public:
2417 FlagsStateSingleton() 2438 FlagsStateSingleton()
2418 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {} 2439 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {}
2419 ~FlagsStateSingleton() {} 2440 ~FlagsStateSingleton() {}
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; 2629 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0;
2609 2630
2610 const FeatureEntry* GetFeatureEntries(size_t* count) { 2631 const FeatureEntry* GetFeatureEntries(size_t* count) {
2611 *count = arraysize(kFeatureEntries); 2632 *count = arraysize(kFeatureEntries);
2612 return kFeatureEntries; 2633 return kFeatureEntries;
2613 } 2634 }
2614 2635
2615 } // namespace testing 2636 } // namespace testing
2616 2637
2617 } // namespace about_flags 2638 } // namespace about_flags
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698