| 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 public-facing API functions for the | 5 // This module implements the public-facing API functions for the |
| 6 // <extensionview> tag. | 6 // <extensionview> tag. |
| 7 | 7 |
| 8 var ExtensionViewInternal = | 8 var ExtensionViewInternal = |
| 9 require('extensionViewInternal').ExtensionViewInternal; | 9 require('extensionViewInternal').ExtensionViewInternal; |
| 10 var ExtensionViewImpl = require('extensionView').ExtensionViewImpl; | 10 var ExtensionViewImpl = require('extensionView').ExtensionViewImpl; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 ExtensionViewImpl.prototype.load = function(src) { | 26 ExtensionViewImpl.prototype.load = function(src) { |
| 27 return new Promise(function(resolve, reject) { | 27 return new Promise(function(resolve, reject) { |
| 28 this.loadQueue.push({src: src, resolve: resolve, reject: reject}); | 28 this.loadQueue.push({src: src, resolve: resolve, reject: reject}); |
| 29 this.loadNextSrc(); | 29 this.loadNextSrc(); |
| 30 }.bind(this)) | 30 }.bind(this)) |
| 31 .then(function onLoadResolved() { | 31 .then(function onLoadResolved() { |
| 32 this.pendingLoad = null; | 32 this.pendingLoad = null; |
| 33 this.loadNextSrc(); | 33 this.loadNextSrc(); |
| 34 }.bind(this), function onLoadRejected() { | 34 }.bind(this), function onLoadRejected() { |
| 35 this.pendingLoad.reject('Failed to load.'); |
| 35 this.pendingLoad = null; | 36 this.pendingLoad = null; |
| 36 this.loadNextSrc(); | 37 this.loadNextSrc(); |
| 37 reject('Failed to load.'); | |
| 38 }.bind(this)); | 38 }.bind(this)); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // ----------------------------------------------------------------------------- | 41 // ----------------------------------------------------------------------------- |
| 42 | 42 |
| 43 ExtensionViewImpl.getApiMethods = function() { | 43 ExtensionViewImpl.getApiMethods = function() { |
| 44 return EXTENSION_VIEW_API_METHODS; | 44 return EXTENSION_VIEW_API_METHODS; |
| 45 }; | 45 }; |
| OLD | NEW |