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

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

Issue 2599923002: Run tools/clang-format-js on chrome/browser/resources/hotword/ (Closed)
Patch Set: no dep Created 3 years, 11 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 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 * Base class for managing hotwording sessions. 9 * Base class for managing hotwording sessions.
10 * @param {!hotword.StateManager} stateManager Manager of global hotwording 10 * @param {!hotword.StateManager} stateManager Manager of global hotwording
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 * Return whether or not this session type is enabled. 49 * Return whether or not this session type is enabled.
50 * @protected 50 * @protected
51 * @return {boolean} 51 * @return {boolean}
52 */ 52 */
53 enabled: assertNotReached, 53 enabled: assertNotReached,
54 54
55 /** 55 /**
56 * Called when the hotwording session is stopped. 56 * Called when the hotwording session is stopped.
57 * @protected 57 * @protected
58 */ 58 */
59 onSessionStop: function() { 59 onSessionStop: function() {},
60 },
61 60
62 /** 61 /**
63 * Starts a launcher hotwording session. 62 * Starts a launcher hotwording session.
64 * @param {hotword.constants.TrainingMode=} opt_mode The mode to start the 63 * @param {hotword.constants.TrainingMode=} opt_mode The mode to start the
65 * recognizer in. 64 * recognizer in.
66 */ 65 */
67 startSession: function(opt_mode) { 66 startSession: function(opt_mode) {
68 this.stateManager.startSession( 67 this.stateManager.startSession(this.sessionSource_, function() {
69 this.sessionSource_, 68 chrome.hotwordPrivate.setHotwordSessionState(true, function() {});
70 function() { 69 }, this.handleHotwordTrigger.bind(this), opt_mode);
71 chrome.hotwordPrivate.setHotwordSessionState(true, function() {});
72 },
73 this.handleHotwordTrigger.bind(this),
74 opt_mode);
75 }, 70 },
76 71
77 /** 72 /**
78 * Stops a launcher hotwording session. 73 * Stops a launcher hotwording session.
79 * @private 74 * @private
80 */ 75 */
81 stopSession_: function() { 76 stopSession_: function() {
82 this.stateManager.stopSession(this.sessionSource_); 77 this.stateManager.stopSession(this.sessionSource_);
83 this.onSessionStop(); 78 this.onSessionStop();
84 }, 79 },
85 80
86 /** 81 /**
87 * Handles a hotword triggered event. 82 * Handles a hotword triggered event.
88 * @param {?Object} log Audio log data, if audio logging is enabled. 83 * @param {?Object} log Audio log data, if audio logging is enabled.
89 * @protected 84 * @protected
90 */ 85 */
91 handleHotwordTrigger: function(log) { 86 handleHotwordTrigger: function(log) {
92 hotword.debug('Hotword triggered: ' + this.sessionSource_, log); 87 hotword.debug('Hotword triggered: ' + this.sessionSource_, log);
93 chrome.hotwordPrivate.notifyHotwordRecognition('search', 88 chrome.hotwordPrivate.notifyHotwordRecognition(
94 log, 89 'search', log, function() {});
95 function() {});
96 }, 90 },
97 91
98 /** 92 /**
99 * Handles a hotwordPrivate.onHotwordSessionRequested event. 93 * Handles a hotwordPrivate.onHotwordSessionRequested event.
100 * @private 94 * @private
101 */ 95 */
102 handleSessionRequested_: function() { 96 handleSessionRequested_: function() {
103 hotword.debug('handleSessionRequested_: ' + this.sessionSource_); 97 hotword.debug('handleSessionRequested_: ' + this.sessionSource_);
104 this.startSession(); 98 this.startSession();
105 }, 99 },
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 updateListeners: function() { 141 updateListeners: function() {
148 if (this.enabled()) { 142 if (this.enabled()) {
149 this.setupListeners_(); 143 this.setupListeners_();
150 } else { 144 } else {
151 this.removeListeners_(); 145 this.removeListeners_();
152 this.stopSession_(); 146 this.stopSession_();
153 } 147 }
154 } 148 }
155 }; 149 };
156 150
157 return { 151 return {BaseSessionManager: BaseSessionManager};
158 BaseSessionManager: BaseSessionManager
159 };
160 }); 152 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/hotword/audio_client.js ('k') | chrome/browser/resources/hotword/constants.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698