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

Side by Side Diff: content/renderer/speech_recognition_dispatcher.cc

Issue 10629003: Adding support for the SpeechRecognition.maxAlternatives JS API parameter (Speech CL2.5) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits + rebase Created 8 years, 5 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 | « content/public/browser/speech_recognition_session_config.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/speech_recognition_dispatcher.h" 5 #include "content/renderer/speech_recognition_dispatcher.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "content/common/speech_recognition_messages.h" 9 #include "content/common/speech_recognition_messages.h"
10 #include "content/renderer/render_view_impl.h" 10 #include "content/renderer/render_view_impl.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 SpeechRecognitionHostMsg_StartRequest_Params msg_params; 67 SpeechRecognitionHostMsg_StartRequest_Params msg_params;
68 for (size_t i = 0; i < params.grammars().size(); ++i) { 68 for (size_t i = 0; i < params.grammars().size(); ++i) {
69 const WebSpeechGrammar& grammar = params.grammars()[i]; 69 const WebSpeechGrammar& grammar = params.grammars()[i];
70 msg_params.grammars.push_back( 70 msg_params.grammars.push_back(
71 content::SpeechRecognitionGrammar(grammar.src().spec(), 71 content::SpeechRecognitionGrammar(grammar.src().spec(),
72 grammar.weight())); 72 grammar.weight()));
73 } 73 }
74 msg_params.language = UTF16ToUTF8(params.language()); 74 msg_params.language = UTF16ToUTF8(params.language());
75 msg_params.is_one_shot = !params.continuous(); 75 msg_params.is_one_shot = !params.continuous();
76 msg_params.max_hypotheses = static_cast<uint32>(params.maxAlternatives());
76 msg_params.origin_url = params.origin().toString().utf8(); 77 msg_params.origin_url = params.origin().toString().utf8();
77 msg_params.render_view_id = routing_id(); 78 msg_params.render_view_id = routing_id();
78 msg_params.request_id = GetOrCreateIDForHandle(handle); 79 msg_params.request_id = GetOrCreateIDForHandle(handle);
79 // The handle mapping will be removed in |OnRecognitionEnd|. 80 // The handle mapping will be removed in |OnRecognitionEnd|.
80 Send(new SpeechRecognitionHostMsg_StartRequest(msg_params)); 81 Send(new SpeechRecognitionHostMsg_StartRequest(msg_params));
81 } 82 }
82 83
83 void SpeechRecognitionDispatcher::stop( 84 void SpeechRecognitionDispatcher::stop(
84 const WebSpeechRecognitionHandle& handle, 85 const WebSpeechRecognitionHandle& handle,
85 WebSpeechRecognizerClient* recognizer_client) { 86 WebSpeechRecognizerClient* recognizer_client) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 207 }
207 return false; 208 return false;
208 } 209 }
209 210
210 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID( 211 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID(
211 int request_id) { 212 int request_id) {
212 HandleMap::iterator iter = handle_map_.find(request_id); 213 HandleMap::iterator iter = handle_map_.find(request_id);
213 DCHECK(iter != handle_map_.end()); 214 DCHECK(iter != handle_map_.end());
214 return iter->second; 215 return iter->second;
215 } 216 }
OLDNEW
« no previous file with comments | « content/public/browser/speech_recognition_session_config.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698