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

Side by Side Diff: native_client_sdk/src/examples/common.js

Issue 10827363: Add Linux Host builds to NaCl SDK (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Javascript module pattern: 5 // Javascript module pattern:
6 // see http://en.wikipedia.org/wiki/Unobtrusive_JavaScript#Namespaces 6 // see http://en.wikipedia.org/wiki/Unobtrusive_JavaScript#Namespaces
7 // In essence, we define an anonymous function which is immediately called and 7 // In essence, we define an anonymous function which is immediately called and
8 // returns a new object. The new object contains only the exported definitions; 8 // returns a new object. The new object contains only the exported definitions;
9 // all other definitions in the anonymous function are inaccessible to external 9 // all other definitions in the anonymous function are inaccessible to external
10 // code. 10 // code.
11 var common = (function () { 11 var common = (function () {
12 12
13 /** 13 /**
14 * Create the Native Client <embed> element as a child of the DOM element 14 * Create the Native Client <embed> element as a child of the DOM element
15 * named "listener". 15 * named "listener".
16 * 16 *
17 * @param {string} name The name of the example. 17 * @param {string} name The name of the example.
18 * @param {string} tool The name of the toolchain, e.g. "glibc", "newlib" etc. 18 * @param {string} tool The name of the toolchain, e.g. "glibc", "newlib" etc.
binji 2012/08/16 00:17:52 add config param doc
noelallen1 2012/08/16 17:58:30 Done.
19 * @param {number} width The width to create the plugin. 19 * @param {number} width The width to create the plugin.
20 * @param {number} height The height to create the plugin. 20 * @param {number} height The height to create the plugin.
21 */ 21 */
22 function createNaClModule(name, tool, config, width, height) { 22 function createNaClModule(name, tool, config, width, height) {
23 var moduleEl = document.createElement('embed'); 23 var moduleEl = document.createElement('embed');
24 moduleEl.setAttribute('name', 'nacl_module'); 24 moduleEl.setAttribute('name', 'nacl_module');
25 moduleEl.setAttribute('id', 'nacl_module'); 25 moduleEl.setAttribute('id', 'nacl_module');
26 moduleEl.setAttribute('width', width); 26 moduleEl.setAttribute('width', width);
27 moduleEl.setAttribute('height',height); 27 moduleEl.setAttribute('height',height);
28 moduleEl.setAttribute('src', tool + '/' + config + '/' + name + '.nmf'); 28 moduleEl.setAttribute('src', tool + '/' + config + '/' + name + '.nmf');
29 moduleEl.setAttribute('type', 'application/x-nacl'); 29 moduleEl.setAttribute('type', 'application/x-nacl');
30 if (tool == 'win' || tool == 'linux' || tool == 'mac') {
31 mimename = 'application/x-ppapi-' + config.toLowerCase();
binji 2012/08/16 00:17:52 s/mimename/mimetype/?
noelallen1 2012/08/16 17:58:30 Done.
32 moduleEl.setAttribute('type', mimename);
33 }
30 34
31 // The <EMBED> element is wrapped inside a <DIV>, which has both a 'load' 35 // The <EMBED> element is wrapped inside a <DIV>, which has both a 'load'
32 // and a 'message' event listener attached. This wrapping method is used 36 // and a 'message' event listener attached. This wrapping method is used
33 // instead of attaching the event listeners directly to the <EMBED> element 37 // instead of attaching the event listeners directly to the <EMBED> element
34 // to ensure that the listeners are active before the NaCl module 'load' 38 // to ensure that the listeners are active before the NaCl module 'load'
35 // event fires. 39 // event fires.
36 var listenerDiv = document.getElementById('listener'); 40 var listenerDiv = document.getElementById('listener');
37 listenerDiv.appendChild(moduleEl); 41 listenerDiv.appendChild(moduleEl);
38 } 42 }
39 43
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 naclModule: null, 202 naclModule: null,
199 203
200 onload: pageDidLoad, 204 onload: pageDidLoad,
201 attachDefaultListeners: attachDefaultListeners, 205 attachDefaultListeners: attachDefaultListeners,
202 createNaClModule: createNaClModule, 206 createNaClModule: createNaClModule,
203 hideModule: hideModule, 207 hideModule: hideModule,
204 updateStatus: updateStatus 208 updateStatus: updateStatus
205 }; 209 };
206 210
207 }()); 211 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698