[CrOS Messages] Add flag for web push in ChromeOS - Messages itegration

This flag controls FCM web push based background notifications for
Android Messages integration on ChromeOS. See go/awm-cros-fcm.

Bug: 920831
Change-Id: I89fc2642e60697d265fbcf0c50ea4afd6ba0de8b
Reviewed-on: https://chromium-review.googlesource.com/c/1419223
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Jeremy Klein <jlklein@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Azeem Arshad <azeemarshad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625037}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index d2f609f..5535a9d 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1560,6 +1560,9 @@
      flag_descriptions::kUseMessagesGoogleComDomainName,
      flag_descriptions::kUseMessagesGoogleComDomainDescription, kOsCrOS,
      FEATURE_VALUE_TYPE(chromeos::features::kUseMessagesGoogleComDomain)},
+    {"enable_messages_web_push", flag_descriptions::kEnableMessagesWebPushName,
+     flag_descriptions::kEnableMessagesWebPushDescription, kOsCrOS,
+     FEATURE_VALUE_TYPE(chromeos::features::kEnableMessagesWebPush)},
     {
         "enable-background-blur",
         flag_descriptions::kEnableBackgroundBlurName,
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index f147773..2c997b3 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -2224,6 +2224,11 @@
     "expiry_milestone": 76
   },
   {
+    "name": "enable_messages_web_push",
+    "owners": [ "azeemarshad", "jlklein", "khorimoto" ],
+    "expiry_milestone": 76
+  },
+  {
     "name": "enforce-tls13-downgrade",
     "owners": [ "davidben", "svaldez" ],
     "expiry_milestone": 76
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 86cb02b..04e20bd 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -58,6 +58,12 @@
     "Use the messages.google.com domain as part of the \"Messages\" "
     "feature under \"Connected Devices\" settings.";
 
+const char kEnableMessagesWebPushName[] =
+    "Web push in Android Messages integration";
+const char kEnableMessagesWebPushDescription[] =
+    "Use web push for background notificatons in Chrome OS integration "
+    "with Android Messages for Web";
+
 const char kAndroidSiteSettingsUIRefreshName[] =
     "Android Site Settings UI changes.";
 const char kAndroidSiteSettingsUIRefreshDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 4f18967..413e267 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -67,6 +67,9 @@
 extern const char kUseMessagesGoogleComDomainName[];
 extern const char kUseMessagesGoogleComDomainDescription[];
 
+extern const char kEnableMessagesWebPushName[];
+extern const char kEnableMessagesWebPushDescription[];
+
 extern const char kAndroidSiteSettingsUIRefreshName[];
 extern const char kAndroidSiteSettingsUIRefreshDescription[];
 
diff --git a/chromeos/constants/chromeos_features.cc b/chromeos/constants/chromeos_features.cc
index c96a491..6e4c7323 100644
--- a/chromeos/constants/chromeos_features.cc
+++ b/chromeos/constants/chromeos_features.cc
@@ -41,6 +41,11 @@
 // If enabled, DriveFS will be used for Drive sync.
 const base::Feature kDriveFs{"DriveFS", base::FEATURE_ENABLED_BY_DEFAULT};
 
+// Enables or disables web push for background notifications in
+// Android Messages Integration on Chrome OS.
+const base::Feature kEnableMessagesWebPush{"EnableMessagesWebPush",
+                                           base::FEATURE_DISABLED_BY_DEFAULT};
+
 // If enabled, MyFiles will be a root/volume and user can create other
 // sub-folders and files in addition to the Downloads folder inside MyFiles.
 const base::Feature kMyFilesVolume{"MyFilesVolume",
diff --git a/chromeos/constants/chromeos_features.h b/chromeos/constants/chromeos_features.h
index e62e5c4..84dbc4f 100644
--- a/chromeos/constants/chromeos_features.h
+++ b/chromeos/constants/chromeos_features.h
@@ -23,6 +23,7 @@
 CHROMEOS_EXPORT extern const base::Feature kCryptAuthV2Enrollment;
 CHROMEOS_EXPORT extern const base::Feature kDiscoverApp;
 CHROMEOS_EXPORT extern const base::Feature kDriveFs;
+CHROMEOS_EXPORT extern const base::Feature kEnableMessagesWebPush;
 CHROMEOS_EXPORT extern const base::Feature kMyFilesVolume;
 CHROMEOS_EXPORT extern const base::Feature kEnableSupervisionTransitionScreens;
 CHROMEOS_EXPORT extern const base::Feature kFsNosymfollow;
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index f94f347..c1fbae0 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -32399,6 +32399,7 @@
   <int value="1376437124" label="show-cert-link"/>
   <int value="1377056573" label="browser-side-navigation:enabled"/>
   <int value="1378310092" label="disable-suggestions-service"/>
+  <int value="1379944457" label="EnableMessagesWebPush:disabled"/>
   <int value="1381746642" label="enable-automatic-password-saving"/>
   <int value="1382107019" label="LevelDBPerformRewrite:disabled"/>
   <int value="1382500494" label="disable-drive-apps-in-app-list"/>
@@ -32801,6 +32802,7 @@
   <int value="2075207488" label="AutomaticPasswordGeneration:disabled"/>
   <int value="2076787478" label="OmniboxDisplayTitleForCurrentUrl:disabled"/>
   <int value="2076903744" label="progress-bar-animation"/>
+  <int value="2077106718" label="EnableMessagesWebPush:enabled"/>
   <int value="2077917024"
       label="enable-supervised-user-managed-bookmarks-folder"/>
   <int value="2079672348" label="ExperimentalKeyboardLockUI:disabled"/>