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

Unified Diff: chrome/browser/speech/speech_input_dispatcher_host.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 | « no previous file | chrome/browser/speech/speech_input_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/speech/speech_input_dispatcher_host.cc
===================================================================
--- chrome/browser/speech/speech_input_dispatcher_host.cc (revision 70616)
+++ chrome/browser/speech/speech_input_dispatcher_host.cc (working copy)
@@ -118,19 +118,31 @@
}
bool SpeechInputDispatcherHost::OnMessageReceived(
- const IPC::Message& msg, bool* msg_was_ok) {
+ const IPC::Message& message, bool* message_was_ok) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP_EX(SpeechInputDispatcherHost, msg, *msg_was_ok)
- IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StartRecognition,
- OnStartRecognition)
- IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_CancelRecognition,
- OnCancelRecognition)
- IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StopRecording,
- OnStopRecording)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
+
+ uint32 message_type = message.type();
+ if (message_type == ViewHostMsg_SpeechInput_StartRecognition::ID ||
+ message_type == ViewHostMsg_SpeechInput_CancelRecognition::ID ||
+ message_type == ViewHostMsg_SpeechInput_StopRecording::ID) {
+ if (!SpeechInputManager::IsFeatureEnabled()) {
+ *message_was_ok = false;
+ return true;
+ }
+
+ IPC_BEGIN_MESSAGE_MAP_EX(SpeechInputDispatcherHost, message,
+ *message_was_ok)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StartRecognition,
+ OnStartRecognition)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_CancelRecognition,
+ OnCancelRecognition)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StopRecording,
+ OnStopRecording)
+ IPC_END_MESSAGE_MAP()
+ return true;
+ }
+
+ return false;
}
void SpeechInputDispatcherHost::OnStartRecognition(
« no previous file with comments | « no previous file | chrome/browser/speech/speech_input_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698