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

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

Issue 1259673002: Make UTF16ToASCII and UTF16TOUTF8 take a StringPiece (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
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/strings/utf_string_conversions.h" 8 #include "base/strings/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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Each new session should reinstantiate the provider once the track is ready. 92 // Each new session should reinstantiate the provider once the track is ready.
93 ResetAudioSink(); 93 ResetAudioSink();
94 #endif 94 #endif
95 95
96 SpeechRecognitionHostMsg_StartRequest_Params msg_params; 96 SpeechRecognitionHostMsg_StartRequest_Params msg_params;
97 for (size_t i = 0; i < params.grammars().size(); ++i) { 97 for (size_t i = 0; i < params.grammars().size(); ++i) {
98 const WebSpeechGrammar& grammar = params.grammars()[i]; 98 const WebSpeechGrammar& grammar = params.grammars()[i];
99 msg_params.grammars.push_back( 99 msg_params.grammars.push_back(
100 SpeechRecognitionGrammar(grammar.src().spec(), grammar.weight())); 100 SpeechRecognitionGrammar(grammar.src().spec(), grammar.weight()));
101 } 101 }
102 msg_params.language = base::UTF16ToUTF8(params.language()); 102 msg_params.language =
103 base::UTF16ToUTF8(base::StringPiece16(params.language()));
103 msg_params.max_hypotheses = static_cast<uint32>(params.maxAlternatives()); 104 msg_params.max_hypotheses = static_cast<uint32>(params.maxAlternatives());
104 msg_params.continuous = params.continuous(); 105 msg_params.continuous = params.continuous();
105 msg_params.interim_results = params.interimResults(); 106 msg_params.interim_results = params.interimResults();
106 msg_params.origin_url = params.origin().toString().utf8(); 107 msg_params.origin_url = params.origin().toString().utf8();
107 msg_params.render_view_id = routing_id(); 108 msg_params.render_view_id = routing_id();
108 msg_params.request_id = GetOrCreateIDForHandle(handle); 109 msg_params.request_id = GetOrCreateIDForHandle(handle);
109 #if defined(ENABLE_WEBRTC) 110 #if defined(ENABLE_WEBRTC)
110 // Fall back to default input when the track is not allowed. 111 // Fall back to default input when the track is not allowed.
111 msg_params.using_audio_track = !audio_track_.isNull(); 112 msg_params.using_audio_track = !audio_track_.isNull();
112 #else 113 #else
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 } 312 }
312 313
313 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID( 314 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID(
314 int request_id) { 315 int request_id) {
315 HandleMap::iterator iter = handle_map_.find(request_id); 316 HandleMap::iterator iter = handle_map_.find(request_id);
316 CHECK(iter != handle_map_.end()); 317 CHECK(iter != handle_map_.end());
317 return iter->second; 318 return iter->second;
318 } 319 }
319 320
320 } // namespace content 321 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/service_worker/service_worker_type_util.cc ('k') | media/blink/encrypted_media_player_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698