Allow for pausing timers in background tabs on desktop via about:flags.

This is a first step towards trying to get a flag that's good
enough for us to dogfood ourselves to see if there's something
we could ship regarding pausing background tabs that's web
compatible enough.

Speculatively plumb through the site engagement levels so that the followup
patch can hook them up to the scheduler.

Just shipping this flag as is would clearly not be compatible
enough though.

BUG=709082

Review-Url: https://codereview.chromium.org/2805683003
Cr-Commit-Position: refs/heads/master@{#463749}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index d689ae41..9c70585 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -35,6 +35,7 @@
 #include "chrome/common/chrome_features.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/features.h"
+#include "chrome/common/pause_tabs_field_trial.h"
 #include "chrome/grit/chromium_strings.h"
 #include "components/autofill/core/browser/autofill_experiments.h"
 #include "components/autofill/core/common/autofill_switches.h"
@@ -713,6 +714,36 @@
         {"Learning", kSpeculativeResourcePrefetchingLearning,
          arraysize(kSpeculativeResourcePrefetchingLearning), nullptr}};
 
+#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX) || \
+    defined(OS_WIN)
+const FeatureEntry::FeatureParam kPauseBackgroundTabsMinimalEngagment[] = {
+    {pausetabs::kFeatureName, pausetabs::kModeParamMinimal}};
+
+const FeatureEntry::FeatureParam kPauseBackgroundTabsLowEngagment[] = {
+    {pausetabs::kFeatureName, pausetabs::kModeParamLow}};
+
+const FeatureEntry::FeatureParam kPauseBackgroundTabsMediumEngagment[] = {
+    {pausetabs::kFeatureName, pausetabs::kModeParamMedium}};
+
+const FeatureEntry::FeatureParam kPauseBackgroundTabsHighEngagment[] = {
+    {pausetabs::kFeatureName, pausetabs::kModeParamHigh}};
+
+const FeatureEntry::FeatureParam kPauseBackgroundTabsMaxEngagment[] = {
+    {pausetabs::kFeatureName, pausetabs::kModeParamMax}};
+
+const FeatureEntry::FeatureVariation kPauseBackgroundTabsVariations[] = {
+    {"minimal engagement", kPauseBackgroundTabsMinimalEngagment,
+     arraysize(kPauseBackgroundTabsMinimalEngagment), nullptr},
+    {"low engagement", kPauseBackgroundTabsLowEngagment,
+     arraysize(kPauseBackgroundTabsLowEngagment), nullptr},
+    {"medium engagement", kPauseBackgroundTabsMediumEngagment,
+     arraysize(kPauseBackgroundTabsMediumEngagment), nullptr},
+    {"high engagement", kPauseBackgroundTabsHighEngagment,
+     arraysize(kPauseBackgroundTabsHighEngagment), nullptr},
+    {"max engagement", kPauseBackgroundTabsMaxEngagment,
+     arraysize(kPauseBackgroundTabsMaxEngagment), nullptr}};
+#endif
+
 #if defined(OS_ANDROID)
 const FeatureEntry::FeatureParam
 kAutofillCreditCardPopupLayoutFeatureVariationIconAtStart[] = {
@@ -2576,6 +2607,15 @@
      FEATURE_VALUE_TYPE(chrome::android::kCustomContextMenu)},
 #endif  // OS_ANDROID
 
+#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX) || \
+    defined(OS_WIN)
+    {pausetabs::kFeatureName, flag_descriptions::kPauseBackgroundTabsName,
+     flag_descriptions::kPauseBackgroundTabsDescription, kOsDesktop,
+     FEATURE_WITH_PARAMS_VALUE_TYPE(pausetabs::kFeature,
+                                    kPauseBackgroundTabsVariations,
+                                    "PauseBackgroundTabs")},
+#endif
+
 #if defined(USE_ASH)
     {"ash-enable-smooth-screen-rotation",
      flag_descriptions::kAshEnableSmoothScreenRotationName,