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

Unified Diff: extensions/renderer/resources/guest_view/guest_view_container.js

Issue 1026703004: Refactored extensionOptions to use the new guestViewAttributes module. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment. 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 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 3a3f837c7ad46d64f0183113d3aa63acc50158d7..35c6991039cec6152b94e483f75a1c3e0cc547fa 100644
--- a/extensions/renderer/resources/guest_view/guest_view_container.js
+++ b/extensions/renderer/resources/guest_view/guest_view_container.js
@@ -12,6 +12,7 @@ var IdGenerator = requireNative('id_generator');
function GuestViewContainer(element, viewType) {
privates(element).internal = this;
+ this.attributes = {};
this.element = element;
this.elementAttached = false;
this.viewInstanceId = IdGenerator.GetNextId();
@@ -19,10 +20,10 @@ function GuestViewContainer(element, viewType) {
this.setupGuestProperty();
this.guest = new GuestView(viewType);
+ this.setupAttributes();
privates(this).browserPluginElement = this.createBrowserPluginElement();
this.setupFocusPropagation();
-
var shadowRoot = this.element.createShadowRoot();
shadowRoot.appendChild(privates(this).browserPluginElement);
}
@@ -168,11 +169,9 @@ GuestViewContainer.prototype.dispatchEvent = function(event) {
// Implemented by the specific view type, if needed.
GuestViewContainer.prototype.buildContainerParams = function() { return {}; };
-// TODO(paulmeyer): remove once all view types use attribute objects.
-GuestViewContainer.prototype.handleAttributeMutation = function(
- attributeName, oldValue, newValue) {};
GuestViewContainer.prototype.onElementAttached = function() {};
GuestViewContainer.prototype.onElementDetached = function() {};
+GuestViewContainer.prototype.setupAttributes = function() {};
// Registers the browser plugin <object> custom element. |viewType| is the
// name of the specific guestview container (e.g. 'webview').
@@ -230,10 +229,12 @@ function registerGuestViewElement(guestViewContainerType) {
proto.attributeChangedCallback = function(name, oldValue, newValue) {
var internal = privates(this).internal;
- if (!internal) {
+ if (!internal || !internal.attributes[name]) {
return;
}
- internal.handleAttributeMutation(name, oldValue, newValue);
+
+ // Let the changed attribute handle its own mutation.
+ internal.attributes[name].maybeHandleMutation(oldValue, newValue);
};
proto.detachedCallback = function() {

Powered by Google App Engine
This is Rietveld 408576698