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

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: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
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 61%
copy from chrome/browser/resources/hotword/always_on_manager.js
copy to chrome/browser/resources/hotword/training_manager.js
index c656c9ce86c2e003b2ac60d8c9da6bd0c54a71dc..c0f984d7a34dd368f87b977d821930d499a483d9 100644
--- a/chrome/browser/resources/hotword/always_on_manager.js
+++ b/chrome/browser/resources/hotword/training_manager.js
@@ -6,36 +6,43 @@ 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.
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.
* @param {!hotword.StateManager} stateManager
* @constructor
* @extends {hotword.BaseSessionManager}
+ * @struct
Anand Mistry (off Chromium) 2014/10/30 03:53:12 Remove.
kcarattini 2014/10/30 05:27:06 Done.
*/
- 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 */
+ /** override */
Anand Mistry (off Chromium) 2014/10/30 03:53:12 @override and same below.
kcarattini 2014/10/30 05:27:06 Done.
enabled: function() {
- return this.stateManager.isAlwaysOnEnabled();
+ return this.stateManager.isTrainingEnabled();
},
- /** @override */
+ /** override */
updateListeners: 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
};
});

Powered by Google App Engine
This is Rietveld 408576698