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

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: 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
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.
Anand Mistry (off Chromium) 2014/10/30 03:53:12 Can you expand a bit by saying this automatically
kcarattini 2014/10/30 05:27:06 Done.
10 * on startup, if always-on is enabled, and starts/stops hotwording at
11 * appropriate times.
12 * @param {!hotword.StateManager} stateManager 10 * @param {!hotword.StateManager} stateManager
13 * @constructor 11 * @constructor
14 * @extends {hotword.BaseSessionManager} 12 * @extends {hotword.BaseSessionManager}
13 * @struct
Anand Mistry (off Chromium) 2014/10/30 03:53:12 Remove.
kcarattini 2014/10/30 05:27:06 Done.
15 */ 14 */
16 function AlwaysOnManager(stateManager) { 15 function TrainingManager(stateManager) {
17 hotword.BaseSessionManager.call(this, 16 hotword.BaseSessionManager.call(this,
18 stateManager, 17 stateManager,
19 hotword.constants.SessionSource.ALWAYS); 18 hotword.constants.SessionSource.TRAINING);
20 } 19 }
21 20
22 AlwaysOnManager.prototype = { 21 TrainingManager.prototype = {
23 __proto__: hotword.BaseSessionManager.prototype, 22 __proto__: hotword.BaseSessionManager.prototype,
24 23
25 /** @override */ 24 /** override */
Anand Mistry (off Chromium) 2014/10/30 03:53:12 @override and same below.
kcarattini 2014/10/30 05:27:06 Done.
26 enabled: function() { 25 enabled: function() {
27 return this.stateManager.isAlwaysOnEnabled(); 26 return this.stateManager.isTrainingEnabled();
28 }, 27 },
29 28
30 /** @override */ 29 /** override */
31 updateListeners: function() { 30 updateListeners: function() {
32 hotword.BaseSessionManager.prototype.updateListeners.call(this); 31 hotword.BaseSessionManager.prototype.updateListeners.call(this);
33 if (this.enabled()) 32 if (this.enabled())
34 this.startSession_(); 33 this.startSession_();
34 },
35
36 /** override */
37 handleHotwordTrigger: function() {
38 if (this.enabled()) {
39 hotword.BaseSessionManager.prototype.handleHotwordTrigger.call(this);
40 this.startSession_();
41 }
35 } 42 }
36 }; 43 };
37 44
38 return { 45 return {
39 AlwaysOnManager: AlwaysOnManager 46 TrainingManager: TrainingManager
40 }; 47 };
41 }); 48 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698