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

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

Issue 913393003: Restrict extensionview to chrome-extension:// (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/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() {
+ 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);
};

Powered by Google App Engine
This is Rietveld 408576698