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

Side by Side Diff: chrome/browser/resources/hotword/state_manager.js

Issue 1011813006: Make availability of hotword hardware known to hotword component extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 cr.define('hotword', function() { 5 cr.define('hotword', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Trivial container class for session information. 9 * Trivial container class for session information.
10 * @param {!hotword.constants.SessionSource} source Source of the hotword 10 * @param {!hotword.constants.SessionSource} source Source of the hotword
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 */ 294 */
295 startDetector_: function() { 295 startDetector_: function() {
296 // Last attempt to start detector resulted in an error. 296 // Last attempt to start detector resulted in an error.
297 if (this.state_ == State_.ERROR) { 297 if (this.state_ == State_.ERROR) {
298 // TODO(amistry): Do some error rate tracking here and disable the 298 // TODO(amistry): Do some error rate tracking here and disable the
299 // extension if we error too often. 299 // extension if we error too often.
300 } 300 }
301 301
302 if (!this.pluginManager_) { 302 if (!this.pluginManager_) {
303 this.state_ = State_.STARTING; 303 this.state_ = State_.STARTING;
304 this.pluginManager_ = new hotword.NaClManager(this.loggingEnabled_); 304 var isHotwordStream = this.isAlwaysOnEnabled() &&
305 this.hotwordStatus_.hotwordStreamAvailable;
306 this.pluginManager_ = new hotword.NaClManager(this.loggingEnabled_,
307 isHotwordStream);
305 this.pluginManager_.addEventListener(hotword.constants.Event.READY, 308 this.pluginManager_.addEventListener(hotword.constants.Event.READY,
306 this.onReady_.bind(this)); 309 this.onReady_.bind(this));
307 this.pluginManager_.addEventListener(hotword.constants.Event.ERROR, 310 this.pluginManager_.addEventListener(hotword.constants.Event.ERROR,
308 this.onError_.bind(this)); 311 this.onError_.bind(this));
309 this.pluginManager_.addEventListener(hotword.constants.Event.TRIGGER, 312 this.pluginManager_.addEventListener(hotword.constants.Event.TRIGGER,
310 this.onTrigger_.bind(this)); 313 this.onTrigger_.bind(this));
311 this.pluginManager_.addEventListener(hotword.constants.Event.TIMEOUT, 314 this.pluginManager_.addEventListener(hotword.constants.Event.TIMEOUT,
312 this.onTimeout_.bind(this)); 315 this.onTimeout_.bind(this));
313 this.pluginManager_.addEventListener( 316 this.pluginManager_.addEventListener(
314 hotword.constants.Event.SPEAKER_MODEL_SAVED, 317 hotword.constants.Event.SPEAKER_MODEL_SAVED,
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 602
600 if (oldLocked != this.isLocked_) 603 if (oldLocked != this.isLocked_)
601 this.updateStateFromStatus_(); 604 this.updateStateFromStatus_();
602 } 605 }
603 }; 606 };
604 607
605 return { 608 return {
606 StateManager: StateManager 609 StateManager: StateManager
607 }; 610 };
608 }); 611 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698