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

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

Issue 2805683003: Allow for pausing background tabs on desktop via about:flags. (Closed)
Patch Set: Use base::FeatureList and include the engagement values. Created 3 years, 8 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
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>
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/flag_descriptions.h" 29 #include "chrome/browser/flag_descriptions.h"
30 #include "chrome/browser/ntp_snippets/ntp_snippets_features.h" 30 #include "chrome/browser/ntp_snippets/ntp_snippets_features.h"
31 #include "chrome/browser/page_load_metrics/experiments/delay_navigation_throttle .h" 31 #include "chrome/browser/page_load_metrics/experiments/delay_navigation_throttle .h"
32 #include "chrome/browser/predictors/resource_prefetch_common.h" 32 #include "chrome/browser/predictors/resource_prefetch_common.h"
33 #include "chrome/browser/prerender/prerender_field_trial.h" 33 #include "chrome/browser/prerender/prerender_field_trial.h"
34 #include "chrome/common/channel_info.h" 34 #include "chrome/common/channel_info.h"
35 #include "chrome/common/chrome_content_client.h" 35 #include "chrome/common/chrome_content_client.h"
36 #include "chrome/common/chrome_features.h" 36 #include "chrome/common/chrome_features.h"
37 #include "chrome/common/chrome_switches.h" 37 #include "chrome/common/chrome_switches.h"
38 #include "chrome/common/features.h" 38 #include "chrome/common/features.h"
39 #include "chrome/common/pause_tabs_field_trial.h"
39 #include "chrome/grit/chromium_strings.h" 40 #include "chrome/grit/chromium_strings.h"
40 #include "components/autofill/core/browser/autofill_experiments.h" 41 #include "components/autofill/core/browser/autofill_experiments.h"
41 #include "components/autofill/core/common/autofill_switches.h" 42 #include "components/autofill/core/common/autofill_switches.h"
42 #include "components/browser_sync/browser_sync_switches.h" 43 #include "components/browser_sync/browser_sync_switches.h"
43 #include "components/cloud_devices/common/cloud_devices_switches.h" 44 #include "components/cloud_devices/common/cloud_devices_switches.h"
44 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_featu res.h" 45 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_featu res.h"
45 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc hes.h" 46 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc hes.h"
46 #include "components/dom_distiller/core/dom_distiller_switches.h" 47 #include "components/dom_distiller/core/dom_distiller_switches.h"
47 #include "components/error_page/common/error_page_switches.h" 48 #include "components/error_page/common/error_page_switches.h"
48 #include "components/flags_ui/feature_entry.h" 49 #include "components/flags_ui/feature_entry.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 const FeatureEntry::FeatureParam kSpeculativeResourcePrefetchingLearning[] = { 704 const FeatureEntry::FeatureParam kSpeculativeResourcePrefetchingLearning[] = {
704 {predictors::kModeParamName, predictors::kLearningMode}}; 705 {predictors::kModeParamName, predictors::kLearningMode}};
705 706
706 const FeatureEntry::FeatureVariation 707 const FeatureEntry::FeatureVariation
707 kSpeculativeResourcePrefetchingFeatureVariations[] = { 708 kSpeculativeResourcePrefetchingFeatureVariations[] = {
708 {"Prefetching", kSpeculativeResourcePrefetchingPrefetching, 709 {"Prefetching", kSpeculativeResourcePrefetchingPrefetching,
709 arraysize(kSpeculativeResourcePrefetchingPrefetching), nullptr}, 710 arraysize(kSpeculativeResourcePrefetchingPrefetching), nullptr},
710 {"Learning", kSpeculativeResourcePrefetchingLearning, 711 {"Learning", kSpeculativeResourcePrefetchingLearning,
711 arraysize(kSpeculativeResourcePrefetchingLearning), nullptr}}; 712 arraysize(kSpeculativeResourcePrefetchingLearning), nullptr}};
712 713
714 const FeatureEntry::FeatureParam kPauseBackgroundTabsMinimalEngagment[] = {
715 {pausetabs::kPauseBackgroundTabsFeatureParameterName,
716 pausetabs::kPauseBackgroundTabsFeatureModeParameterMinimal}};
717
718 const FeatureEntry::FeatureParam kPauseBackgroundTabsLowEngagment[] = {
719 {pausetabs::kPauseBackgroundTabsFeatureParameterName,
720 pausetabs::kPauseBackgroundTabsFeatureModeParameterLow}};
721
722 const FeatureEntry::FeatureParam kPauseBackgroundTabsMediumEngagment[] = {
723 {pausetabs::kPauseBackgroundTabsFeatureParameterName,
724 pausetabs::kPauseBackgroundTabsFeatureModeParameterMedium}};
725
726 const FeatureEntry::FeatureParam kPauseBackgroundTabsHighEngagment[] = {
727 {pausetabs::kPauseBackgroundTabsFeatureParameterName,
728 pausetabs::kPauseBackgroundTabsFeatureModeParameterHigh}};
729
730 const FeatureEntry::FeatureParam kPauseBackgroundTabsMaxEngagment[] = {
731 {pausetabs::kPauseBackgroundTabsFeatureParameterName,
732 pausetabs::kPauseBackgroundTabsFeatureModeParameterMax}};
733
734 const FeatureEntry::FeatureVariation kPauseBackgroundTabsVariations[] = {
735 {"minimal engagement", kPauseBackgroundTabsMinimalEngagment,
736 arraysize(kPauseBackgroundTabsMinimalEngagment), nullptr},
737 {"low engagement", kPauseBackgroundTabsLowEngagment,
738 arraysize(kPauseBackgroundTabsLowEngagment), nullptr},
739 {"medium engagement", kPauseBackgroundTabsMediumEngagment,
740 arraysize(kPauseBackgroundTabsMediumEngagment), nullptr},
741 {"high engagement", kPauseBackgroundTabsHighEngagment,
742 arraysize(kPauseBackgroundTabsHighEngagment), nullptr},
743 {"max engagement", kPauseBackgroundTabsMaxEngagment,
744 arraysize(kPauseBackgroundTabsMaxEngagment), nullptr}};
745
713 #if defined(OS_ANDROID) 746 #if defined(OS_ANDROID)
714 const FeatureEntry::FeatureParam 747 const FeatureEntry::FeatureParam
715 kAutofillCreditCardPopupLayoutFeatureVariationIconAtStart[] = { 748 kAutofillCreditCardPopupLayoutFeatureVariationIconAtStart[] = {
716 {"is_credit_card_icon_at_start", "true"}}; 749 {"is_credit_card_icon_at_start", "true"}};
717 750
718 const FeatureEntry::FeatureParam 751 const FeatureEntry::FeatureParam
719 kAutofillCreditCardPopupLayoutFeatureVariationDropdownItemHeight[] = { 752 kAutofillCreditCardPopupLayoutFeatureVariationDropdownItemHeight[] = {
720 {"dropdown_item_height", "56"}}; 753 {"dropdown_item_height", "56"}};
721 754
722 const FeatureEntry::FeatureParam 755 const FeatureEntry::FeatureParam
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after
2565 kDelayNavigationFeatureVariations, 2598 kDelayNavigationFeatureVariations,
2566 "DelayNavigation")}, 2599 "DelayNavigation")},
2567 2600
2568 #if defined(OS_ANDROID) 2601 #if defined(OS_ANDROID)
2569 {"enable-custom-context-menu", 2602 {"enable-custom-context-menu",
2570 flag_descriptions::kEnableCustomContextMenuName, 2603 flag_descriptions::kEnableCustomContextMenuName,
2571 flag_descriptions::kEnableCustomContextMenuDescription, kOsAndroid, 2604 flag_descriptions::kEnableCustomContextMenuDescription, kOsAndroid,
2572 FEATURE_VALUE_TYPE(chrome::android::kCustomContextMenu)}, 2605 FEATURE_VALUE_TYPE(chrome::android::kCustomContextMenu)},
2573 #endif // OS_ANDROID 2606 #endif // OS_ANDROID
2574 2607
2608 #if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX) || \
2609 defined(OS_WIN)
2610 {"pause-background-tabs", flag_descriptions::kPauseBackgroundTabsName,
2611 flag_descriptions::kPauseBackgroundTabsDescription, kOsDesktop,
2612 FEATURE_WITH_PARAMS_VALUE_TYPE(pausetabs::kPauseBackgroundTabsFeature,
2613 kPauseBackgroundTabsVariations,
2614 "PauseBackgroundTabs")},
2615 #endif
2616
2575 // NOTE: Adding new command-line switches requires adding corresponding 2617 // NOTE: Adding new command-line switches requires adding corresponding
2576 // entries to enum "LoginCustomFlags" in histograms.xml. See note in 2618 // entries to enum "LoginCustomFlags" in histograms.xml. See note in
2577 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. 2619 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test.
2578 }; 2620 };
2579 2621
2580 class FlagsStateSingleton { 2622 class FlagsStateSingleton {
2581 public: 2623 public:
2582 FlagsStateSingleton() 2624 FlagsStateSingleton()
2583 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {} 2625 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {}
2584 ~FlagsStateSingleton() {} 2626 ~FlagsStateSingleton() {}
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; 2815 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0;
2774 2816
2775 const FeatureEntry* GetFeatureEntries(size_t* count) { 2817 const FeatureEntry* GetFeatureEntries(size_t* count) {
2776 *count = arraysize(kFeatureEntries); 2818 *count = arraysize(kFeatureEntries);
2777 return kFeatureEntries; 2819 return kFeatureEntries;
2778 } 2820 }
2779 2821
2780 } // namespace testing 2822 } // namespace testing
2781 2823
2782 } // namespace about_flags 2824 } // namespace about_flags
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/flag_descriptions.h » ('j') | chrome/common/pause_tabs_field_trial.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698