| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This module implements the ExtensionView <extensionview>. | 5 // This module implements the ExtensionView <extensionview>. |
| 6 | 6 |
| 7 var GuestViewContainer = require('guestViewContainer').GuestViewContainer; | 7 var GuestViewContainer = require('guestViewContainer').GuestViewContainer; |
| 8 var ExtensionViewConstants = | 8 var ExtensionViewConstants = |
| 9 require('extensionViewConstants').ExtensionViewConstants; | 9 require('extensionViewConstants').ExtensionViewConstants; |
| 10 var ExtensionViewEvents = require('extensionViewEvents').ExtensionViewEvents; | 10 var ExtensionViewEvents = require('extensionViewEvents').ExtensionViewEvents; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 ExtensionViewImpl.prototype.onLoadCommit = function(url) { | 64 ExtensionViewImpl.prototype.onLoadCommit = function(url) { |
| 65 this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC]. | 65 this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC]. |
| 66 setValueIgnoreMutation(url); | 66 setValueIgnoreMutation(url); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // Loads the next pending src from |loadQueue| to the extensionview. | 69 // Loads the next pending src from |loadQueue| to the extensionview. |
| 70 ExtensionViewImpl.prototype.loadNextSrc = function() { | 70 ExtensionViewImpl.prototype.loadNextSrc = function() { |
| 71 // If extensionview isn't currently loading a src, load the next src | 71 // If extensionview isn't currently loading a src, load the next src |
| 72 // in |loadQueue|. Otherwise, do nothing. | 72 // in |loadQueue|. Otherwise, do nothing. |
| 73 if (!this.pendingLoad && this.loadQueue.length) { | 73 if (!this.pendingLoad && this.loadQueue.length) { |
| 74 this.pendingLoad = this.loadQueue.shift(); | 74 this.pendingLoad = $Array.shift(this.loadQueue); |
| 75 var src = this.pendingLoad.src; | 75 var src = this.pendingLoad.src; |
| 76 var resolve = this.pendingLoad.resolve; | 76 var resolve = this.pendingLoad.resolve; |
| 77 var reject = this.pendingLoad.reject; | 77 var reject = this.pendingLoad.reject; |
| 78 | 78 |
| 79 // The extensionview validates the |src| twice, once in |parseSrc| and then | 79 // The extensionview validates the |src| twice, once in |parseSrc| and then |
| 80 // in |loadSrc|. The |src| isn't checked directly in |loadNextSrc| for | 80 // in |loadSrc|. The |src| isn't checked directly in |loadNextSrc| for |
| 81 // validity since the sending renderer (WebUI) is trusted. | 81 // validity since the sending renderer (WebUI) is trusted. |
| 82 ExtensionViewInternal.parseSrc( | 82 ExtensionViewInternal.parseSrc( |
| 83 src, $Function.bind(function(isSrcValid, extensionId) { | 83 src, $Function.bind(function(isSrcValid, extensionId) { |
| 84 // Check if the src is valid. | 84 // Check if the src is valid. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 }, this)); | 131 }, this)); |
| 132 } | 132 } |
| 133 }, this)); | 133 }, this)); |
| 134 } | 134 } |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 GuestViewContainer.registerElement(ExtensionViewImpl); | 137 GuestViewContainer.registerElement(ExtensionViewImpl); |
| 138 | 138 |
| 139 // Exports. | 139 // Exports. |
| 140 exports.$set('ExtensionViewImpl', ExtensionViewImpl); | 140 exports.$set('ExtensionViewImpl', ExtensionViewImpl); |
| OLD | NEW |