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

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

Issue 873933002: Add <extensionview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move test files out of shim/ directory Created 5 years, 11 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.js
diff --git a/extensions/renderer/resources/guest_view/extension_view.js b/extensions/renderer/resources/guest_view/extension_view.js
new file mode 100644
index 0000000000000000000000000000000000000000..fc560ff349f7d575407f9b0de442063181d4475c
--- /dev/null
+++ b/extensions/renderer/resources/guest_view/extension_view.js
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This module implements the ExtensionView <extensionview>.
+
+var GuestViewContainer = require('guestViewContainer').GuestViewContainer;
+var ExtensionViewConstants =
+ require('extensionViewConstants').ExtensionViewConstants;
+var ExtensionViewInternal =
+ require('extensionViewInternal').ExtensionViewInternal;
+
+function ExtensionViewImpl(extensionviewElement) {
+ GuestViewContainer.call(this, extensionviewElement, 'extensionview');
+ this.setupExtensionViewAttributes();
+}
+
+ExtensionViewImpl.prototype.__proto__ = GuestViewContainer.prototype;
+
+ExtensionViewImpl.VIEW_TYPE = 'ExtensionView';
+
+ExtensionViewImpl.setupElement = function(proto) {
+ var apiMethods = [
+ 'navigate'
+ ];
+
+ GuestViewContainer.forwardApiMethods(proto, apiMethods);
+};
+
+ExtensionViewImpl.prototype.createGuest = function() {
+ this.guest.create(this.buildParams(), function() {
+ this.attachWindow();
+ }.bind(this));
+};
+
+ExtensionViewImpl.prototype.onElementAttached = function() {
+ this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC].parse();
+};
+
+ExtensionViewImpl.prototype.buildContainerParams = function() {
+ var params = {};
+ for (var i in this.attributes) {
+ params[i] = this.attributes[i].getValue();
+ }
+ return params;
+};
+
+// This observer monitors mutations to attributes of the <extensionview>.
+ExtensionViewImpl.prototype.handleAttributeMutation = function(
+ attributeName, oldValue, newValue) {
+ if (!this.attributes[attributeName])
+ return;
+
+ // Let the changed attribute handle its own mutation;
+ this.attributes[attributeName].handleMutation(oldValue, newValue);
+};
+
+ExtensionViewImpl.prototype.onElementDetached = function() {
+ this.guest.destroy();
+ this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC].reset();
+};
+
+GuestViewContainer.registerElement(ExtensionViewImpl);
+
+// Exports.
+exports.ExtensionViewImpl = ExtensionViewImpl;

Powered by Google App Engine
This is Rietveld 408576698