| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 /** | 5 /** |
| 6 * @fileoverview The class to Manage both offline / online speech recognition. | 6 * @fileoverview The class to Manage both offline / online speech recognition. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 <include src="plugin_manager.js"/> | 9 <include src="plugin_manager.js"/> |
| 10 <include src="audio_manager.js"/> | 10 <include src="audio_manager.js"/> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 */ | 75 */ |
| 76 SpeechManager.prototype.onHotwordRecognizerReady_ = function(pluginManager) { | 76 SpeechManager.prototype.onHotwordRecognizerReady_ = function(pluginManager) { |
| 77 this.pluginManager_ = pluginManager; | 77 this.pluginManager_ = pluginManager; |
| 78 this.audioManager_.addEventListener( | 78 this.audioManager_.addEventListener( |
| 79 'audio', pluginManager.sendAudioData.bind(pluginManager)); | 79 'audio', pluginManager.sendAudioData.bind(pluginManager)); |
| 80 if (this.shown_) { | 80 if (this.shown_) { |
| 81 this.pluginManager_.startRecognizer(); | 81 this.pluginManager_.startRecognizer(); |
| 82 this.audioManager_.start(); | 82 this.audioManager_.start(); |
| 83 this.setState_(SpeechState.HOTWORD_RECOGNIZING); | 83 this.setState_(SpeechState.HOTWORD_RECOGNIZING); |
| 84 } else { | 84 } else { |
| 85 this.pluginManager_.stopRecognizer(); |
| 85 this.setState_(SpeechState.READY); | 86 this.setState_(SpeechState.READY); |
| 86 } | 87 } |
| 87 chrome.send('setHotwordRecognizerState', [true]); | 88 chrome.send('setHotwordRecognizerState', [true]); |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 /** | 91 /** |
| 91 * Called when the hotword is recognized. | 92 * Called when the hotword is recognized. |
| 92 * | 93 * |
| 93 * @private | 94 * @private |
| 94 */ | 95 */ |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (this.audioManager_.state == speech.AudioState.STOPPED) | 259 if (this.audioManager_.state == speech.AudioState.STOPPED) |
| 259 this.audioManager_.start(); | 260 this.audioManager_.start(); |
| 260 this.speechRecognitionManager_.start(); | 261 this.speechRecognitionManager_.start(); |
| 261 } | 262 } |
| 262 }; | 263 }; |
| 263 | 264 |
| 264 return { | 265 return { |
| 265 SpeechManager: SpeechManager | 266 SpeechManager: SpeechManager |
| 266 }; | 267 }; |
| 267 }); | 268 }); |
| OLD | NEW |