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

Side by Side Diff: chrome/renderer/resources/extensions/app_view.js

Issue 464213005: Allow undefined data param to <appview>.connect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
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 var DocumentNatives = requireNative('document_natives'); 5 var DocumentNatives = requireNative('document_natives');
6 var GuestViewInternal = 6 var GuestViewInternal =
7 require('binding').Binding.create('guestViewInternal').generate(); 7 require('binding').Binding.create('guestViewInternal').generate();
8 var IdGenerator = requireNative('id_generator'); 8 var IdGenerator = requireNative('id_generator');
9 9
10 function AppViewInternal(appviewNode) { 10 function AppViewInternal(appviewNode) {
(...skipping 24 matching lines...) Expand all
35 // We create BrowserPlugin as a custom element in order to observe changes 35 // We create BrowserPlugin as a custom element in order to observe changes
36 // to attributes synchronously. 36 // to attributes synchronously.
37 var browserPluginNode = new AppViewInternal.BrowserPlugin(); 37 var browserPluginNode = new AppViewInternal.BrowserPlugin();
38 privates(browserPluginNode).internal = this; 38 privates(browserPluginNode).internal = this;
39 return browserPluginNode; 39 return browserPluginNode;
40 }; 40 };
41 41
42 AppViewInternal.prototype.connect = function(app, data, callback) { 42 AppViewInternal.prototype.connect = function(app, data, callback) {
43 var createParams = { 43 var createParams = {
44 'appId': app, 44 'appId': app,
45 'data': data 45 'data': data || {}
46 }; 46 };
47 var self = this; 47 var self = this;
48 GuestViewInternal.createGuest( 48 GuestViewInternal.createGuest(
49 'appview', 49 'appview',
50 createParams, 50 createParams,
51 function(instanceId) { 51 function(instanceId) {
52 if (!instanceId) { 52 if (!instanceId) {
53 self.browserPluginNode.style.visibility = 'hidden'; 53 self.browserPluginNode.style.visibility = 'hidden';
54 var errorMsg = 'Unable to connect to app "' + app + '".'; 54 var errorMsg = 'Unable to connect to app "' + app + '".';
55 window.console.warn(errorMsg); 55 window.console.warn(errorMsg);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 var useCapture = true; 125 var useCapture = true;
126 window.addEventListener('readystatechange', function listener(event) { 126 window.addEventListener('readystatechange', function listener(event) {
127 if (document.readyState == 'loading') 127 if (document.readyState == 'loading')
128 return; 128 return;
129 129
130 registerBrowserPluginElement(); 130 registerBrowserPluginElement();
131 registerAppViewElement(); 131 registerAppViewElement();
132 window.removeEventListener(event.type, listener, useCapture); 132 window.removeEventListener(event.type, listener, useCapture);
133 }, useCapture); 133 }, useCapture);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698