From 9eb100ed79cd849780ce8de7412734a2356e95a3 Mon Sep 17 00:00:00 2001
From: "jknotten@chromium.org"
 <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 14 Oct 2011 05:08:22 +0000
Subject: Allow speech input feature to be disabled.

BUG=None
TEST=Existing


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105463 0039d316-1c4b-4281-b951-d872f2087c98
---
 build/common.gypi                     |  8 ++++++++
 chrome/chrome_tests.gypi              | 11 +++++++++++
 content/content_renderer.gypi         |  6 ++++++
 content/content_tests.gypi            |  5 +++++
 content/renderer/render_view_impl.cc  |  2 ++
 webkit/tools/test_shell/test_shell.cc |  2 ++
 6 files changed, 34 insertions(+)

diff --git a/build/common.gypi b/build/common.gypi
index 512c8e9..25816560 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -197,6 +197,9 @@
       # Safe browsing is compiled in by default. Set to 0 to disable.
       'safe_browsing%': 1,
 
+      # Speech input is compiled in by default. Set to 0 to disable.
+      'input_speech%': 1,
+
       # If this is set, the clang plugins used on the buildbot will be used.
       # Run tools/clang/scripts/update.sh to make sure they are compiled.
       # This causes 'clang_chrome_plugins_flags' to be set.
@@ -385,6 +388,7 @@
     'p2p_apis%': '<(p2p_apis)',
     'configuration_policy%': '<(configuration_policy)',
     'safe_browsing%': '<(safe_browsing)',
+    'input_speech%': '<(input_speech)',
     'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
     'asan%': '<(asan)',
     'enable_register_protocol_handler%': '<(enable_register_protocol_handler)',
@@ -652,6 +656,7 @@
         'proprietary_codecs%': '<(proprietary_codecs)',
         'safe_browsing%': 0,
         'configuration_policy%': 0,
+        'input_speech%': 0,
 
         # Builds the gtest targets as a shared_library.
         # TODO(michaelbai): Use the fixed value 'shared_library' once it
@@ -1005,6 +1010,9 @@
       ['configuration_policy==1', {
         'defines': ['ENABLE_CONFIGURATION_POLICY'],
       }],
+      ['input_speech==1', {
+        'defines': ['ENABLE_INPUT_SPEECH'],
+      }],
       ['fastbuild!=0', {
 
         'conditions': [
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index aba0a91..3374609 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1957,6 +1957,11 @@
             ['exclude', '^browser/policy/'],
           ],
         }],
+        ['input_speech==0', {
+          'sources/': [
+            ['exclude', '^browser/speech/'],
+          ],
+        }],
         ['safe_browsing==1', {
           'defines': [
             'ENABLE_SAFE_BROWSING',
@@ -2616,6 +2621,12 @@
             ['exclude', '^browser/policy/'],
           ],
         }],
+        ['input_speech==0', {
+          'sources/': [
+            ['exclude', '^browser/speech/'],
+            ['exclude', '^../content/browser/speech/'],
+          ],
+        }],
         ['safe_browsing==1', {
           'defines': [
             'ENABLE_SAFE_BROWSING',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 5747a11..90aeb5e 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -215,6 +215,12 @@
               '../base/allocator/allocator.gyp:allocator',
           ],
         }],
+        ['input_speech==0', {
+          'sources!': [
+            'renderer/speech_input_dispatcher.cc',
+            'renderer/speech_input_dispatcher.h',
+          ]
+        }],
       ],
       'dependencies': [
         '../build/linux/system.gyp:gtk',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 8844740..51717b2 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -188,6 +188,11 @@
         'test/run_all_unittests.cc',
       ],
       'conditions': [
+        ['input_speech==0', {
+          'sources/': [
+            ['exclude', '^browser/speech/'],
+          ]
+        }],
         ['use_x11 == 1', {
           'dependencies': [
             '../build/linux/system.gyp:dbus',
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index c8564fc..db78988 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -4385,8 +4385,10 @@ WebKit::WebGeolocationClient* RenderViewImpl::geolocationClient() {
 
 WebKit::WebSpeechInputController* RenderViewImpl::speechInputController(
     WebKit::WebSpeechInputListener* listener) {
+#if defined(ENABLE_INPUT_SPEECH)
   if (!speech_input_dispatcher_)
     speech_input_dispatcher_ = new SpeechInputDispatcher(this, listener);
+#endif
   return speech_input_dispatcher_;
 }
 
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 01862c5..6ec28cd 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -606,8 +606,10 @@ WebKit::WebSpeechInputControllerMock*
 TestShell::CreateSpeechInputControllerMock(
     WebKit::WebSpeechInputListener* listener) {
   DCHECK(!speech_input_controller_mock_.get());
+#if defined(ENABLE_INPUT_SPEECH)
   speech_input_controller_mock_.reset(
       WebKit::WebSpeechInputControllerMock::create(listener));
+#endif
   return speech_input_controller_mock_.get();
 }
 
-- 
cgit v1.1