OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 // This module implements the ExtensionView <extensionview>. | |
6 | |
7 var GuestViewContainer = require('guestViewContainer').GuestViewContainer; | |
8 var ExtensionViewConstants = | |
9 require('extensionViewConstants').ExtensionViewConstants; | |
10 var ExtensionViewInternal = | |
11 require('extensionViewInternal').ExtensionViewInternal; | |
12 | |
13 function ExtensionViewImpl(extensionviewElement) { | |
14 GuestViewContainer.call(this, extensionviewElement, 'extensionview'); | |
15 this.createGuest(); | |
Fady Samuel
2015/01/26 12:52:02
This means you create the guest as soon as you cre
apacible
2015/01/26 22:12:33
Done.
| |
16 this.setupExtensionViewAttributes(); | |
17 } | |
18 | |
19 ExtensionViewImpl.prototype.__proto__ = GuestViewContainer.prototype; | |
20 | |
21 ExtensionViewImpl.VIEW_TYPE = 'ExtensionView'; | |
22 | |
23 ExtensionViewImpl.setupElement = function(proto) { | |
24 var apiMethods = [ | |
25 'navigate' | |
26 ]; | |
27 | |
28 GuestViewContainer.forwardApiMethods(proto, apiMethods); | |
29 }; | |
30 | |
31 ExtensionViewImpl.prototype.createGuest = function() { | |
32 var params = { | |
33 'src': this.element.src | |
34 }; | |
35 | |
36 this.guest.create(params, function() { | |
Fady Samuel
2015/01/26 12:52:02
Use buildParams() which calls buildContainerParams
apacible
2015/01/26 22:12:33
Done.
| |
37 this.attachWindow(); | |
38 }.bind(this)); | |
39 }; | |
40 | |
41 ExtensionViewImpl.prototype.onElementAttached = function() { | |
42 this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC].parse(); | |
43 }; | |
44 | |
45 ExtensionViewImpl.prototype.buildAttachParams = function() { | |
Fady Samuel
2015/01/26 12:52:02
Use buildContainerParams now. Also, given you have
apacible
2015/01/26 22:12:33
Done.
| |
46 var params = { | |
47 'src': this.element.src | |
48 }; | |
49 | |
50 return params; | |
51 }; | |
52 | |
53 // This observer monitors mutations to attributes of the <extensionview>. | |
54 ExtensionViewImpl.prototype.handleAttributeMutation = function( | |
55 attributeName, oldValue, newValue) { | |
56 if (!this.attributes[attributeName] || | |
57 this.attributes[attributeName].ignoreMutation) { | |
Fady Samuel
2015/01/26 12:52:02
I'd move this ignoreMutation check into SrcAttribu
apacible
2015/01/26 22:12:33
Done.
| |
58 return; | |
59 } | |
60 | |
61 // Let the changed attribute handle its own mutation; | |
62 this.attributes[attributeName].handleMutation(oldValue, newValue); | |
63 }; | |
64 | |
65 ExtensionViewImpl.prototype.onElementDetached = function() { | |
Fady Samuel
2015/01/26 12:52:02
I believe the default behavior in GuestViewContain
apacible
2015/01/26 22:12:33
Keeping since I'm added to onElementDetached.
| |
66 this.guest.destroy(); | |
67 }; | |
68 | |
69 GuestViewContainer.registerElement(ExtensionViewImpl); | |
70 | |
71 // Exports. | |
72 exports.ExtensionViewImpl = ExtensionViewImpl; | |
OLD | NEW |