Chromium Code Reviews| Index: extensions/renderer/resources/guest_view/extension_view_attributes.js |
| diff --git a/extensions/renderer/resources/guest_view/extension_view_attributes.js b/extensions/renderer/resources/guest_view/extension_view_attributes.js |
| index e71d2eac3e0821bb360703463beec652cd97ea61..73632b87b06041b4b1ff143a368f8a2eef9aa0e4 100644 |
| --- a/extensions/renderer/resources/guest_view/extension_view_attributes.js |
| +++ b/extensions/renderer/resources/guest_view/extension_view_attributes.js |
| @@ -57,9 +57,8 @@ ExtensionViewAttribute.prototype.defineProperty = function() { |
| // Called when the attribute's value changes. |
| ExtensionViewAttribute.prototype.maybeHandleMutation = |
| function(oldValue, newValue) { |
| - if (this.ignoreMutation) { |
| + if (this.ignoreMutation) |
| return; |
| - } |
| this.handleMutation(oldValue, newValue); |
| } |
| @@ -68,12 +67,27 @@ ExtensionViewAttribute.prototype.maybeHandleMutation = |
| ExtensionViewAttribute.prototype.handleMutation = |
| function(oldValue, newValue) {}; |
| +ExtensionViewAttribute.prototype.reset = function() { |
|
Fady Samuel
2015/02/16 19:26:28
Rebase?
apacible
2015/02/17 18:31:26
Not sure what this comment means. This is used in
|
| + this.setValueIgnoreMutation(); |
| +} |
| + |
| +// Attribute that handles extension binded to the extensionview. |
| +function ExtensionAttribute(extensionViewImpl) { |
| + ExtensionViewAttribute.call(this, ExtensionViewConstants.ATTRIBUTE_EXTENSION, |
| + extensionViewImpl); |
| +} |
| + |
| +ExtensionAttribute.prototype.__proto__ = ExtensionViewAttribute.prototype; |
| + |
| +ExtensionAttribute.prototype.handleMutation = function(oldValue, newValue) { |
| + this.setValueIgnoreMutation(oldValue); |
| +} |
| + |
| // Attribute that handles the location and navigation of the extensionview. |
| function SrcAttribute(extensionViewImpl) { |
| ExtensionViewAttribute.call(this, ExtensionViewConstants.ATTRIBUTE_SRC, |
| extensionViewImpl); |
| this.setupMutationObserver(); |
| - this.beforeFirstNavigation = true; |
| } |
| SrcAttribute.prototype.__proto__ = ExtensionViewAttribute.prototype; |
| @@ -115,27 +129,20 @@ SrcAttribute.prototype.parse = function() { |
| if (!this.extensionViewImpl.elementAttached || !this.getValue()) |
| return; |
| - if (!this.extensionViewImpl.guest.getId()) { |
| - if (this.beforeFirstNavigation) { |
| - this.beforeFirstNavigation = false; |
| - this.extensionViewImpl.createGuest(); |
| - } |
| + if (!this.extensionViewImpl.guest.getId()) |
| return; |
| - } |
| ExtensionViewInternal.navigate(this.extensionViewImpl.guest.getId(), |
| this.getValue()); |
| }; |
| -SrcAttribute.prototype.reset = function() { |
| - this.beforeFirstNavigation = true; |
| -}; |
| - |
| // ----------------------------------------------------------------------------- |
| // Sets up all of the extensionview attributes. |
| ExtensionViewImpl.prototype.setupExtensionViewAttributes = function() { |
| this.attributes = {}; |
| + this.attributes[ExtensionViewConstants.ATTRIBUTE_EXTENSION] = |
| + new ExtensionAttribute(this); |
| this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC] = |
| new SrcAttribute(this); |
| }; |