Chromium Code Reviews| 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.beforeFirstNavigation = true; | |
|
Fady Samuel
2015/01/27 22:59:57
Move beforeFirstNavigation into SrcAttribute, then
apacible
2015/01/28 02:43:31
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 this.guest.create(this.buildParams(), function() { | |
| 33 this.attachWindow(); | |
| 34 }.bind(this)); | |
| 35 }; | |
| 36 | |
| 37 ExtensionViewImpl.prototype.onElementAttached = function() { | |
| 38 this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC].parse(); | |
| 39 }; | |
| 40 | |
| 41 ExtensionViewImpl.prototype.buildContainerParams = function() { | |
| 42 var params = {}; | |
| 43 for (var i in this.attributes) { | |
| 44 params[i] = this.attributes[i].getValue(); | |
| 45 } | |
| 46 return params; | |
| 47 }; | |
| 48 | |
| 49 // This observer monitors mutations to attributes of the <extensionview>. | |
| 50 ExtensionViewImpl.prototype.handleAttributeMutation = function( | |
| 51 attributeName, oldValue, newValue) { | |
| 52 if (!this.attributes[attributeName]) | |
| 53 return; | |
| 54 | |
| 55 // Let the changed attribute handle its own mutation; | |
| 56 this.attributes[attributeName].handleMutation(oldValue, newValue); | |
| 57 }; | |
| 58 | |
| 59 ExtensionViewImpl.prototype.onElementDetached = function() { | |
| 60 this.guest.destroy(); | |
| 61 this.beforeFirstNavigation = true; | |
|
Fady Samuel
2015/01/27 22:59:57
Once you introduce a reset():
this.attributes[Ext
apacible
2015/01/28 02:43:31
Done.
| |
| 62 }; | |
| 63 | |
| 64 GuestViewContainer.registerElement(ExtensionViewImpl); | |
| 65 | |
| 66 // Exports. | |
| 67 exports.ExtensionViewImpl = ExtensionViewImpl; | |
| OLD | NEW |