Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: chrome/browser/resources/app_list/plugin_manager.js

Issue 229323003: Modifies handling of hotword NaCl module. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/app_list/speech_manager.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 /** 5 /**
6 * @fileoverview The manager of offline hotword speech recognizer plugin. 6 * @fileoverview The manager of offline hotword speech recognizer plugin.
7 */ 7 */
8 8
9 cr.define('speech', function() { 9 cr.define('speech', function() {
10 'use strict'; 10 'use strict';
(...skipping 21 matching lines...) Expand all
32 }; 32 };
33 33
34 /** 34 /**
35 * The regexp pattern of the hotword recognition result. 35 * The regexp pattern of the hotword recognition result.
36 */ 36 */
37 var recognitionPattern = /^(HotwordFiredEvent:|hotword)/; 37 var recognitionPattern = /^(HotwordFiredEvent:|hotword)/;
38 38
39 /** 39 /**
40 * @constructor 40 * @constructor
41 */ 41 */
42 function PluginManager(onReady, onRecognized) { 42 function PluginManager(prefix, onReady, onRecognized) {
43 this.state = PluginState.UNINITIALIZED; 43 this.state = PluginState.UNINITIALIZED;
44 this.onReady_ = onReady; 44 this.onReady_ = onReady;
45 this.onRecognized_ = onRecognized; 45 this.onRecognized_ = onRecognized;
46 this.samplingRate_ = null; 46 this.samplingRate_ = null;
47 this.config_ = null; 47 this.config_ = null;
48 var recognizer = $('recognizer'); 48 var recognizer = $('recognizer');
49 if (!recognizer) { 49 if (!recognizer) {
50 recognizer = document.createElement('EMBED'); 50 recognizer = document.createElement('EMBED');
51 recognizer.id = 'recognizer'; 51 recognizer.id = 'recognizer';
52 recognizer.type = 'application/x-nacl'; 52 recognizer.type = 'application/x-nacl';
53 recognizer.src = 'chrome://app-list/greconacl.nmf'; 53 recognizer.src = 'chrome://app-list/hotword_' + prefix + '.nmf';
54 recognizer.width = '1'; 54 recognizer.width = '1';
55 recognizer.height = '1'; 55 recognizer.height = '1';
56 document.body.appendChild(recognizer); 56 document.body.appendChild(recognizer);
57 } 57 }
58 recognizer.addEventListener('message', this.onMessage_.bind(this)); 58 recognizer.addEventListener('message', this.onMessage_.bind(this));
59 recognizer.addEventListener('load', this.onLoad_.bind(this)); 59 recognizer.addEventListener('load', this.onLoad_.bind(this));
60 }; 60 };
61 61
62 /** 62 /**
63 * The event handler of the plugin status. 63 * The event handler of the plugin status.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 PluginManager.prototype.sendAudioData = function(event) { 146 PluginManager.prototype.sendAudioData = function(event) {
147 if (this.state == PluginState.RECOGNIZING) 147 if (this.state == PluginState.RECOGNIZING)
148 $('recognizer').postMessage(event.data.buffer); 148 $('recognizer').postMessage(event.data.buffer);
149 }; 149 };
150 150
151 return { 151 return {
152 PluginManager: PluginManager, 152 PluginManager: PluginManager,
153 PluginState: PluginState, 153 PluginState: PluginState,
154 }; 154 };
155 }); 155 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/app_list/speech_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698