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

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

Issue 6353005: Revert r70896 to move speech input back behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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
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/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "chrome/common/render_messages.h" 8 #include "chrome/common/render_messages.h"
9 9
10 namespace speech_input { 10 namespace speech_input {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 SpeechInputDispatcherHost::~SpeechInputDispatcherHost() { 114 SpeechInputDispatcherHost::~SpeechInputDispatcherHost() {
115 } 115 }
116 116
117 SpeechInputManager* SpeechInputDispatcherHost::manager() { 117 SpeechInputManager* SpeechInputDispatcherHost::manager() {
118 return (*manager_accessor_)(); 118 return (*manager_accessor_)();
119 } 119 }
120 120
121 bool SpeechInputDispatcherHost::OnMessageReceived( 121 bool SpeechInputDispatcherHost::OnMessageReceived(
122 const IPC::Message& message, bool* message_was_ok) { 122 const IPC::Message& message, bool* message_was_ok) {
123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
124 bool handled = true; 124
125 IPC_BEGIN_MESSAGE_MAP_EX(SpeechInputDispatcherHost, message, 125 uint32 message_type = message.type();
126 *message_was_ok) 126 if (message_type == ViewHostMsg_SpeechInput_StartRecognition::ID ||
127 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StartRecognition, 127 message_type == ViewHostMsg_SpeechInput_CancelRecognition::ID ||
128 OnStartRecognition) 128 message_type == ViewHostMsg_SpeechInput_StopRecording::ID) {
129 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_CancelRecognition, 129 if (!SpeechInputManager::IsFeatureEnabled()) {
130 OnCancelRecognition) 130 *message_was_ok = false;
131 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StopRecording, 131 return true;
132 OnStopRecording) 132 }
133 IPC_MESSAGE_UNHANDLED(handled = false) 133
134 IPC_END_MESSAGE_MAP() 134 IPC_BEGIN_MESSAGE_MAP_EX(SpeechInputDispatcherHost, message,
135 return handled; 135 *message_was_ok)
136 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StartRecognition,
137 OnStartRecognition)
138 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_CancelRecognition,
139 OnCancelRecognition)
140 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StopRecording,
141 OnStopRecording)
142 IPC_END_MESSAGE_MAP()
143 return true;
144 }
145
146 return false;
136 } 147 }
137 148
138 void SpeechInputDispatcherHost::OnStartRecognition( 149 void SpeechInputDispatcherHost::OnStartRecognition(
139 int render_view_id, 150 int render_view_id,
140 int request_id, 151 int request_id,
141 const gfx::Rect& element_rect, 152 const gfx::Rect& element_rect,
142 const std::string& language, 153 const std::string& language,
143 const std::string& grammar) { 154 const std::string& grammar) {
144 int caller_id = g_speech_input_callers.Get().CreateId( 155 int caller_id = g_speech_input_callers.Get().CreateId(
145 render_process_id_, render_view_id, request_id); 156 render_process_id_, render_view_id, request_id);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 g_speech_input_callers.Get().render_view_id(caller_id); 210 g_speech_input_callers.Get().render_view_id(caller_id);
200 int caller_request_id = g_speech_input_callers.Get().request_id(caller_id); 211 int caller_request_id = g_speech_input_callers.Get().request_id(caller_id);
201 Send(new ViewMsg_SpeechInput_RecognitionComplete(caller_render_view_id, 212 Send(new ViewMsg_SpeechInput_RecognitionComplete(caller_render_view_id,
202 caller_request_id)); 213 caller_request_id));
203 // Request sequence ended, so remove mapping. 214 // Request sequence ended, so remove mapping.
204 g_speech_input_callers.Get().RemoveId(caller_id); 215 g_speech_input_callers.Get().RemoveId(caller_id);
205 VLOG(1) << "SpeechInputDispatcherHost::DidCompleteRecognition exit"; 216 VLOG(1) << "SpeechInputDispatcherHost::DidCompleteRecognition exit";
206 } 217 }
207 218
208 } // namespace speech_input 219 } // namespace speech_input
OLDNEW
« no previous file with comments | « chrome/browser/speech/speech_input_browsertest.cc ('k') | chrome/browser/speech/speech_input_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698