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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/hotword/state_manager.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
};
});
« 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