| OLD | NEW |
| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 /** | 62 /** |
| 63 * Starts a launcher hotwording session. | 63 * Starts a launcher hotwording session. |
| 64 * @private | 64 * @private |
| 65 */ | 65 */ |
| 66 startSession_: function() { | 66 startSession_: function() { |
| 67 this.stateManager.startSession( | 67 this.stateManager.startSession( |
| 68 this.sessionSource_, | 68 this.sessionSource_, |
| 69 function() { | 69 function() { |
| 70 chrome.hotwordPrivate.setHotwordSessionState(true, function() {}); | 70 chrome.hotwordPrivate.setHotwordSessionState(true, function() {}); |
| 71 }, | 71 }, |
| 72 this.handleHotwordTrigger_.bind(this)); | 72 this.handleHotwordTrigger.bind(this)); |
| 73 }, | 73 }, |
| 74 | 74 |
| 75 /** | 75 /** |
| 76 * Stops a launcher hotwording session. | 76 * Stops a launcher hotwording session. |
| 77 * @private | 77 * @private |
| 78 */ | 78 */ |
| 79 stopSession_: function() { | 79 stopSession_: function() { |
| 80 this.stateManager.stopSession(this.sessionSource_); | 80 this.stateManager.stopSession(this.sessionSource_); |
| 81 this.onSessionStop(); | 81 this.onSessionStop(); |
| 82 }, | 82 }, |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Handles a hotword triggered event. | 85 * Handles a hotword triggered event. |
| 86 * @private | 86 * @protected |
| 87 */ | 87 */ |
| 88 handleHotwordTrigger_: function() { | 88 handleHotwordTrigger: function() { |
| 89 hotword.debug('Hotword triggered: ' + this.sessionSource_); | 89 hotword.debug('Hotword triggered: ' + this.sessionSource_); |
| 90 chrome.hotwordPrivate.notifyHotwordRecognition('search', function() {}); | 90 chrome.hotwordPrivate.notifyHotwordRecognition('search', function() {}); |
| 91 }, | 91 }, |
| 92 | 92 |
| 93 /** | 93 /** |
| 94 * Handles a hotwordPrivate.onHotwordSessionRequested event. | 94 * Handles a hotwordPrivate.onHotwordSessionRequested event. |
| 95 * @private | 95 * @private |
| 96 */ | 96 */ |
| 97 handleSessionRequested_: function() { | 97 handleSessionRequested_: function() { |
| 98 hotword.debug('handleSessionRequested_: ' + this.sessionSource_); | 98 hotword.debug('handleSessionRequested_: ' + this.sessionSource_); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 this.removeListeners_(); | 146 this.removeListeners_(); |
| 147 this.stopSession_(); | 147 this.stopSession_(); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 return { | 152 return { |
| 153 BaseSessionManager: BaseSessionManager | 153 BaseSessionManager: BaseSessionManager |
| 154 }; | 154 }; |
| 155 }); | 155 }); |
| OLD | NEW |