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

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

Issue 14500010: [NaCl SDK] Google Drive example (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove key from build_app generated manifest Created 7 years, 7 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.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 * @param {Event} message_event A message event. message_event.data contains 178 * @param {Event} message_event A message event. message_event.data contains
179 * the data sent from the NaCl module. 179 * the data sent from the NaCl module.
180 */ 180 */
181 function handleMessage(message_event) { 181 function handleMessage(message_event) {
182 if (typeof message_event.data === 'string') { 182 if (typeof message_event.data === 'string') {
183 for (var type in defaultMessageTypes) { 183 for (var type in defaultMessageTypes) {
184 if (defaultMessageTypes.hasOwnProperty(type)) { 184 if (defaultMessageTypes.hasOwnProperty(type)) {
185 if (startsWith(message_event.data, type + ':')) { 185 if (startsWith(message_event.data, type + ':')) {
186 func = defaultMessageTypes[type]; 186 func = defaultMessageTypes[type];
187 func(message_event.data.slice(type.length + 1)); 187 func(message_event.data.slice(type.length + 1));
188 return;
188 } 189 }
189 } 190 }
190 } 191 }
191 } 192 }
192 193
193 if (typeof window.handleMessage !== 'undefined') { 194 if (typeof window.handleMessage !== 'undefined') {
194 window.handleMessage(message_event); 195 window.handleMessage(message_event);
195 } 196 }
196 } 197 }
197 198
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 var config = configs.indexOf(searchVars.config) !== -1 ? 300 var config = configs.indexOf(searchVars.config) !== -1 ?
300 searchVars.config : configs[0]; 301 searchVars.config : configs[0];
301 var pathFormat = body.dataset.path; 302 var pathFormat = body.dataset.path;
302 var path = pathFormat.replace('{tc}', tc).replace('{config}', config); 303 var path = pathFormat.replace('{tc}', tc).replace('{config}', config);
303 304
304 loadFunction(body.dataset.name, tc, path, body.dataset.width, 305 loadFunction(body.dataset.name, tc, path, body.dataset.width,
305 body.dataset.height); 306 body.dataset.height);
306 } 307 }
307 } 308 }
308 }); 309 });
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/sdk_files.list ('k') | native_client_sdk/src/examples/demo/drive/drive.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698