WebUI: create feature flag for accessibility enhancements used for
review and testings before releasing the enhancement

Bug: 1001742
Change-Id: I30774fa496ff566cecb8f33db1179ad0ae746bb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1790410
Reviewed-by: Dan Beam <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Commit-Queue: Esmael Elmoslimany <[email protected]>
Cr-Commit-Position: refs/heads/master@{#696088}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 301149ed..ac9effd 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -3052,6 +3052,10 @@
     {"ntp-realbox", flag_descriptions::kNtpRealboxName,
      flag_descriptions::kNtpRealboxDescription, kOsDesktop,
      FEATURE_VALUE_TYPE(features::kNtpRealbox)},
+
+    {"webui-a11y-enhancements", flag_descriptions::kWebUIA11yEnhancementsName,
+     flag_descriptions::kWebUIA11yEnhancementsDescription, kOsDesktop,
+     FEATURE_VALUE_TYPE(features::kWebUIA11yEnhancements)},
 #endif  // !defined(OS_ANDROID)
 
 #if defined(DCHECK_IS_CONFIGURABLE)
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index 0a9dc92..3e47a859 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -3330,6 +3330,11 @@
     "expiry_milestone": 81
   },
   {
+    "name": "webui-a11y-enhancements",
+    "owners": [ "aee" ],
+    "expiry_milestone": 82
+  },
+  {
     "name": "webui-tab-strip",
     "owners": [ "johntlee", "pbos" ],
     "expiry_milestone": 82
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 4cb1032..973a155 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -2932,6 +2932,15 @@
     "Enables proactive tab freezing and discarding. This requires "
     "#enable-page-almost-idle.";
 
+const char kWebUIA11yEnhancementsName[] =
+    "Enable accessibility enahncements in WebUI";
+const char kWebUIA11yEnhancementsDescription[] =
+    "This flag covers a wide variety of accessibility enhancements in WebUI "
+    "and is used to demonstrate the enhancements for review and testing. When "
+    "a enhancement is ready to be released, the enhancement will be taken out "
+    "from behind this feature flag. This flag will remain disabled and ready "
+    "to be used for other enhancements.";
+
 #if defined(GOOGLE_CHROME_BUILD)
 
 const char kGoogleBrandedContextMenuName[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index b9a63a5..f218e1a 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -1718,6 +1718,9 @@
 extern const char kProactiveTabFreezeAndDiscardName[];
 extern const char kProactiveTabFreezeAndDiscardDescription[];
 
+extern const char kWebUIA11yEnhancementsName[];
+extern const char kWebUIA11yEnhancementsDescription[];
+
 #if defined(GOOGLE_CHROME_BUILD)
 
 extern const char kGoogleBrandedContextMenuName[];
diff --git a/chrome/browser/ui/webui/settings/settings_ui.cc b/chrome/browser/ui/webui/settings/settings_ui.cc
index 3ea47f5..f0337c52 100644
--- a/chrome/browser/ui/webui/settings/settings_ui.cc
+++ b/chrome/browser/ui/webui/settings/settings_ui.cc
@@ -47,6 +47,7 @@
 #include "chrome/browser/ui/webui/settings/settings_security_key_handler.h"
 #include "chrome/browser/ui/webui/settings/settings_startup_pages_handler.h"
 #include "chrome/browser/ui/webui/settings/site_settings_handler.h"
+#include "chrome/common/chrome_features.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/url_constants.h"
 #include "chrome/grit/settings_resources.h"
@@ -270,6 +271,10 @@
       AccountConsistencyModeManager::IsDiceEnabledForProfile(profile));
 #endif  // !defined(OS_CHROMEOS)
 
+  html_source->AddBoolean(
+      "a11yEnhancements",
+      base::FeatureList::IsEnabled(features::kWebUIA11yEnhancements));
+
   html_source->AddBoolean("unifiedConsentEnabled",
                           unified_consent::IsUnifiedConsentFeatureEnabled());
 
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
index 19d73db..e84e44f 100644
--- a/chrome/common/chrome_features.cc
+++ b/chrome/common/chrome_features.cc
@@ -821,6 +821,10 @@
 // Compress remote-bound WebRTC event logs (if used; see kWebRtcRemoteEventLog).
 const base::Feature kWebRtcRemoteEventLogGzipped{
     "WebRtcRemoteEventLogGzipped", base::FEATURE_ENABLED_BY_DEFAULT};
+
+// Enable WebUI accessibility enhancements for review and testing.
+const base::Feature kWebUIA11yEnhancements{"WebUIA11yEnhancements",
+                                           base::FEATURE_DISABLED_BY_DEFAULT};
 #endif
 
 // Whether to enable "dark mode" enhancements in Mac Mojave or Windows 10 for
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h
index 97c62fb..ccf1fd4f 100644
--- a/chrome/common/chrome_features.h
+++ b/chrome/common/chrome_features.h
@@ -514,6 +514,8 @@
 extern const base::Feature kWebRtcRemoteEventLog;
 COMPONENT_EXPORT(CHROME_FEATURES)
 extern const base::Feature kWebRtcRemoteEventLogGzipped;
+COMPONENT_EXPORT(CHROME_FEATURES)
+extern const base::Feature kWebUIA11yEnhancements;
 #endif
 
 COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kWebUIDarkMode;