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 attributes of the <extensionview> tag.
7 var GuestViewAttributes
= require('guestViewAttributes').GuestViewAttributes
;
8 var ExtensionViewConstants
=
9 require('extensionViewConstants').ExtensionViewConstants
;
10 var ExtensionViewImpl
= require('extensionView').ExtensionViewImpl
;
11 var ExtensionViewInternal
=
12 require('extensionViewInternal').ExtensionViewInternal
;
14 // -----------------------------------------------------------------------------
15 // ExtensionAttribute object.
17 // Attribute that handles the extension associated with the extensionview.
18 function ExtensionAttribute(view
) {
19 GuestViewAttributes
.ReadOnlyAttribute
.call(
20 this, ExtensionViewConstants
.ATTRIBUTE_EXTENSION
, view
);
23 ExtensionAttribute
.prototype.__proto__
=
24 GuestViewAttributes
.ReadOnlyAttribute
.prototype;
26 // -----------------------------------------------------------------------------
27 // SrcAttribute object.
29 // Attribute that handles the location and navigation of the extensionview.
30 // This is read only because we only want to be able to navigate to a src
31 // through the load API call, which checks for URL validity and the extension
33 function SrcAttribute(view
) {
34 GuestViewAttributes
.ReadOnlyAttribute
.call(
35 this, ExtensionViewConstants
.ATTRIBUTE_SRC
, view
);
38 SrcAttribute
.prototype.__proto__
=
39 GuestViewAttributes
.ReadOnlyAttribute
.prototype;
41 SrcAttribute
.prototype.handleMutation = function(oldValue
, newValue
) {
42 console
.log('src is read only. Use .load(url) to navigate to a new ' +
44 this.setValueIgnoreMutation(oldValue
);
47 // -----------------------------------------------------------------------------
49 // Sets up all of the extensionview attributes.
50 ExtensionViewImpl
.prototype.setupAttributes = function() {
51 this.attributes
[ExtensionViewConstants
.ATTRIBUTE_EXTENSION
] =
52 new ExtensionAttribute(this);
53 this.attributes
[ExtensionViewConstants
.ATTRIBUTE_SRC
] =
54 new SrcAttribute(this);