Index: chrome/browser/resources/hotword/training_manager.js |
diff --git a/chrome/browser/resources/hotword/always_on_manager.js b/chrome/browser/resources/hotword/training_manager.js |
similarity index 59% |
copy from chrome/browser/resources/hotword/always_on_manager.js |
copy to chrome/browser/resources/hotword/training_manager.js |
index c656c9ce86c2e003b2ac60d8c9da6bd0c54a71dc..9130e2d02492c7c71ae3c6761e83043f33925003 100644 |
--- a/chrome/browser/resources/hotword/always_on_manager.js |
+++ b/chrome/browser/resources/hotword/training_manager.js |
@@ -6,25 +6,25 @@ cr.define('hotword', function() { |
'use strict'; |
/** |
- * Class used to manage always-on hotwording. Automatically starts hotwording |
- * on startup, if always-on is enabled, and starts/stops hotwording at |
- * appropriate times. |
+ * Class used to manage speaker training. Starts a hotwording session |
+ * if training is on, and automatically restarts the detector when a |
+ * a hotword is triggered. |
* @param {!hotword.StateManager} stateManager |
* @constructor |
* @extends {hotword.BaseSessionManager} |
*/ |
- function AlwaysOnManager(stateManager) { |
+ function TrainingManager(stateManager) { |
hotword.BaseSessionManager.call(this, |
stateManager, |
- hotword.constants.SessionSource.ALWAYS); |
+ hotword.constants.SessionSource.TRAINING); |
} |
- AlwaysOnManager.prototype = { |
+ TrainingManager.prototype = { |
__proto__: hotword.BaseSessionManager.prototype, |
/** @override */ |
enabled: function() { |
- return this.stateManager.isAlwaysOnEnabled(); |
+ return this.stateManager.isTrainingEnabled(); |
}, |
/** @override */ |
@@ -32,10 +32,18 @@ cr.define('hotword', function() { |
hotword.BaseSessionManager.prototype.updateListeners.call(this); |
if (this.enabled()) |
this.startSession_(); |
+ }, |
+ |
+ /** @override */ |
+ handleHotwordTrigger: function() { |
+ if (this.enabled()) { |
+ hotword.BaseSessionManager.prototype.handleHotwordTrigger.call(this); |
+ this.startSession_(); |
+ } |
} |
}; |
return { |
- AlwaysOnManager: AlwaysOnManager |
+ TrainingManager: TrainingManager |
}; |
}); |