1 // Copyright 2014 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 var ExtensionOptionsConstants =
6 require('extensionOptionsConstants').ExtensionOptionsConstants;
7 var ExtensionOptionsEvents =
8 require('extensionOptionsEvents').ExtensionOptionsEvents;
9 var GuestViewContainer = require('guestViewContainer').GuestViewContainer;
11 function ExtensionOptionsImpl(extensionoptionsElement) {
12 GuestViewContainer.call(this, extensionoptionsElement, 'extensionoptions');
14 new ExtensionOptionsEvents(this);
17 ExtensionOptionsImpl.prototype.__proto__ = GuestViewContainer.prototype;
19 ExtensionOptionsImpl.VIEW_TYPE = 'ExtensionOptions';
21 ExtensionOptionsImpl.prototype.onElementAttached = function() {
25 ExtensionOptionsImpl.prototype.buildContainerParams = function() {
27 for (var i in this.attributes) {
28 params[i] = this.attributes[i].getValue();
33 ExtensionOptionsImpl.prototype.createGuest = function() {
34 // Destroy the old guest if one exists.
37 this.guest.create(this.buildParams(), function() {
38 if (!this.guest.getId()) {
39 // Fire a createfailed event here rather than in ExtensionOptionsGuest
40 // because the guest will not be created, and cannot fire an event.
41 var createFailedEvent = new Event('createfailed', { bubbles: true });
42 this.dispatchEvent(createFailedEvent);
49 GuestViewContainer.registerElement(ExtensionOptionsImpl);
52 exports.ExtensionOptionsImpl = ExtensionOptionsImpl;