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

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

Issue 687323003: Adds a Training Manager to the hotword extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tp3-api
Patch Set: Rebase Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/resources/hotword/state_manager.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * Class used to manage always-on hotwording. Automatically starts hotwording 9 * Class used to manage speaker training. Starts a hotwording session
10 * on startup, if always-on is enabled, and starts/stops hotwording at 10 * if training is on, and automatically restarts the detector when a
11 * appropriate times. 11 * a hotword is triggered.
12 * @param {!hotword.StateManager} stateManager 12 * @param {!hotword.StateManager} stateManager
13 * @constructor 13 * @constructor
14 * @extends {hotword.BaseSessionManager} 14 * @extends {hotword.BaseSessionManager}
15 */ 15 */
16 function AlwaysOnManager(stateManager) { 16 function TrainingManager(stateManager) {
17 hotword.BaseSessionManager.call(this, 17 hotword.BaseSessionManager.call(this,
18 stateManager, 18 stateManager,
19 hotword.constants.SessionSource.ALWAYS); 19 hotword.constants.SessionSource.TRAINING);
20 } 20 }
21 21
22 AlwaysOnManager.prototype = { 22 TrainingManager.prototype = {
23 __proto__: hotword.BaseSessionManager.prototype, 23 __proto__: hotword.BaseSessionManager.prototype,
24 24
25 /** @override */ 25 /** @override */
26 enabled: function() { 26 enabled: function() {
27 return this.stateManager.isAlwaysOnEnabled(); 27 return this.stateManager.isTrainingEnabled();
28 }, 28 },
29 29
30 /** @override */ 30 /** @override */
31 updateListeners: function() { 31 updateListeners: function() {
32 hotword.BaseSessionManager.prototype.updateListeners.call(this); 32 hotword.BaseSessionManager.prototype.updateListeners.call(this);
33 if (this.enabled()) 33 if (this.enabled())
34 this.startSession_(); 34 this.startSession_();
35 },
36
37 /** @override */
38 handleHotwordTrigger: function() {
39 if (this.enabled()) {
40 hotword.BaseSessionManager.prototype.handleHotwordTrigger.call(this);
41 this.startSession_();
42 }
35 } 43 }
36 }; 44 };
37 45
38 return { 46 return {
39 AlwaysOnManager: AlwaysOnManager 47 TrainingManager: TrainingManager
40 }; 48 };
41 }); 49 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/hotword/state_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698