Revert 119306 - Turn web intents build flag on.

Move the command-line flag to default-on.

(Revert of 119284 : https://chromiumcodereview.appspot.com/9212036)

IN CASE OF FIRE, PULL THIS HANDLE! If web intents needs
to be disabled, revert this change.

[email protected]
BUG=111135
TEST=None


Review URL: http://codereview.chromium.org/9271084

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119423 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/build/common.gypi b/build/common.gypi
index 64b60b9..161464c 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -220,8 +220,13 @@
       # Enable navigator.registerProtocolHandler and supporting UI.
       'enable_register_protocol_handler%': 1,
 
-      # Enable Web Intents and supporting UI.
-      'enable_web_intents%': 0,
+      # Enable Web Intents support in WebKit, dispatching of intents,
+      # and extensions Web Intents support.
+      'enable_web_intents%': 1,
+
+      # Enable Web Intents web content registration via HTML element
+      # and WebUI managing such registrations.
+      'enable_web_intents_tag%': 0,
 
       # Webrtc compilation is enabled by default. Set to 0 to disable.
       'enable_webrtc%': 1,
@@ -446,6 +451,7 @@
     'order_text_section%': '<(order_text_section)',
     'enable_register_protocol_handler%': '<(enable_register_protocol_handler)',
     'enable_web_intents%': '<(enable_web_intents)',
+    'enable_web_intents_tag%': '<(enable_web_intents_tag)',
     'enable_plugin_installation%': '<(enable_plugin_installation)',
     'use_canvas_skia_skia%': '<(use_canvas_skia_skia)',
     # Whether to build for Wayland display server
@@ -920,8 +926,8 @@
         'grit_defines': ['-D', 'enable_register_protocol_handler'],
       }],
 
