Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: chrome/browser/speech/speech_input_manager.cc

Issue 6139001: If speech input is disabled and we receive IPC calls, terminate the renderer.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/552/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/speech/speech_input_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/speech/speech_input_manager.cc
===================================================================
--- chrome/browser/speech/speech_input_manager.cc (revision 70616)
+++ chrome/browser/speech/speech_input_manager.cc (working copy)
@@ -5,14 +5,16 @@
#include "chrome/browser/speech/speech_input_manager.h"
#include "app/l10n_util.h"
-#include "base/ref_counted.h"
-#include "base/singleton.h"
-#include "chrome/browser/chrome_thread.h"
+#include "base/command_line.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/speech/speech_input_bubble_controller.h"
#include "chrome/browser/speech/speech_recognizer.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_util.h"
+#include "chrome/common/chrome_switches.h"
#include "grit/generated_resources.h"
#include "media/audio/audio_manager.h"
#include <map>
@@ -78,6 +80,26 @@
return Singleton<SpeechInputManagerImpl>::get();
}
+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(
« no previous file with comments | « chrome/browser/speech/speech_input_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698