| 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 f1abebf7501ea2058be5b122a9f10585cb1d0fdb..829fd68e94788f7a94863305a71dd927784b4a69 100644
|
| --- a/chrome/browser/speech/speech_input_dispatcher_host.cc
|
| +++ b/chrome/browser/speech/speech_input_dispatcher_host.cc
|
| @@ -5,6 +5,7 @@
|
| #include "chrome/browser/speech/speech_input_dispatcher_host.h"
|
|
|
| #include "base/lazy_instance.h"
|
| +#include "chrome/browser/renderer_host/render_process_host.h"
|
| #include "chrome/common/render_messages.h"
|
|
|
| namespace speech_input {
|
| @@ -121,17 +122,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()) {
|
| + RenderProcessHost::FromID(render_process_id_)->ReceivedBadMessage();
|
| + return false;
|
| + }
|
| +
|
| + 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(
|
|
|