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 cr.define('hotword', function() { | 5 cr.define('hotword', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Trivial container class for session information. | 9 * Trivial container class for session information. |
10 * @param {!hotword.constants.SessionSource} source Source of the hotword | 10 * @param {!hotword.constants.SessionSource} source Source of the hotword |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 * This is tracked separately from hotwordStatus_ because we need to restart | 99 * This is tracked separately from hotwordStatus_ because we need to restart |
100 * the hotword detector when this value changes. | 100 * the hotword detector when this value changes. |
101 * @private {boolean} | 101 * @private {boolean} |
102 */ | 102 */ |
103 this.loggingEnabled_ = false; | 103 this.loggingEnabled_ = false; |
104 | 104 |
105 // Get the initial status. | 105 // Get the initial status. |
106 chrome.hotwordPrivate.getStatus(this.handleStatus_.bind(this)); | 106 chrome.hotwordPrivate.getStatus(this.handleStatus_.bind(this)); |
107 | 107 |
108 // Setup the chime and insert into the page. | 108 // Setup the chime and insert into the page. |
| 109 // Set preload=none to prevent an audio output stream from being created |
| 110 // when the extension loads. |
| 111 this.chime_.preload = 'none'; |
109 this.chime_.src = chrome.extension.getURL( | 112 this.chime_.src = chrome.extension.getURL( |
110 hotword.constants.SHARED_MODULE_ROOT + '/audio/chime.wav'); | 113 hotword.constants.SHARED_MODULE_ROOT + '/audio/chime.wav'); |
111 document.body.appendChild(this.chime_); | 114 document.body.appendChild(this.chime_); |
112 } | 115 } |
113 | 116 |
114 /** | 117 /** |
115 * @enum {number} | 118 * @enum {number} |
116 * @private | 119 * @private |
117 */ | 120 */ |
118 StateManager.State_ = { | 121 StateManager.State_ = { |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 472 |
470 if (oldLocked != this.isLocked_) | 473 if (oldLocked != this.isLocked_) |
471 this.updateStateFromStatus_(); | 474 this.updateStateFromStatus_(); |
472 } | 475 } |
473 }; | 476 }; |
474 | 477 |
475 return { | 478 return { |
476 StateManager: StateManager | 479 StateManager: StateManager |
477 }; | 480 }; |
478 }); | 481 }); |
OLD | NEW |