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

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: Updated Created 6 years, 3 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 var guestViewInternalNatives = requireNative('guest_view_internal'); 9 var guestViewInternalNatives = requireNative('guest_view_internal');
10 10
(...skipping 25 matching lines...) Expand all
36 // We create BrowserPlugin as a custom element in order to observe changes 36 // We create BrowserPlugin as a custom element in order to observe changes
37 // to attributes synchronously. 37 // to attributes synchronously.
38 var browserPluginNode = new AppViewInternal.BrowserPlugin(); 38 var browserPluginNode = new AppViewInternal.BrowserPlugin();
39 privates(browserPluginNode).internal = this; 39 privates(browserPluginNode).internal = this;
40 return browserPluginNode; 40 return browserPluginNode;
41 }; 41 };
42 42
43 AppViewInternal.prototype.connect = function(app, data, callback) { 43 AppViewInternal.prototype.connect = function(app, data, callback) {
44 var createParams = { 44 var createParams = {
45 'appId': app, 45 'appId': app,
46 'data': data 46 'data': data || {}
47 }; 47 };
48 var self = this; 48 var self = this;
49 GuestViewInternal.createGuest( 49 GuestViewInternal.createGuest(
50 'appview', 50 'appview',
51 createParams, 51 createParams,
52 function(guestInstanceId) { 52 function(guestInstanceId) {
53 if (!guestInstanceId) { 53 if (!guestInstanceId) {
54 this.browserPluginNode.style.visibility = 'hidden'; 54 this.browserPluginNode.style.visibility = 'hidden';
55 var errorMsg = 'Unable to connect to app "' + app + '".'; 55 var errorMsg = 'Unable to connect to app "' + app + '".';
56 window.console.warn(errorMsg); 56 window.console.warn(errorMsg);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 var useCapture = true; 129 var useCapture = true;
130 window.addEventListener('readystatechange', function listener(event) { 130 window.addEventListener('readystatechange', function listener(event) {
131 if (document.readyState == 'loading') 131 if (document.readyState == 'loading')
132 return; 132 return;
133 133
134 registerBrowserPluginElement(); 134 registerBrowserPluginElement();
135 registerAppViewElement(); 135 registerAppViewElement();
136 window.removeEventListener(event.type, listener, useCapture); 136 window.removeEventListener(event.type, listener, useCapture);
137 }, useCapture); 137 }, useCapture);
OLDNEW
« no previous file with comments | « chrome/browser/apps/app_view_browsertest.cc ('k') | chrome/test/data/extensions/platform_apps/app_view/shim/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698