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

Side by Side Diff: remoting/webapp/crd/js/client_plugin_impl.js

Issue 687873003: Allow the background page to get an OAuth token for apps v1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move jsonParseSafe into base namespace. Created 6 years, 1 month 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
« no previous file with comments | « remoting/webapp/base/js/base.js ('k') | remoting/webapp/crd/js/event_handlers.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 (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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Class that wraps low-level details of interacting with the client plugin. 7 * Class that wraps low-level details of interacting with the client plugin.
8 * 8 *
9 * This abstracts a <embed> element and controls the plugin which does 9 * This abstracts a <embed> element and controls the plugin which does
10 * the actual remoting work. It also handles differences between 10 * the actual remoting work. It also handles differences between
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 }; 285 };
286 286
287 /** 287 /**
288 * @param {string|{method:string, data:Object.<string,*>}} 288 * @param {string|{method:string, data:Object.<string,*>}}
289 * rawMessage Message from the plugin. 289 * rawMessage Message from the plugin.
290 * @private 290 * @private
291 */ 291 */
292 remoting.ClientPluginImpl.prototype.handleMessage_ = function(rawMessage) { 292 remoting.ClientPluginImpl.prototype.handleMessage_ = function(rawMessage) {
293 var message = 293 var message =
294 /** @type {{method:string, data:Object.<string,*>}} */ 294 /** @type {{method:string, data:Object.<string,*>}} */
295 ((typeof(rawMessage) == 'string') ? jsonParseSafe(rawMessage) 295 ((typeof(rawMessage) == 'string') ? base.jsonParseSafe(rawMessage)
296 : rawMessage); 296 : rawMessage);
297 if (!message || !('method' in message) || !('data' in message)) { 297 if (!message || !('method' in message) || !('data' in message)) {
298 console.error('Received invalid message from the plugin:', rawMessage); 298 console.error('Received invalid message from the plugin:', rawMessage);
299 return; 299 return;
300 } 300 }
301 301
302 try { 302 try {
303 this.handleMessageMethod_(message); 303 this.handleMessageMethod_(message);
304 } catch(e) { 304 } catch(e) {
305 console.error(/** @type {*} */ (e)); 305 console.error(/** @type {*} */ (e));
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 remoting.DefaultClientPluginFactory.prototype.preloadPlugin = function() { 961 remoting.DefaultClientPluginFactory.prototype.preloadPlugin = function() {
962 if (remoting.settings.CLIENT_PLUGIN_TYPE != 'pnacl') { 962 if (remoting.settings.CLIENT_PLUGIN_TYPE != 'pnacl') {
963 return; 963 return;
964 } 964 }
965 965
966 var plugin = remoting.ClientPluginImpl.createPluginElement_(); 966 var plugin = remoting.ClientPluginImpl.createPluginElement_();
967 plugin.addEventListener( 967 plugin.addEventListener(
968 'loadend', function() { document.body.removeChild(plugin); }, false); 968 'loadend', function() { document.body.removeChild(plugin); }, false);
969 document.body.appendChild(plugin); 969 document.body.appendChild(plugin);
970 }; 970 };
OLDNEW
« no previous file with comments | « remoting/webapp/base/js/base.js ('k') | remoting/webapp/crd/js/event_handlers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698