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
3 // found in the LICENSE file.
9 * @fileoverview This extension provides hotword triggering capabilites to
12 * This extension contains all the JavaScript for loading and managing the
13 * hotword detector. The hotword detector and language model data will be
14 * provided by a shared module loaded from the web store.
16 * IMPORTANT! Whenever adding new events, the extension version number MUST be
21 var stateManager
= new hotword
.StateManager();
22 var pageAudioManager
= new hotword
.PageAudioManager(stateManager
);
23 var alwaysOnManager
= new hotword
.AlwaysOnManager(stateManager
);
24 var launcherManager
= new hotword
.LauncherManager(stateManager
);
25 var trainingManager
= new hotword
.TrainingManager(stateManager
);
27 // Detect when hotword settings have changed.
28 chrome
.hotwordPrivate
.onEnabledChanged
.addListener(function() {
29 stateManager
.updateStatus();
32 // Detect a request to delete the speaker model.
33 chrome
.hotwordPrivate
.onDeleteSpeakerModel
.addListener(function() {
34 hotword
.TrainingManager
.handleDeleteSpeakerModel();
37 // Detect a request for the speaker model existence.
38 chrome
.hotwordPrivate
.onSpeakerModelExists
.addListener(function() {
39 hotword
.TrainingManager
.handleSpeakerModelExists();
42 // Detect when the shared module containing the NaCL module and language model
44 chrome
.management
.onInstalled
.addListener(function(info
) {
45 if (info
.id
== hotword
.constants
.SHARED_MODULE_ID
) {
46 hotword
.debug('Shared module installed, reloading extension.');
47 chrome
.runtime
.reload();