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

Side by Side Diff: chrome/browser/speech/speech_input_dispatcher_host.cc

Issue 6148001: Revert 70671 - If speech input is disabled and we receive IPC calls, terminat... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/speech/speech_input_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:eol-style
- LF
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/speech/speech_input_dispatcher_host.h" 5 #include "chrome/browser/speech/speech_input_dispatcher_host.h"
6 6
7 #include "base/singleton.h" 7 #include "base/singleton.h"
8 #include "chrome/browser/renderer_host/render_process_host.h" 8 #include "chrome/browser/renderer_host/render_process_host.h"
9 #include "chrome/browser/renderer_host/render_view_host.h" 9 #include "chrome/browser/renderer_host/render_view_host.h"
10 #include "chrome/browser/renderer_host/render_view_host_notification_task.h" 10 #include "chrome/browser/renderer_host/render_view_host_notification_task.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 112
113 SpeechInputDispatcherHost::~SpeechInputDispatcherHost() { 113 SpeechInputDispatcherHost::~SpeechInputDispatcherHost() {
114 } 114 }
115 115
116 SpeechInputManager* SpeechInputDispatcherHost::manager() { 116 SpeechInputManager* SpeechInputDispatcherHost::manager() {
117 return (*manager_accessor_)(); 117 return (*manager_accessor_)();
118 } 118 }
119 119
120 bool SpeechInputDispatcherHost::OnMessageReceived( 120 bool SpeechInputDispatcherHost::OnMessageReceived(
121 const IPC::Message& message, bool* message_was_ok) { 121 const IPC::Message& msg, bool* msg_was_ok) {
122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
123 123 bool handled = true;
124 uint32 message_type = message.type(); 124 IPC_BEGIN_MESSAGE_MAP_EX(SpeechInputDispatcherHost, msg, *msg_was_ok)
125 if (message_type == ViewHostMsg_SpeechInput_StartRecognition::ID || 125 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StartRecognition,
126 message_type == ViewHostMsg_SpeechInput_CancelRecognition::ID || 126 OnStartRecognition)
127 message_type == ViewHostMsg_SpeechInput_StopRecording::ID) { 127 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_CancelRecognition,
128 if (!SpeechInputManager::IsFeatureEnabled()) { 128 OnCancelRecognition)
129 *message_was_ok = false; 129 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StopRecording,
130 return true; 130 OnStopRecording)
131 } 131 IPC_MESSAGE_UNHANDLED(handled = false)
132 132 IPC_END_MESSAGE_MAP()
133 IPC_BEGIN_MESSAGE_MAP_EX(SpeechInputDispatcherHost, message, 133 return handled;
134 *message_was_ok)
135 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StartRecognition,
136 OnStartRecognition)
137 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_CancelRecognition,
138 OnCancelRecognition)
139 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StopRecording,
140 OnStopRecording)
141 IPC_END_MESSAGE_MAP()
142 return true;
143 }
144
145 return false;
146 } 134 }
147 135
148 void SpeechInputDispatcherHost::OnStartRecognition( 136 void SpeechInputDispatcherHost::OnStartRecognition(
149 int render_view_id, 137 int render_view_id,
150 int request_id, 138 int request_id,
151 const gfx::Rect& element_rect) { 139 const gfx::Rect& element_rect) {
152 int caller_id = callers_->CreateId(resource_message_filter_process_id_, 140 int caller_id = callers_->CreateId(resource_message_filter_process_id_,
153 render_view_id, request_id); 141 render_view_id, request_id);
154 manager()->StartRecognition(this, caller_id, 142 manager()->StartRecognition(this, caller_id,
155 resource_message_filter_process_id_, 143 resource_message_filter_process_id_,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 int caller_request_id = callers_->request_id(caller_id); 199 int caller_request_id = callers_->request_id(caller_id);
212 SendMessageToRenderView( 200 SendMessageToRenderView(
213 new ViewMsg_SpeechInput_RecognitionComplete(caller_render_view_id, 201 new ViewMsg_SpeechInput_RecognitionComplete(caller_render_view_id,
214 caller_request_id), 202 caller_request_id),
215 caller_render_view_id); 203 caller_render_view_id);
216 callers_->RemoveId(caller_id); // Request sequence ended, so remove mapping. 204 callers_->RemoveId(caller_id); // Request sequence ended, so remove mapping.
217 LOG(INFO) << "SpeechInputDispatcherHost::DidCompleteRecognition exit"; 205 LOG(INFO) << "SpeechInputDispatcherHost::DidCompleteRecognition exit";
218 } 206 }
219 207
220 } // namespace speech_input 208 } // namespace speech_input
OLDNEW
« 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