Index: chrome/browser/speech/speech_input_manager.cc |
diff --git a/chrome/browser/speech/speech_input_manager.cc b/chrome/browser/speech/speech_input_manager.cc |
index b370da4a2096e0bc9450183b69195787b1129108..ef7a75887feef4d74875946876e58a1c35c608da 100644 |
--- a/chrome/browser/speech/speech_input_manager.cc |
+++ b/chrome/browser/speech/speech_input_manager.cc |
@@ -8,11 +8,14 @@ |
#include <string> |
#include "app/l10n_util.h" |
+#include "base/command_line.h" |
#include "base/lock.h" |
#include "base/ref_counted.h" |
#include "base/lazy_instance.h" |
+#include "base/threading/thread_restrictions.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/browser_thread.h" |
+#include "chrome/common/chrome_switches.h" |
#include "chrome/browser/prefs/pref_service.h" |
#include "chrome/browser/speech/speech_input_bubble_controller.h" |
#include "chrome/browser/speech/speech_recognizer.h" |
@@ -150,6 +153,26 @@ SpeechInputManager* SpeechInputManager::Get() { |
return g_speech_input_manager_impl.Pointer(); |
} |
+bool SpeechInputManager::IsFeatureEnabled() { |
+ bool enabled = true; |
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
+ |
+ if (command_line.HasSwitch(switches::kDisableSpeechInput)) { |
+ enabled = false; |
+#if defined(GOOGLE_CHROME_BUILD) |
+ } else if (!command_line.HasSwitch(switches::kEnableSpeechInput)) { |
+ // We need to evaluate whether IO is OK here. http://crbug.com/63335. |
+ base::ThreadRestrictions::ScopedAllowIO allow_io; |
+ // Official Chrome builds have speech input enabled by default only in the |
+ // dev channel. |
+ std::string channel = platform_util::GetVersionStringModifier(); |
+ enabled = (channel == "dev"); |
+#endif |
+ } |
+ |
+ return enabled; |
+} |
+ |
SpeechInputManagerImpl::SpeechInputManagerImpl() |
: recording_caller_id_(0), |
bubble_controller_(new SpeechInputBubbleController( |