1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This module implements the ExtensionView <extensionview>.
7 var GuestViewContainer = require('guestViewContainer').GuestViewContainer;
8 var ExtensionViewConstants =
9 require('extensionViewConstants').ExtensionViewConstants;
10 var ExtensionViewEvents = require('extensionViewEvents').ExtensionViewEvents;
11 var ExtensionViewInternal =
12 require('extensionViewInternal').ExtensionViewInternal;
14 function ExtensionViewImpl(extensionviewElement) {
15 GuestViewContainer.call(this, extensionviewElement, 'extensionview');
17 new ExtensionViewEvents(this, this.viewInstanceId);
20 ExtensionViewImpl.prototype.__proto__ = GuestViewContainer.prototype;
22 ExtensionViewImpl.VIEW_TYPE = 'ExtensionView';
24 ExtensionViewImpl.setupElement = function(proto) {
25 var apiMethods = ExtensionViewImpl.getApiMethods();
27 GuestViewContainer.forwardApiMethods(proto, apiMethods);
30 ExtensionViewImpl.prototype.createGuest = function() {
31 this.guest.create(this.buildParams(), function() {
36 ExtensionViewImpl.prototype.buildContainerParams = function() {
38 for (var i in this.attributes) {
39 params[i] = this.attributes[i].getValue();
44 ExtensionViewImpl.prototype.onElementDetached = function() {
47 // Reset all attributes.
48 for (var i in this.attributes) {
49 this.attributes[i].setValueIgnoreMutation();
53 // Updates src upon loadcommit.
54 ExtensionViewImpl.prototype.onLoadCommit = function(url) {
55 this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC].
56 setValueIgnoreMutation(url);
59 GuestViewContainer.registerElement(ExtensionViewImpl);
62 exports.ExtensionViewImpl = ExtensionViewImpl;