Add Views Textfield disable switch; default settings unchanged.

Add --disable-views-textfield commandline switch and about:flags entry.
ENABLE_DISABLE_VALUE_TYPE adds a "Default/Enable/Disable" combobox to about:flags.

Leave NativeTextfieldWin / OmniboxViewWin on by default for non-Aura Win.
(experimental Views equivalents are still off by default for non-Aura Win)

BUG=131660
TEST=No behavior changes; enable flag still works; disable is still default for non-Aura Win.
[email protected]

Review URL: https://chromiumcodereview.appspot.com/12388075

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186010 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 0944491a..15b33b19 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -6800,11 +6800,11 @@
       <message name="IDS_FLAGS_ENABLE_NEW_DIALOG_STYLE_DESCRIPTION" desc="Description of the flag to use the new dialog style.">
         Enables a new visual style on certain dialogs.
       </message>
-      <message name="IDS_FLAGS_ENABLE_VIEWS_TEXTFIELD_NAME" desc="Name of the flag to use NativeTextfieldViews instead of NativeTextfieldWin.">
-        Enable Views Textfield.
+      <message name="IDS_FLAGS_VIEWS_TEXTFIELD_NAME" desc="Name of the flag to use NativeTextfieldViews or NativeTextfieldWin.">
+        Views Textfield.
       </message>
-      <message name="IDS_FLAGS_ENABLE_VIEWS_TEXTFIELD_DESCRIPTION" desc="Description of the flag to use NativeTextfieldViews instead of NativeTextfieldWin.">
-        Enables an experimental textfield for application UI; does not affect web content.
+      <message name="IDS_FLAGS_VIEWS_TEXTFIELD_DESCRIPTION" desc="Description of the flag to use NativeTextfieldViews or NativeTextfieldWin.">
+        An experimental textfield for application UI; does not affect web content.
       </message>
       <message name="IDS_FLAGS_ENABLE_CONTACTS_NAME" desc="Name of the 'Enable contacts' lab.">
         Enable contacts integration.
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 32af2c6..8daaa1d 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1024,11 +1024,12 @@
   },
 #endif  // defined(OS_CHROMEOS)
   {
-    "enable-views-textfield",
-    IDS_FLAGS_ENABLE_VIEWS_TEXTFIELD_NAME,
-    IDS_FLAGS_ENABLE_VIEWS_TEXTFIELD_DESCRIPTION,
+    "views-textfield",
+    IDS_FLAGS_VIEWS_TEXTFIELD_NAME,
+    IDS_FLAGS_VIEWS_TEXTFIELD_DESCRIPTION,
     kOsWin,
-    SINGLE_VALUE_TYPE(switches::kEnableViewsTextfield),
+    ENABLE_DISABLE_VALUE_TYPE(switches::kEnableViewsTextfield,
+                              switches::kDisableViewsTextfield),
   },
   {
     "old-checkbox-style",
diff --git a/ui/base/ui_base_switches.cc b/ui/base/ui_base_switches.cc
index b4fdabf..86a85f1 100644
--- a/ui/base/ui_base_switches.cc
+++ b/ui/base/ui_base_switches.cc
@@ -9,10 +9,13 @@
 // Disables new menu UI.
 const char kDisableNewMenuStyle[] = "disable-new-menu-style";
 
-// Disable touch adjustment.
+// Disables touch adjustment.
 const char kDisableTouchAdjustment[] = "disable-touch-adjustment";
 
-// Enable support for bezel touch.
+// Disables the Views textfield on Windows.
+const char kDisableViewsTextfield[] = "disable-views-textfield";
+
+// Enables support for bezel touch.
 const char kEnableBezelTouch[] = "enable-bezel-touch";
 
 // Enables the new dialog style wherever it is available.
@@ -26,8 +29,7 @@
 // Enables the Views textfield on Windows.
 const char kEnableViewsTextfield[] = "enable-views-textfield";
 
-// Overrides the device scale factor for the browser UI and the
-// contents.
+// Overrides the device scale factor for the browser UI and the contents.
 const char kForceDeviceScaleFactor[] = "force-device-scale-factor";
 
 // If a resource is requested at a scale factor at which it is not available
diff --git a/ui/base/ui_base_switches.h b/ui/base/ui_base_switches.h
index b21e2b1..de05df39 100644
--- a/ui/base/ui_base_switches.h
+++ b/ui/base/ui_base_switches.h
@@ -14,6 +14,7 @@
 
 UI_EXPORT extern const char kDisableNewMenuStyle[];
 UI_EXPORT extern const char kDisableTouchAdjustment[];
+UI_EXPORT extern const char kDisableViewsTextfield[];
 UI_EXPORT extern const char kEnableBezelTouch[];
 UI_EXPORT extern const char kEnableNewDialogStyle[];
 UI_EXPORT extern const char kEnableTouchDragDrop[];
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 4fff76fa..bdd656c4 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -51,8 +51,12 @@
 // static
 bool Textfield::IsViewsTextfieldEnabled() {
 #if defined(OS_WIN) && !defined(USE_AURA)
-  return CommandLine::ForCurrentProcess()->HasSwitch(
-      switches::kEnableViewsTextfield);
+  CommandLine* command_line = CommandLine::ForCurrentProcess();
+  if (command_line->HasSwitch(switches::kDisableViewsTextfield))
+    return false;
+  if (command_line->HasSwitch(switches::kEnableViewsTextfield))
+    return true;
+  return false;
 #endif
   return true;
 }