Index: chrome/browser/speech/speech_input_dispatcher_host.cc |
diff --git a/chrome/browser/speech/speech_input_dispatcher_host.cc b/chrome/browser/speech/speech_input_dispatcher_host.cc |
index 5e1daab14439cac490b3b6a0d8c5d72f1bdcebd4..50b9aec9d86e54f6e95a6a25b8a510139615aabd 100644 |
--- a/chrome/browser/speech/speech_input_dispatcher_host.cc |
+++ b/chrome/browser/speech/speech_input_dispatcher_host.cc |
@@ -121,18 +121,29 @@ SpeechInputManager* SpeechInputDispatcherHost::manager() { |
bool SpeechInputDispatcherHost::OnMessageReceived( |
const IPC::Message& message, bool* message_was_ok) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- bool handled = 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_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( |