Add feature flag for app scaling

Bug: 1019397
Change-Id: I1fbc2c9f911946cfca595f766db3a0c3fe7f08c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2174783
Commit-Queue: Andrew Xu <[email protected]>
Reviewed-by: Xiyuan Xia <[email protected]>
Cr-Commit-Position: refs/heads/master@{#764490}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 4ec87d0..30f5b92 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -2259,6 +2259,9 @@
      flag_descriptions::kHideShelfControlsInTabletModeName,
      flag_descriptions::kHideShelfControlsInTabletModeDescription, kOsCrOS,
      FEATURE_VALUE_TYPE(ash::features::kHideShelfControlsInTabletMode)},
+    {"shelf-app-scaling", flag_descriptions::kShelfAppScalingName,
+     flag_descriptions::kShelfAppScalingDescription, kOsCrOS,
+     FEATURE_VALUE_TYPE(chromeos::features::kShelfAppScaling)},
     {"shelf-hotseat", flag_descriptions::kShelfHotseatName,
      flag_descriptions::kShelfHotseatDescription, kOsCrOS,
      FEATURE_VALUE_TYPE(chromeos::features::kShelfHotseat)},
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index 94e767a..643572c 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -3737,6 +3737,11 @@
     "expiry_milestone": 82
   },
   {
+    "name":"shelf-app-scaling",
+    "owners":["andrewxu"],
+    "expiry_milestone": 86
+  },
+  {
     "name": "shelf-hide-buttons-in-tablet",
     "owners": [ "tbarzic", "//ash/shelf/OWNERS" ],
     "expiry_milestone": 84
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 8fd0fd6..9148fcf 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -83,6 +83,11 @@
     "When disabled, the browser has no special handling for ftp:// URLs and "
     "by default defer handling of the URL to the underlying platform.";
 
+const char kShelfAppScalingName[] = "Enable shelf app scaling";
+const char kShelfAppScalingDescription[] =
+    "Reduce the app icon size from standard to dense when the user exceeds the "
+    "available space to add an additional app icon in tablet mode";
+
 const char kEnableSignedExchangeSubresourcePrefetchName[] =
     "Enable Signed Exchange subresource prefetching";
 const char kEnableSignedExchangeSubresourcePrefetchDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 2fca3fe..587a20d4 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -164,6 +164,9 @@
 extern const char kAutofillRestrictUnownedFieldsToFormlessCheckoutName[];
 extern const char kAutofillRestrictUnownedFieldsToFormlessCheckoutDescription[];
 
+extern const char kShelfAppScalingName[];
+extern const char kShelfAppScalingDescription[];
+
 extern const char kAutofillRichMetadataQueriesName[];
 extern const char kAutofillRichMetadataQueriesDescription[];
 
diff --git a/chromeos/constants/chromeos_features.cc b/chromeos/constants/chromeos_features.cc
index c23b7912..5465d24 100644
--- a/chromeos/constants/chromeos_features.cc
+++ b/chromeos/constants/chromeos_features.cc
@@ -125,6 +125,10 @@
 const base::Feature kCryptAuthV2Enrollment{"CryptAuthV2Enrollment",
                                            base::FEATURE_ENABLED_BY_DEFAULT};
 
+// Enables or disables shelf app scaling.
+const base::Feature kShelfAppScaling{"ShelfAppScaling",
+                                     base::FEATURE_DISABLED_BY_DEFAULT};
+
 // Disables the CryptAuth v1 DeviceSync flow. Note: During the first phase
 // of the v2 DeviceSync rollout, v1 and v2 DeviceSync run in parallel. This flag
 // is needed to disable the v1 service during the second phase of the rollout.
diff --git a/chromeos/constants/chromeos_features.h b/chromeos/constants/chromeos_features.h
index 594f04a..2edec697 100644
--- a/chromeos/constants/chromeos_features.h
+++ b/chromeos/constants/chromeos_features.h
@@ -66,6 +66,8 @@
 COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
 extern const base::Feature kCryptAuthV2DeviceSync;
 COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
+extern const base::Feature kShelfAppScaling;
+COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
 extern const base::Feature kCryptAuthV2Enrollment;
 COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
 extern const base::Feature kDisableOfficeEditingComponentApp;
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index ba1ea10..a22f877 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -38848,6 +38848,7 @@
   <int value="-1119700637" label="ui-disable-partial-swap"/>
   <int value="-1118921985" label="ForceEnableSystemAec:enabled"/>
   <int value="-1117104514" label="smbfs-file-shares"/>
+  <int value="-1116278039" label="ShelfAppScaling:disabled"/>
   <int value="-1114080030" label="ResourceLoadingHints:enabled"/>
   <int value="-1112782121" label="AndroidSigninPromos:disabled"/>
   <int value="-1109826787" label="AccessibilityExposeDisplayNone:enabled"/>
@@ -41575,6 +41576,7 @@
   <int value="2077106718" label="EnableMessagesWebPush:enabled"/>
   <int value="2077917024"
       label="enable-supervised-user-managed-bookmarks-folder"/>
+  <int value="2078599705" label="ShelfAppScaling:enabled"/>
   <int value="2079672348" label="ExperimentalKeyboardLockUI:disabled"/>
   <int value="2081154375" label="AssistantKeyRemapping:disabled"/>
   <int value="2084477383" label="CrostiniDiskResizing:enabled"/>