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

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

Issue 1165773004: Extract the element implementation logic to function mods in <webview>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@qui
Patch Set: Clean up Created 5 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 // 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 element.style.width = newWidth + 'px'; 130 element.style.width = newWidth + 'px';
131 element.style.height = newHeight + 'px'; 131 element.style.height = newHeight + 'px';
132 // Only fire the DOM event if the size of the <webview> has actually 132 // Only fire the DOM event if the size of the <webview> has actually
133 // changed. 133 // changed.
134 this.dispatchEvent(webViewEvent); 134 this.dispatchEvent(webViewEvent);
135 } 135 }
136 }; 136 };
137 137
138 WebViewImpl.prototype.createGuest = function() { 138 WebViewImpl.prototype.createGuest = function() {
139 this.guest.create(this.buildParams(), function() { 139 this.guest.create(this.buildParams(), function() {
140 this.attachWindow(); 140 this.attachWindow$();
141 }.bind(this)); 141 }.bind(this));
142 }; 142 };
143 143
144 WebViewImpl.prototype.onFrameNameChanged = function(name) { 144 WebViewImpl.prototype.onFrameNameChanged = function(name) {
145 this.attributes[WebViewConstants.ATTRIBUTE_NAME].setValueIgnoreMutation(name); 145 this.attributes[WebViewConstants.ATTRIBUTE_NAME].setValueIgnoreMutation(name);
146 }; 146 };
147 147
148 // Updates state upon loadcommit. 148 // Updates state upon loadcommit.
149 WebViewImpl.prototype.onLoadCommit = function( 149 WebViewImpl.prototype.onLoadCommit = function(
150 baseUrlForDataUrl, currentEntryIndex, entryCount, 150 baseUrlForDataUrl, currentEntryIndex, entryCount,
(...skipping 20 matching lines...) Expand all
171 var params = { 'initialZoomFactor': this.cachedZoomFactor, 171 var params = { 'initialZoomFactor': this.cachedZoomFactor,
172 'userAgentOverride': this.userAgentOverride }; 172 'userAgentOverride': this.userAgentOverride };
173 for (var i in this.attributes) { 173 for (var i in this.attributes) {
174 var value = this.attributes[i].getValueIfDirty(); 174 var value = this.attributes[i].getValueIfDirty();
175 if (value) 175 if (value)
176 params[i] = value; 176 params[i] = value;
177 } 177 }
178 return params; 178 return params;
179 }; 179 };
180 180
181 WebViewImpl.prototype.attachWindow = function(opt_guestInstanceId) { 181 WebViewImpl.prototype.attachWindow$ = function(opt_guestInstanceId) {
182 // If |opt_guestInstanceId| was provided, then a different existing guest is 182 // If |opt_guestInstanceId| was provided, then a different existing guest is
183 // being attached to this webview, and the current one will get destroyed. 183 // being attached to this webview, and the current one will get destroyed.
184 if (opt_guestInstanceId) { 184 if (opt_guestInstanceId) {
185 if (this.guest.getId() == opt_guestInstanceId) { 185 if (this.guest.getId() == opt_guestInstanceId) {
186 return true; 186 return true;
187 } 187 }
188 this.guest.destroy(); 188 this.guest.destroy();
189 this.guest = new GuestView('webview', opt_guestInstanceId); 189 this.guest = new GuestView('webview', opt_guestInstanceId);
190 } 190 }
191 191
(...skipping 25 matching lines...) Expand all
217 }.bind(this)); 217 }.bind(this));
218 }; 218 };
219 219
220 // Implemented when the ChromeWebView API is available. 220 // Implemented when the ChromeWebView API is available.
221 WebViewImpl.prototype.maybeSetupContextMenus = function() {}; 221 WebViewImpl.prototype.maybeSetupContextMenus = function() {};
222 222
223 GuestViewContainer.registerElement(WebViewImpl); 223 GuestViewContainer.registerElement(WebViewImpl);
224 224
225 // Exports. 225 // Exports.
226 exports.WebViewImpl = WebViewImpl; 226 exports.WebViewImpl = WebViewImpl;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698