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 26 matching lines...) Expand all Loading... |
37 this.setState_(SpeechState.READY); | 37 this.setState_(SpeechState.READY); |
38 } | 38 } |
39 | 39 |
40 /** | 40 /** |
41 * Updates the state. | 41 * Updates the state. |
42 * | 42 * |
43 * @param {SpeechState} newState The new state. | 43 * @param {SpeechState} newState The new state. |
44 * @private | 44 * @private |
45 */ | 45 */ |
46 SpeechManager.prototype.setState_ = function(newState) { | 46 SpeechManager.prototype.setState_ = function(newState) { |
| 47 if (this.state == newState) |
| 48 return; |
| 49 |
47 this.state = newState; | 50 this.state = newState; |
48 chrome.send('setSpeechRecognitionState', [this.state]); | 51 chrome.send('setSpeechRecognitionState', [this.state]); |
49 }; | 52 }; |
50 | 53 |
51 /** | 54 /** |
52 * Called with the mean audio level when audio data arrives. | 55 * Called with the mean audio level when audio data arrives. |
53 * | 56 * |
54 * @param {cr.event.Event} event The event object for the audio data. | 57 * @param {cr.event.Event} event The event object for the audio data. |
55 * @private | 58 * @private |
56 */ | 59 */ |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 if (this.audioManager_.state == speech.AudioState.STOPPED) | 238 if (this.audioManager_.state == speech.AudioState.STOPPED) |
236 this.audioManager_.start(); | 239 this.audioManager_.start(); |
237 this.speechRecognitionManager_.start(); | 240 this.speechRecognitionManager_.start(); |
238 } | 241 } |
239 }; | 242 }; |
240 | 243 |
241 return { | 244 return { |
242 SpeechManager: SpeechManager | 245 SpeechManager: SpeechManager |
243 }; | 246 }; |
244 }); | 247 }); |
OLD | NEW |