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

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

Issue 950963002: Decouple WebViewImpl from WebView attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed broken test Created 5 years, 9 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
« no previous file with comments | « no previous file | extensions/renderer/resources/guest_view/web_view_attributes.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 // This module implements WebView (<webview>) as a custom element that wraps a 5 // This module implements WebView (<webview>) as a custom element that wraps a
6 // BrowserPlugin object element. The object element is hidden within 6 // BrowserPlugin object element. The object element is hidden within
7 // the shadow DOM of the WebView element. 7 // the shadow DOM of the WebView element.
8 8
9 var DocumentNatives = requireNative('document_natives'); 9 var DocumentNatives = requireNative('document_natives');
10 var GuestView = require('guestView').GuestView; 10 var GuestView = require('guestView').GuestView;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 createDefaultApiMethod(apiMethods[i]); 54 createDefaultApiMethod(apiMethods[i]);
55 } 55 }
56 } 56 }
57 57
58 // Forward proto.foo* method calls to WebViewImpl.foo*. 58 // Forward proto.foo* method calls to WebViewImpl.foo*.
59 GuestViewContainer.forwardApiMethods(proto, apiMethods); 59 GuestViewContainer.forwardApiMethods(proto, apiMethods);
60 }; 60 };
61 61
62 // Initiates navigation once the <webview> element is attached to the DOM. 62 // Initiates navigation once the <webview> element is attached to the DOM.
63 WebViewImpl.prototype.onElementAttached = function() { 63 WebViewImpl.prototype.onElementAttached = function() {
64 this.attributes[WebViewConstants.ATTRIBUTE_SRC].parse(); 64 for (var i in this.attributes) {
65 this.attributes[i].attach();
66 }
65 }; 67 };
66 68
67 // Resets some state upon detaching <webview> element from the DOM. 69 // Resets some state upon detaching <webview> element from the DOM.
68 WebViewImpl.prototype.onElementDetached = function() { 70 WebViewImpl.prototype.onElementDetached = function() {
69 this.guest.destroy(); 71 this.guest.destroy();
70 for (var i in this.attributes) { 72 for (var i in this.attributes) {
71 this.attributes[i].reset(); 73 this.attributes[i].detach();
72 } 74 }
73 }; 75 };
74 76
75 // Sets the <webview>.request property. 77 // Sets the <webview>.request property.
76 WebViewImpl.prototype.setRequestPropertyOnWebViewElement = function(request) { 78 WebViewImpl.prototype.setRequestPropertyOnWebViewElement = function(request) {
77 Object.defineProperty( 79 Object.defineProperty(
78 this.element, 80 this.element,
79 'request', 81 'request',
80 { 82 {
81 value: request, 83 value: request,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 WebViewImpl.prototype.setupExperimentalContextMenus = function() {}; 233 WebViewImpl.prototype.setupExperimentalContextMenus = function() {};
232 WebViewImpl.prototype.maybeSetupExperimentalChromeWebViewEvents = 234 WebViewImpl.prototype.maybeSetupExperimentalChromeWebViewEvents =
233 function(request) { 235 function(request) {
234 return request; 236 return request;
235 }; 237 };
236 238
237 GuestViewContainer.registerElement(WebViewImpl); 239 GuestViewContainer.registerElement(WebViewImpl);
238 240
239 // Exports. 241 // Exports.
240 exports.WebViewImpl = WebViewImpl; 242 exports.WebViewImpl = WebViewImpl;
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/resources/guest_view/web_view_attributes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698