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

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

Issue 215573002: Fixes hotword nacl handler to support the new behavior. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months 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 | « no previous file | chrome/browser/resources/app_list/speech_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/plugin_manager.js
diff --git a/chrome/browser/resources/app_list/plugin_manager.js b/chrome/browser/resources/app_list/plugin_manager.js
index eeb3823b77315bfef06836cee6ebcb7767f355a6..b6407b6557daf66f59375d60fdf62e2da9124ad1 100644
--- a/chrome/browser/resources/app_list/plugin_manager.js
+++ b/chrome/browser/resources/app_list/plugin_manager.js
@@ -16,9 +16,8 @@ cr.define('speech', function() {
var PluginState = {
UNINITIALIZED: 0,
LOADED: 1,
- SAMPLING_RATE_READY: 2,
- READY: 3,
- RECOGNIZING: 4
+ READY: 2,
+ RECOGNIZING: 3
};
/**
@@ -35,7 +34,7 @@ cr.define('speech', function() {
/**
* The regexp pattern of the hotword recognition result.
*/
- var recognitionPattern = /^HotwordFiredEvent:/;
+ var recognitionPattern = /^(HotwordFiredEvent:|hotword)/;
/**
* @constructor
@@ -67,17 +66,13 @@ cr.define('speech', function() {
* @private
*/
PluginManager.prototype.onMessage_ = function(messageEvent) {
- if (this.state == PluginState.LOADED) {
- if (messageEvent.data == 'stopped')
- this.state = PluginState.SAMPLING_RATE_READY;
- return;
- }
-
if (messageEvent.data == 'audio') {
- if (this.state < PluginState.READY)
- this.onReady_(this);
+ var wasNotReady = this.state < PluginState.READY;
this.state = PluginState.RECOGNIZING;
- } else if (messageEvent.data == 'stopped') {
+ if (wasNotReady)
+ this.onReady_(this);
+ } else if (messageEvent.data == 'stopped' &&
+ this.state == PluginState.RECOGNIZING) {
this.state = PluginState.READY;
} else if (recognitionPattern.exec(messageEvent.data)) {
this.onRecognized_();
« no previous file with comments | « no previous file | chrome/browser/resources/app_list/speech_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698