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

Unified Diff: chrome/browser/resources/app_list/speech_manager.js

Issue 105773004: Introduces the speech recognition UI to app_list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/resources/app_list/speech_recognition_manager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2cd35311e96f643a3961e1f534326f42878222b1..90f099e4e5b32ab3917f31160c0673d5ca02f274 100644
--- a/chrome/browser/resources/app_list/speech_manager.js
+++ b/chrome/browser/resources/app_list/speech_manager.js
@@ -51,7 +51,6 @@ cr.define('speech', function() {
*/
SpeechManager.prototype.setState_ = function(newState) {
this.state = newState;
- console.log('speech state: ' + newState);
};
/**
@@ -66,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]);
};
/**
@@ -105,12 +103,9 @@ cr.define('speech', function() {
* @param {boolean} isFinal Whether the result is final or not.
*/
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();
- }
};
/**
@@ -118,7 +113,7 @@ cr.define('speech', function() {
*/
SpeechManager.prototype.onSpeechRecognitionStarted = function() {
this.setState_(SpeechState.RECOGNIZING);
- chrome.send('setSpeechRecognitionState', [true]);
+ chrome.send('setSpeechRecognitionState', ['on']);
};
/**
@@ -133,7 +128,23 @@ 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() {
+ if (this.state == SpeechState.RECOGNIZING)
+ chrome.send('setSpeechRecognitionState', ['in-speech']);
+ };
+
+ /**
+ * Called when a speech has ended.
+ */
+ SpeechManager.prototype.onSpeechEnded = function() {
+ if (this.state == SpeechState.RECOGNIZING)
+ chrome.send('setSpeechRecognitionState', ['on']);
};
/**
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/resources/app_list/speech_recognition_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698