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. |
(...skipping 15 matching lines...) Expand all Loading... |
26 }); | 26 }); |
27 | 27 |
28 // Detect when hotword settings have changed. | 28 // Detect when hotword settings have changed. |
29 chrome.hotwordPrivate.onEnabledChanged.addListener(function() { | 29 chrome.hotwordPrivate.onEnabledChanged.addListener(function() { |
30 stateManager.updateStatus(); | 30 stateManager.updateStatus(); |
31 }); | 31 }); |
32 | 32 |
33 // Detect when the shared module containing the NaCL module and language model | 33 // Detect when the shared module containing the NaCL module and language model |
34 // is installed. | 34 // is installed. |
35 chrome.management.onInstalled.addListener(function(info) { | 35 chrome.management.onInstalled.addListener(function(info) { |
36 if (info.id == hotword.constants.SHARED_MODULE_ID) | 36 if (info.id == hotword.constants.SHARED_MODULE_ID) { |
| 37 hotword.debug('Shared module installed, reloading extension.'); |
37 chrome.runtime.reload(); | 38 chrome.runtime.reload(); |
| 39 } |
38 }); | 40 }); |
39 | 41 |
40 // Detect when a session has requested to be started and stopped. | 42 // Detect when a session has requested to be started and stopped. |
41 chrome.hotwordPrivate.onHotwordSessionRequested.addListener(function() { | 43 chrome.hotwordPrivate.onHotwordSessionRequested.addListener(function() { |
| 44 hotword.debug('hotwordPrivate.onHotwordSessionRequested'); |
42 // TODO(amistry): This event should change state depending on whether the | 45 // TODO(amistry): This event should change state depending on whether the |
43 // user has enabled always-on hotwording. But for now, always signal the | 46 // user has enabled always-on hotwording. But for now, always signal the |
44 // start of a hotwording session. This allows this extension to work with | 47 // start of a hotwording session. This allows this extension to work with |
45 // the app launcher in the current state. | 48 // the app launcher in the current state. |
46 stateManager.startSession( | 49 stateManager.startSession( |
47 hotword.constants.SessionSource.LAUNCHER, | 50 hotword.constants.SessionSource.LAUNCHER, |
48 function() { | 51 function() { |
49 chrome.hotwordPrivate.setHotwordSessionState(true, function() {}); | 52 chrome.hotwordPrivate.setHotwordSessionState(true, function() {}); |
50 }); | 53 }); |
51 }); | 54 }); |
52 | 55 |
53 chrome.hotwordPrivate.onHotwordSessionStopped.addListener(function() { | 56 chrome.hotwordPrivate.onHotwordSessionStopped.addListener(function() { |
| 57 hotword.debug('hotwordPrivate.onHotwordSessionStopped'); |
54 stateManager.stopSession(hotword.constants.SessionSource.LAUNCHER); | 58 stateManager.stopSession(hotword.constants.SessionSource.LAUNCHER); |
55 chrome.hotwordPrivate.setHotwordSessionState(false, function() {}); | 59 chrome.hotwordPrivate.setHotwordSessionState(false, function() {}); |
56 }); | 60 }); |
57 }()); | 61 }()); |
OLD | NEW |