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

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

Issue 16975007: Run shim's watchForTag on document.DOMContentLoaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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 (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 // Shim that simulates a <webview> tag via Mutation Observers. 5 // Shim that simulates a <webview> tag via Mutation Observers.
6 // 6 //
7 // The actual tag is implemented via the browser plugin. The internals of this 7 // The actual tag is implemented via the browser plugin. The internals of this
8 // are hidden via Shadow DOM. 8 // are hidden via Shadow DOM.
9 9
10 var appWindowNatives = requireNative('app_window_natives');
10 var forEach = require('utils').forEach; 11 var forEach = require('utils').forEach;
11 var watchForTag = require('tagWatcher').watchForTag; 12 var watchForTag = require('tagWatcher').watchForTag;
12 13
13 /** @type {Array.<string>} */ 14 /** @type {Array.<string>} */
14 var WEB_VIEW_ATTRIBUTES = ['name', 'src', 'partition', 'autosize', 'minheight', 15 var WEB_VIEW_ATTRIBUTES = ['name', 'src', 'partition', 'autosize', 'minheight',
15 'minwidth', 'maxheight', 'maxwidth']; 16 'minwidth', 'maxheight', 'maxwidth'];
16 17
17 18
18 // All exposed api methods for <webview>, these are forwarded to the browser 19 // All exposed api methods for <webview>, these are forwarded to the browser
19 // plugin. 20 // plugin.
(...skipping 17 matching lines...) Expand all
37 'loadabort' : ['url', 'isTopLevel', 'reason'], 38 'loadabort' : ['url', 'isTopLevel', 'reason'],
38 'loadcommit' : ['url', 'isTopLevel'], 39 'loadcommit' : ['url', 'isTopLevel'],
39 'loadredirect' : ['oldUrl', 'newUrl', 'isTopLevel'], 40 'loadredirect' : ['oldUrl', 'newUrl', 'isTopLevel'],
40 'loadstart' : ['url', 'isTopLevel'], 41 'loadstart' : ['url', 'isTopLevel'],
41 'loadstop' : [], 42 'loadstop' : [],
42 'responsive' : ['processId'], 43 'responsive' : ['processId'],
43 'sizechanged': ['oldHeight', 'oldWidth', 'newHeight', 'newWidth'], 44 'sizechanged': ['oldHeight', 'oldWidth', 'newHeight', 'newWidth'],
44 'unresponsive' : ['processId'] 45 'unresponsive' : ['processId']
45 }; 46 };
46 47
47 window.addEventListener('DOMContentLoaded', function() { 48 //window.addEventListener('DOMContentLoaded', function() {
48 watchForTag('WEBVIEW', function(addedNode) { new WebView(addedNode); }); 49 // watchForTag('WEBVIEW', function(addedNode) { new WebView(addedNode); });
49 }); 50 //});
50 51
51 /** 52 /**
52 * @constructor 53 * @constructor
53 */ 54 */
54 function WebView(webviewNode) { 55 function WebView(webviewNode) {
55 this.webviewNode_ = webviewNode; 56 this.webviewNode_ = webviewNode;
56 this.browserPluginNode_ = this.createBrowserPluginNode_(); 57 this.browserPluginNode_ = this.createBrowserPluginNode_();
57 var shadowRoot = this.webviewNode_.webkitCreateShadowRoot(); 58 var shadowRoot = this.webviewNode_.webkitCreateShadowRoot();
58 shadowRoot.appendChild(this.browserPluginNode_); 59 shadowRoot.appendChild(this.browserPluginNode_);
59 60
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 chrome.webview.insertCSS.apply(null, args); 377 chrome.webview.insertCSS.apply(null, args);
377 } 378 }
378 }; 379 };
379 380
380 /** 381 /**
381 * Implemented when the experimental API is available. 382 * Implemented when the experimental API is available.
382 * @private 383 * @private
383 */ 384 */
384 WebView.prototype.maybeSetupExperimentalAPI_ = function() {}; 385 WebView.prototype.maybeSetupExperimentalAPI_ = function() {};
385 386
387 var w = chrome.app.window.current();
388 window.console.log('***** current: ' + w);
not at google - send to devlin 2013/06/13 22:08:32 i presume this doesn't really do anything?
lazyboy 2013/06/14 00:09:50 Right, debug code, removed.
389
390 appWindowNatives.OnCurrentContextReady(function() {
391 window.console.log('******* OnCurrentContextReady ********');
392 document.addEventListener('DOMContentLoaded', function() {
not at google - send to devlin 2013/06/13 22:08:32 from reading the code it looks like this extra lis
lazyboy 2013/06/14 00:09:50 This is the point where (new) document is created.
393 window.console.log('shim.DOMContentLoaded');
394 watchForTag('WEBVIEW', function(addedNode) { new WebView(addedNode); });
395 });
396 });
397
386 exports.WebView = WebView; 398 exports.WebView = WebView;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698