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 | 26 |
26 // Detect Chrome startup and make sure we get a chance to run. | 27 // Detect Chrome startup and make sure we get a chance to run. |
27 chrome.runtime.onStartup.addListener(function() { | 28 chrome.runtime.onStartup.addListener(function() { |
28 stateManager.updateStatus(); | 29 stateManager.updateStatus(); |
29 }); | 30 }); |
30 | 31 |
31 // Detect when hotword settings have changed. | 32 // Detect when hotword settings have changed. |
32 chrome.hotwordPrivate.onEnabledChanged.addListener(function() { | 33 chrome.hotwordPrivate.onEnabledChanged.addListener(function() { |
33 stateManager.updateStatus(); | 34 stateManager.updateStatus(); |
34 }); | 35 }); |
35 | 36 |
36 // Detect when the shared module containing the NaCL module and language model | 37 // Detect when the shared module containing the NaCL module and language model |
37 // is installed. | 38 // is installed. |
38 chrome.management.onInstalled.addListener(function(info) { | 39 chrome.management.onInstalled.addListener(function(info) { |
39 if (info.id == hotword.constants.SHARED_MODULE_ID) { | 40 if (info.id == hotword.constants.SHARED_MODULE_ID) { |
40 hotword.debug('Shared module installed, reloading extension.'); | 41 hotword.debug('Shared module installed, reloading extension.'); |
41 chrome.runtime.reload(); | 42 chrome.runtime.reload(); |
42 } | 43 } |
43 }); | 44 }); |
44 }()); | 45 }()); |
OLD | NEW |