Add feature flag for single-tab mode and disable it by default.

Bug: 841643
Change-Id: I28d6ec0af4aa8ad77eeb9e140a3dac58097002ea
Reviewed-on: https://chromium-review.googlesource.com/1136064
Reviewed-by: Robert Liao <robliao@chromium.org>
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575375}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 82b04d83..f0584dda 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1476,6 +1476,9 @@
     {"new-tab-button-position", flag_descriptions::kNewTabButtonPosition,
      flag_descriptions::kNewTabButtonPositionDescription, kOsDesktop,
      MULTI_VALUE_TYPE(kNewTabButtonPositionChoices)},
+    {"single-tab-mode", flag_descriptions::kSingleTabMode,
+     flag_descriptions::kSingleTabModeDescription, kOsDesktop,
+     FEATURE_VALUE_TYPE(features::kSingleTabMode)},
     {"site-settings", flag_descriptions::kSiteSettings,
      flag_descriptions::kSiteSettingsDescription, kOsDesktop,
      FEATURE_VALUE_TYPE(features::kSiteSettings)},
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index f81594c..0135894a 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -1623,6 +1623,10 @@
 const char kSingleClickAutofillDescription[] =
     "Make autofill suggestions on initial mouse click on a form element.";
 
+const char kSingleTabMode[] = "Single-tab mode";
+const char kSingleTabModeDescription[] =
+    "Windows with a single tab receive a special, minimal visual treatment.";
+
 const char kStrictSiteIsolationName[] = "Strict site isolation";
 const char kStrictSiteIsolationDescription[] =
     "Security mode that enables site isolation for all sites. When enabled, "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 9544a13..87d1e072 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -992,6 +992,9 @@
 extern const char kSingleClickAutofillName[];
 extern const char kSingleClickAutofillDescription[];
 
+extern const char kSingleTabMode[];
+extern const char kSingleTabModeDescription[];
+
 extern const char kStrictSiteIsolationName[];
 extern const char kStrictSiteIsolationDescription[];
 
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
index 9cbfc3f..ec738c3 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
@@ -18,6 +18,7 @@
 #include "chrome/browser/ui/view_ids.h"
 #include "chrome/browser/ui/views/frame/browser_view.h"
 #include "chrome/browser/ui/views/tabs/tab_strip.h"
+#include "chrome/common/chrome_features.h"
 #include "chrome/grit/theme_resources.h"
 #include "components/signin/core/browser/profile_management_switches.h"
 #include "third_party/skia/include/core/SkColor.h"
@@ -189,7 +190,8 @@
   // The special color we use won't be visible if there's a frame image, but
   // since it's used to determine constrast of other UI elements, the theme
   // color should be used instead.
-  return MD::IsRefreshUi() && ShouldPaintAsActive() && GetFrameImage().isNull();
+  return base::FeatureList::IsEnabled(features::kSingleTabMode) &&
+         MD::IsRefreshUi() && ShouldPaintAsActive() && GetFrameImage().isNull();
 }
 
 bool BrowserNonClientFrameView::ShouldPaintAsSingleTabMode() const {
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
index 5a02f5ad..e5a6202 100644
--- a/chrome/common/chrome_features.cc
+++ b/chrome/common/chrome_features.cc
@@ -539,6 +539,10 @@
 const base::Feature kNativeSmb{"NativeSmb", base::FEATURE_DISABLED_BY_DEFAULT};
 #endif  // defined(OS_CHROMEOS)
 
+// Enables a special visual treatment for windows with a single tab.
+const base::Feature kSingleTabMode{"SingleTabMode",
+                                   base::FEATURE_DISABLED_BY_DEFAULT};
+
 // Enables or disables the ability to use the sound content setting to mute a
 // website.
 const base::Feature kSoundContentSetting{"SoundContentSetting",
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h
index 6da7ce57..17a7798e 100644
--- a/chrome/common/chrome_features.h
+++ b/chrome/common/chrome_features.h
@@ -284,6 +284,8 @@
 extern const base::Feature kNativeSmb;
 #endif
 
+extern const base::Feature kSingleTabMode;
+
 extern const base::Feature kSoundContentSetting;
 
 #if defined(OS_MACOSX)
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 6a282e7..61e8655 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -27640,6 +27640,7 @@
   <int value="-1557527869" label="LoadingWithMojo:disabled"/>
   <int value="-1555510175" label="PasswordImport:enabled"/>
   <int value="-1553477903" label="ash-disable-text-filtering-in-overview-mode"/>
+  <int value="-1552898031" label="SingleTabMode:enabled"/>
   <int value="-1549871007" label="OneGoogleBarOnLocalNtp:disabled"/>
   <int value="-1547247328" label="OverrideTranslateTriggerInIndia:disabled"/>
   <int value="-1546903171" label="enable-touch-drag-drop"/>
@@ -28965,6 +28966,7 @@
       label="kAutofillRationalizeRepeatedServerPredictions:enabled"/>
   <int value="1226624874" label="Mus:disabled"/>
   <int value="1228115769" label="SiteCharacteristicsDatabase:disabled"/>
+  <int value="1229299518" label="SingleTabMode:disabled"/>
   <int value="1235800887" label="V8Ignition:enabled"/>
   <int value="1235940786" label="ChromeHomePersistentIph:enabled"/>
   <int value="1237297772" label="no-pings"/>