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

Unified Diff: extensions/renderer/resources/guest_view/guest_view_container.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 side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/resources/guest_view/guest_view_container.js
diff --git a/extensions/renderer/resources/guest_view/guest_view_container.js b/extensions/renderer/resources/guest_view/guest_view_container.js
index ebcc3136b5e56a3b0bb67996f3da111ab60ebb61..ed66ba06591337d25b8c8171f76d579a73cfc7bd 100644
--- a/extensions/renderer/resources/guest_view/guest_view_container.js
+++ b/extensions/renderer/resources/guest_view/guest_view_container.js
@@ -22,7 +22,7 @@ function GuestViewContainer(element, viewType) {
this.guest = new GuestView(viewType);
this.setupAttributes();
- privates(this).browserPluginElement = this.createBrowserPluginElement();
+ privates(this).browserPluginElement = this.createInternalElement$();
Fady Samuel 2015/06/05 23:45:53 rename browserPluginElement to internalElement all
lazyboy 2015/06/05 23:52:37 Done.
this.setupFocusPropagation();
var shadowRoot = this.element.createShadowRoot();
shadowRoot.appendChild(privates(this).browserPluginElement);
@@ -84,7 +84,7 @@ GuestViewContainer.prototype.setupGuestProperty = function() {
});
};
-GuestViewContainer.prototype.createBrowserPluginElement = function() {
+GuestViewContainer.prototype.createInternalElement$ = function() {
// We create BrowserPlugin as a custom element in order to observe changes
// to attributes synchronously.
var browserPluginElement =
@@ -122,22 +122,27 @@ GuestViewContainer.prototype.attachWindow = function() {
return true;
};
+GuestViewContainer.prototype.onInternalInstanceID = function(
+ internalInstanceId) {
+ this.internalInstanceId = internalInstanceId;
+
+ // Track when the element resizes using the element resize callback.
+ GuestViewInternalNatives.RegisterElementResizeCallback(
+ this.internalInstanceId, this.weakWrapper(this.onElementResize));
+
+ if (!this.guest.getId()) {
+ return;
+ }
+ this.guest.attach(this.internalInstanceId,
+ this.viewInstanceId,
+ this.buildParams());
+};
+
GuestViewContainer.prototype.handleBrowserPluginAttributeMutation =
function(name, oldValue, newValue) {
if (name == 'internalinstanceid' && !oldValue && !!newValue) {
privates(this).browserPluginElement.removeAttribute('internalinstanceid');
- this.internalInstanceId = parseInt(newValue);
-
- // Track when the element resizes using the element resize callback.
- GuestViewInternalNatives.RegisterElementResizeCallback(
- this.internalInstanceId, this.weakWrapper(this.onElementResize));
-
- if (!this.guest.getId()) {
- return;
- }
- this.guest.attach(this.internalInstanceId,
- this.viewInstanceId,
- this.buildParams());
+ this.onInternalInstanceID(parseInt(newValue));
}
};

Powered by Google App Engine
This is Rietveld 408576698