-      ['enable_web_intents==1', {
-        'grit_defines': ['-D', 'enable_web_intents'],
+      ['enable_web_intents_tag==1', {
+        'grit_defines': ['-D', 'enable_web_intents_tag'],
       }],
 
       ['asan==1', {
diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc
index 82eacba..e73553a 100644
--- a/chrome/browser/content_settings/host_content_settings_map.cc
+++ b/chrome/browser/content_settings/host_content_settings_map.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -311,8 +311,7 @@
     ContentSetting setting, ContentSettingsType content_type) {
   // Intents content settings are hidden behind a switch for now.
   if (content_type == CONTENT_SETTINGS_TYPE_INTENTS &&
-      !CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kEnableWebIntents))
+      CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents))
     return false;
 
   // BLOCK semantics are not implemented for fullscreen.
diff --git a/chrome/browser/resources/options/options.html b/chrome/browser/resources/options/options.html
index cfd82ff..8ded164 100644
--- a/chrome/browser/resources/options/options.html
+++ b/chrome/browser/resources/options/options.html
@@ -30,7 +30,7 @@
   <link rel="stylesheet" href="handler_options.css">
 </if>
 <link rel="stylesheet" href="import_data_overlay.css">
-<if expr="pp_ifdef('enable_web_intents')">
+<if expr="pp_ifdef('enable_web_intents_tag')">
   <link rel="stylesheet" href="intents_view.css">
 </if>
 <link rel="stylesheet" href="language_options.css">
@@ -175,7 +175,7 @@
              <if expr="pp_ifdef('enable_register_protocol_handler')">
                <include src="handler_options.html">
              </if>
-             <if expr="pp_ifdef('enable_web_intents')">
+             <if expr="pp_ifdef('enable_web_intents_tag')">
                <include src="intents_view.html">
              </if>
              <include src="content_settings_exceptions_area.html">
diff --git a/chrome/browser/resources/options/options_bundle.js b/chrome/browser/resources/options/options_bundle.js
index 02988589..d156edb 100644
--- a/chrome/browser/resources/options/options_bundle.js
+++ b/chrome/browser/resources/options/options_bundle.js
@@ -76,7 +76,7 @@
 </if>
 <include src="import_data_overlay.js"></include>
 <include src="instant_confirm_overlay.js"></include>
-<if expr="pp_ifdef('enable_web_intents')">
+<if expr="pp_ifdef('enable_web_intents_tag')">
   <include src="intents_list.js"></include>
   <include src="intents_view.js"></include>
 </if>
diff --git a/chrome/browser/resources/options2/content_settings.html b/chrome/browser/resources/options2/content_settings.html
index bd21b0c..ba62d90 100644
--- a/chrome/browser/resources/options2/content_settings.html
+++ b/chrome/browser/resources/options2/content_settings.html
@@ -246,7 +246,7 @@
       </div>
     </section>
     <!-- Intent registration filter tab contents -->
-    <if expr="pp_ifdef('enable_web_intents')">
+    <if expr="pp_ifdef('enable_web_intents_tag')">
       <section id="intents-section">
       <h3 i18n-content="intentsTabLabel" class="content-settings-header"></h3>
         <div>
diff --git a/chrome/browser/resources/options2/options.html b/chrome/browser/resources/options2/options.html
index fcaacbb..2d504c0 100644
--- a/chrome/browser/resources/options2/options.html
+++ b/chrome/browser/resources/options2/options.html
@@ -28,7 +28,7 @@
   <link rel="stylesheet" href="handler_options.css">
 </if>
 <link rel="stylesheet" href="import_data_overlay.css">
-<if expr="pp_ifdef('enable_web_intents')">
+<if expr="pp_ifdef('enable_web_intents_tag')">
   <link rel="stylesheet" href="intents_view.css">
 </if>
 <link rel="stylesheet" href="language_options.css">
@@ -171,7 +171,7 @@
              <if expr="pp_ifdef('enable_register_protocol_handler')">
                <include src="handler_options.html">
              </if>
-             <if expr="pp_ifdef('enable_web_intents')">
+             <if expr="pp_ifdef('enable_web_intents_tag')">
                <include src="intents_view.html">
              </if>
              <include src="content_settings_exceptions_area.html">
diff --git a/chrome/browser/resources/options2/options_bundle.js b/chrome/browser/resources/options2/options_bundle.js
index dc930ba..9b22548 100644
--- a/chrome/browser/resources/options2/options_bundle.js
+++ b/chrome/browser/resources/options2/options_bundle.js
@@ -77,7 +77,7 @@
 <include src="home_page_overlay.js"></include>
 <include src="import_data_overlay.js"></include>
 <include src="instant_confirm_overlay.js"></include>
-<if expr="pp_ifdef('enable_web_intents')">
+<if expr="pp_ifdef('enable_web_intents_tag')">
   <include src="intents_list.js"></include>
   <include src="intents_view.js"></include>
 </if>
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 97b9dd22..6cf0f7a 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -2719,7 +2719,7 @@
                                           const string16& href,
                                           const string16& title,
                                           const string16& disposition) {
-  if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents))
+  if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents))
     return;
 
   TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents(
@@ -4065,7 +4065,7 @@
 
 void Browser::WebIntentDispatch(
     WebContents* tab, content::WebIntentsDispatcher* intents_dispatcher) {
-  if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents))
+  if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents))
     return;
 
   TabContentsWrapper* tcw =
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index fabd1dc..ce86285 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -284,8 +284,8 @@
       CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kEnableClickToPlay));
   localized_strings->SetBoolean("enable_web_intents",
-      CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kEnableWebIntents));
+      !CommandLine::ForCurrentProcess()->HasSwitch(
+          switches::kDisableWebIntents));
 }
 
 void ContentSettingsHandler::Initialize() {
@@ -438,10 +438,9 @@
 
 void ContentSettingsHandler::UpdateExceptionsViewFromModel(
     ContentSettingsType type) {
-  // Skip updating intents unless it's enabled from the command line.
-  if (type == CONTENT_SETTINGS_TYPE_INTENTS &&
-      !CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kEnableWebIntents))
+  // Don't update intents settings at this point.
+  // Turn on when enable_web_intents_tag is enabled.
+  if (type == CONTENT_SETTINGS_TYPE_INTENTS)
     return;
 
   switch (type) {
diff --git a/chrome/browser/ui/webui/options2/content_settings_handler2.cc b/chrome/browser/ui/webui/options2/content_settings_handler2.cc
index 320cbd5..db58e02 100644
--- a/chrome/browser/ui/webui/options2/content_settings_handler2.cc
+++ b/chrome/browser/ui/webui/options2/content_settings_handler2.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -286,8 +286,8 @@
       CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kEnableClickToPlay));
   localized_strings->SetBoolean("enable_web_intents",
-      CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kEnableWebIntents));
+      !CommandLine::ForCurrentProcess()->HasSwitch(
+          switches::kDisableWebIntents));
 }
 
 void ContentSettingsHandler::Initialize() {
@@ -440,10 +440,9 @@
 
 void ContentSettingsHandler::UpdateExceptionsViewFromModel(
     ContentSettingsType type) {
-  // Skip updating intents unless it's enabled from the command line.
-  if (type == CONTENT_SETTINGS_TYPE_INTENTS &&
-      !CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kEnableWebIntents))
+  // Don't update intents settings at this point.
+  // Turn on when enable_web_intents_tag is enabled.
+  if (type == CONTENT_SETTINGS_TYPE_INTENTS)
     return;
 
   switch (type) {
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 92d0c5e..9fc73cd 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1132,7 +1132,7 @@
                                       string16* error) {
   DCHECK(error);
 
-  if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents))
+  if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents))
     return true;
 
   if (!manifest->HasKey(keys::kIntents))
diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
index 696f64a..0cadcb73 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -775,8 +775,6 @@
 }
 
 TEST_F(ExtensionManifestTest, WebIntents) {
-  CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableWebIntents);
-
   LoadAndExpectError("intent_invalid_1.json",
                      extension_manifest_errors::kInvalidIntents);
   LoadAndExpectError("intent_invalid_2.json",
@@ -822,8 +820,6 @@
 }
 
 TEST_F(ExtensionManifestTest, WebIntentsWithMultipleMimeTypes) {
-  CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableWebIntents);
-
   scoped_refptr<Extension> extension(
       LoadAndExpectSuccess("intent_valid_multitype.json"));
   ASSERT_TRUE(extension.get() != NULL);
diff --git a/content/browser/intents/intent_injector.cc b/content/browser/intents/intent_injector.cc
index 65daff0e..ae41fc6 100644
--- a/content/browser/intents/intent_injector.cc
+++ b/content/browser/intents/intent_injector.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -66,8 +66,8 @@
 // like it might be racy, though.
 void IntentInjector::SendIntent() {
   if (source_intent_.get() == NULL ||
-      !CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kEnableWebIntents) ||
+      CommandLine::ForCurrentProcess()->HasSwitch(
+          switches::kDisableWebIntents) ||
       web_contents()->GetRenderViewHost() == NULL) {
     return;
   }
@@ -90,7 +90,7 @@
 
 void IntentInjector::OnReply(webkit_glue::WebIntentReplyType reply_type,
                              const string16& data) {
-  if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents))
+  if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebIntents))
     NOTREACHED();
 
   if (intents_dispatcher_) {
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index 3d3239d..391d4f8 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -285,7 +285,7 @@
 const char kEnableVideoTrack[]              = "enable-video-track";
 
 // Enable Web Intents.
-const char kEnableWebIntents[]              = "enable-web-intents";
+const char kDisableWebIntents[]             = "disable-web-intents";
 
 // Enables experimental features for the geolocation API.
 // Current features:
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index 64e42a0..a666779 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -95,7 +95,7 @@
 CONTENT_EXPORT extern const char kEnableTouchEvents[];
 extern const char kEnableVideoFullscreen[];
 CONTENT_EXPORT extern const char kEnableVideoTrack[];
-CONTENT_EXPORT extern const char kEnableWebIntents[];
+CONTENT_EXPORT extern const char kDisableWebIntents[];
 CONTENT_EXPORT extern const char kExperimentalLocationFeatures[];
 extern const char kExtraPluginDir[];
 extern const char kForceFieldTestNameAndValue[];