Chromium Code Reviews| Index: chrome/browser/resources/hotword/manager.js |
| diff --git a/chrome/browser/resources/hotword/manager.js b/chrome/browser/resources/hotword/manager.js |
| index 7315bbe7af58cc5aa2728dc62a6b466cc1e13e84..de3239358192d143557cce1c71afe13dfd9c7bea 100644 |
| --- a/chrome/browser/resources/hotword/manager.js |
| +++ b/chrome/browser/resources/hotword/manager.js |
| @@ -13,3 +13,37 @@ |
| * provided by a shared module loaded from the web store. |
| */ |
| +// Hotwording state. |
| +var stateManager = new hotword.StateManager(); |
| + |
| +// Detect Chrome startup and make sure we get a chance to run. |
| +chrome.runtime.onStartup.addListener(function() { |
| + stateManager.updateStatus(); |
| +}.bind(this)); |
|
Dan Beam
2014/08/26 18:40:51
remove .bind(this)
Anand Mistry (off Chromium)
2014/08/27 07:10:55
Done.
|
| + |
| +// Detect when hotword settings have changed. |
| +chrome.hotwordPrivate.onEnabledChanged.addListener(function() { |
| + stateManager.updateStatus(); |
| +}.bind(this)); |
|
Dan Beam
2014/08/26 18:40:51
remove .bind(this)
Anand Mistry (off Chromium)
2014/08/27 07:10:55
Done.
|
| + |
| +// Detect when the shared module containing the NaCL module and language model |
| +// is installed. |
| +chrome.management.onInstalled.addListener(function(info) { |
| + if (info.id == hotword.constants.SHARED_MODULE_ID) { |
|
Dan Beam
2014/08/26 18:40:51
nit: no curlies
Anand Mistry (off Chromium)
2014/08/27 07:10:55
Looking into this, the style guide gives no prefer
Dan Beam
2014/08/27 20:08:36
chrome is quite consistent on this rule.
Anand Mistry (off Chromium)
2014/08/28 00:59:25
Thanks. Both those pages point to the google style
|
| + chrome.runtime.reload(); |
| + } |
| +}); |
| + |
| +// Detect when a session has requested to be started and stopped. |
| +chrome.hotwordPrivate.onHotwordSessionRequested.addListener(function() { |
| + // TODO(amistry): This event should change state depending on whether the user |
| + // has enabled always-on hotwording. But for now, always signal the start of a |
| + // hotwording session. This allows this extension to work with the app |
| + // launcher in the current state. |
| + chrome.hotwordPrivate.setHotwordSessionState(true, function() {}); |
| +}); |
| + |
| +chrome.hotwordPrivate.onHotwordSessionStopped.addListener(function() { |
| + chrome.hotwordPrivate.setHotwordSessionState(false, function() {}); |
| +}); |
| + |