Chromium Code Reviews| Index: chrome/browser/resources/app_list/speech_manager.js |
| diff --git a/chrome/browser/resources/app_list/speech_manager.js b/chrome/browser/resources/app_list/speech_manager.js |
| index c55eab7ef5b5915695a523e2246fdabd03c98740..a651a7032297f33bcdd6cad59340c8c483998591 100644 |
| --- a/chrome/browser/resources/app_list/speech_manager.js |
| +++ b/chrome/browser/resources/app_list/speech_manager.js |
| @@ -65,8 +65,7 @@ cr.define('speech', function() { |
| for (var i = 0; i < data.length; ++i) |
| level += Math.abs(data[i]); |
| level /= data.length; |
| - // TODO(mukai): use the result to make the audio feedback during the speech |
| - // recognition. |
| + chrome.send('speechSoundLevel', [level]); |
| }; |
| /** |
| @@ -106,10 +105,9 @@ cr.define('speech', function() { |
| SpeechManager.prototype.onSpeechRecognized = function(result, isFinal) { |
| console.log('speech result: ' + result + ' ' + |
| (isFinal ? 'final' : 'interim')); |
| - if (isFinal) { |
| - chrome.send('search', [result]); |
| + chrome.send('speechResult', [result, isFinal]); |
| + if (isFinal) |
| this.speechRecognitionManager_.stop(); |
| - } |
| }; |
| /** |
| @@ -117,7 +115,7 @@ cr.define('speech', function() { |
| */ |
| SpeechManager.prototype.onSpeechRecognitionStarted = function() { |
| this.setState_(SpeechState.RECOGNIZING); |
| - chrome.send('setSpeechRecognitionState', [true]); |
| + chrome.send('setSpeechRecognitionState', ['on']); |
| }; |
| /** |
| @@ -132,7 +130,25 @@ cr.define('speech', function() { |
| } else { |
| this.audioManager_.stop(); |
| } |
| - chrome.send('setSpeechRecognitionState', [false]); |
| + chrome.send('setSpeechRecognitionState', ['off']); |
| + }; |
| + |
| + /** |
| + * Called when a speech has started. |
| + */ |
| + SpeechManager.prototype.onSpeechStarted = function() { |
| + console.log('speechStarted: ' + this.state); |
|
xiyuan
2013/12/05 22:06:30
nit: remove debugging log?
Jun Mukai
2013/12/06 00:31:10
Done.
|
| + if (this.state == SpeechState.RECOGNIZING) |
| + chrome.send('setSpeechRecognitionState', ['in-speech']); |
| + }; |
| + |
| + /** |
| + * Called when a speech has ended. |
| + */ |
| + SpeechManager.prototype.onSpeechEnded = function() { |
| + console.log('speechEnded: ' + this.state); |
|
xiyuan
2013/12/05 22:06:30
nit: remove debugging log?
Jun Mukai
2013/12/06 00:31:10
Done.
|
| + if (this.state == SpeechState.RECOGNIZING) |
| + chrome.send('setSpeechRecognitionState', ['on']); |
| }; |
| /** |