Disable toggling of Overwrite mode when insert key is pressed.

Added a flag to enable/disable toggle mode when insert key is pressed
This is currently disabled by-default.

Bug: 1030231

Change-Id: I9c2dd62c0afe24d27848d189bf151d6a87a64068
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2473771
Reviewed-by: Eric Lawrence [MSFT] <[email protected]>
Reviewed-by: Yoshifumi Inoue <[email protected]>
Reviewed-by: Ian Kilpatrick <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Commit-Queue: Anupam Snigdha <[email protected]>
Cr-Commit-Position: refs/heads/master@{#818145}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index a7d5b7f..0e94e95 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -6657,6 +6657,11 @@
      flag_descriptions::kKaleidoscopeModuleDescription, kOsDesktop,
      FEATURE_VALUE_TYPE(media::kKaleidoscopeModule)},
 
+    {"insert-key-toggle-mode", flag_descriptions::kInsertKeyToggleModeName,
+     flag_descriptions::kInsertKeyToggleModeDescription,
+     kOsWin | kOsLinux | kOsCrOS,
+     FEATURE_VALUE_TYPE(blink::features::kInsertKeyToggleMode)},
+
     // NOTE: Adding a new flag requires adding a corresponding entry to enum
     // "LoginCustomFlags" in tools/metrics/histograms/enums.xml. See "Flag
     // Histograms" in tools/metrics/histograms/README.md (run the
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index 02a11db..99dbdc7 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -2884,6 +2884,14 @@
     "expiry_milestone": 84
   },
   {
+    "name": "insert-key-toggle-mode",
+    "owners": [ "snianu", "ericlaw" ],
+    // This flag is temporary as we want to eventually remove the support for
+    // Overwrite mode when insert key is pressed. Currently it is disabled
+    // by-default.
+    "expiry_milestone": 91
+  },
+  {
     "name": "installable-ink-drop",
     "owners": [ "collinbaker", "pbos" ],
     "expiry_milestone": 90
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index de472143..8d44076a 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -1293,6 +1293,11 @@
 const char kInProductHelpDemoModeChoiceDescription[] =
     "Selects the In-Product Help demo mode.";
 
+const char kInsertKeyToggleModeName[] = "Insert key toggles Overwrite mode";
+const char kInsertKeyToggleModeDescription[] =
+    "Toggles Overwrite mode on or off each time the Insert key is pressed in a "
+    "text editor.";
+
 const char kInstalledAppsInCbdName[] = "Installed Apps in Clear Browsing Data";
 const char kInstalledAppsInCbdDescription[] =
     "Adds the installed apps warning dialog to the clear browsing data flow "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 9e3a5ad6..90fe643 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -759,6 +759,9 @@
 extern const char kInProductHelpDemoModeChoiceName[];
 extern const char kInProductHelpDemoModeChoiceDescription[];
 
+extern const char kInsertKeyToggleModeName[];
+extern const char kInsertKeyToggleModeDescription[];
+
 extern const char kInstalledAppsInCbdName[];
 extern const char kInstalledAppsInCbdDescription[];