| 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 (function() { | 5 (function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * @fileoverview This extension provides hotword triggering capabilites to | 9 * @fileoverview This extension provides hotword triggering capabilites to |
| 10 * Chrome. | 10 * Chrome. |
| 11 * | 11 * |
| 12 * This extension contains all the JavaScript for loading and managing the | 12 * This extension contains all the JavaScript for loading and managing the |
| 13 * hotword detector. The hotword detector and language model data will be | 13 * hotword detector. The hotword detector and language model data will be |
| 14 * provided by a shared module loaded from the web store. | 14 * provided by a shared module loaded from the web store. |
| 15 * | 15 * |
| 16 * IMPORTANT! Whenever adding new events, the extension version number MUST be | 16 * IMPORTANT! Whenever adding new events, the extension version number MUST be |
| 17 * incremented. | 17 * incremented. |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 // Hotwording state. | 20 // Hotwording state. |
| 21 var stateManager = new hotword.StateManager(); | 21 var stateManager = new hotword.StateManager(); |
| 22 var pageAudioManager = new hotword.PageAudioManager(stateManager); | 22 var pageAudioManager = new hotword.PageAudioManager(stateManager); |
| 23 var alwaysOnManager = new hotword.AlwaysOnManager(stateManager); | 23 var alwaysOnManager = new hotword.AlwaysOnManager(stateManager); |
| 24 var launcherManager = new hotword.LauncherManager(stateManager); | 24 var launcherManager = new hotword.LauncherManager(stateManager); |
| 25 var trainingManager = new hotword.TrainingManager(stateManager); | 25 var trainingManager = new hotword.TrainingManager(stateManager); |
| 26 | 26 |
| 27 // Detect when hotword settings have changed. | 27 // Detect when hotword settings have changed. |
| 28 chrome.hotwordPrivate.onEnabledChanged.addListener(function() { | 28 chrome.hotwordPrivate.onEnabledChanged.addListener(function() { |
| 29 stateManager.updateStatus(); | 29 stateManager.updateStatus(); |
| 30 }); | 30 }); |
| 31 | 31 |
| 32 // Detect a request to delete the speaker model. | 32 // Detect a request to delete the speaker model. |
| 33 chrome.hotwordPrivate.onDeleteSpeakerModel.addListener(function() { | 33 chrome.hotwordPrivate.onDeleteSpeakerModel.addListener(function() { |
| 34 hotword.TrainingManager.handleDeleteSpeakerModel(); | 34 hotword.TrainingManager.handleDeleteSpeakerModel(); |
| 35 }); | 35 }); |
| 36 | 36 |
| 37 // Detect a request for the speaker model existence. | 37 // Detect a request for the speaker model existence. |
| 38 chrome.hotwordPrivate.onSpeakerModelExists.addListener(function() { | 38 chrome.hotwordPrivate.onSpeakerModelExists.addListener(function() { |
| 39 hotword.TrainingManager.handleSpeakerModelExists(); | 39 hotword.TrainingManager.handleSpeakerModelExists(); |
| 40 }); | 40 }); |
| 41 | 41 |
| 42 // Detect when the shared module containing the NaCL module and language model | 42 // Detect when the shared module containing the NaCL module and language model |
| 43 // is installed. | 43 // is installed. |
| 44 chrome.management.onInstalled.addListener(function(info) { | 44 chrome.management.onInstalled.addListener(function(info) { |
| 45 if (info.id == hotword.constants.SHARED_MODULE_ID) { | 45 if (info.id == hotword.constants.SHARED_MODULE_ID) { |
| 46 hotword.debug('Shared module installed, reloading extension.'); | 46 hotword.debug('Shared module installed, reloading extension.'); |
| 47 chrome.runtime.reload(); | 47 chrome.runtime.reload(); |
| 48 } | 48 } |
| 49 }); | 49 }); |
| 50 }()); | 50 }()); |
| OLD | NEW |