diff options
author | leandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 13:29:35 +0000 |
---|---|---|
committer | leandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 13:29:35 +0000 |
commit | d1ecb010a30afb74dfd33294771c9a1559f62141 (patch) | |
tree | 259e50648ff9445ff7c43f713c960a31f55e7b2b /content/renderer | |
parent | b773cee71532fbce19c1b92f256a950979764c8c (diff) | |
download | chromium_src-d1ecb010a30afb74dfd33294771c9a1559f62141.zip chromium_src-d1ecb010a30afb74dfd33294771c9a1559f62141.tar.gz chromium_src-d1ecb010a30afb74dfd33294771c9a1559f62141.tar.bz2 |
Applying changes to the existing speech input code to support the extension API.
This includes extended error management by handling the status response code and the DidStartReceivingSpeech/DidStopReceivingSpeech events.
BUG=97388
TEST=none
Review URL: http://codereview.chromium.org/8137005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/speech_input_dispatcher.cc | 11 | ||||
-rw-r--r-- | content/renderer/speech_input_dispatcher.h | 6 |
2 files changed, 10 insertions, 7 deletions
diff --git a/content/renderer/speech_input_dispatcher.cc b/content/renderer/speech_input_dispatcher.cc index 305521d..2cbcd7d 100644 --- a/content/renderer/speech_input_dispatcher.cc +++ b/content/renderer/speech_input_dispatcher.cc @@ -84,11 +84,14 @@ void SpeechInputDispatcher::stopRecording(int request_id) { } void SpeechInputDispatcher::OnSpeechRecognitionResult( - int request_id, const speech_input::SpeechInputResultArray& result) { + int request_id, + const speech_input::SpeechInputResult& result) { VLOG(1) << "SpeechInputDispatcher::OnSpeechRecognitionResult enter"; - WebKit::WebSpeechInputResultArray webkit_result(result.size()); - for (size_t i = 0; i < result.size(); ++i) - webkit_result[i].set(result[i].utterance, result[i].confidence); + WebKit::WebSpeechInputResultArray webkit_result(result.hypotheses.size()); + for (size_t i = 0; i < result.hypotheses.size(); ++i) { + webkit_result[i].set(result.hypotheses[i].utterance, + result.hypotheses[i].confidence); + } listener_->setRecognitionResult(request_id, webkit_result); VLOG(1) << "SpeechInputDispatcher::OnSpeechRecognitionResult exit"; } diff --git a/content/renderer/speech_input_dispatcher.h b/content/renderer/speech_input_dispatcher.h index 9ecb180..8ab9ca9 100644 --- a/content/renderer/speech_input_dispatcher.h +++ b/content/renderer/speech_input_dispatcher.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -38,8 +38,8 @@ class SpeechInputDispatcher : public content::RenderViewObserver, virtual void cancelRecognition(int request_id); virtual void stopRecording(int request_id); - void OnSpeechRecognitionResult( - int request_id, const speech_input::SpeechInputResultArray& result); + void OnSpeechRecognitionResult(int request_id, + const speech_input::SpeechInputResult& result); void OnSpeechRecordingComplete(int request_id); void OnSpeechRecognitionComplete(int request_id); void OnSpeechRecognitionToggleSpeechInput(); |