Chromium Code Reviews| Index: chrome/browser/resources/print_preview/search/provisional_destination_resolver.js |
| diff --git a/chrome/browser/resources/print_preview/search/provisional_destination_resolver.js b/chrome/browser/resources/print_preview/search/provisional_destination_resolver.js |
| index a78732f0ee87af42008a70bc17a6e01e0f85079b..5121efb438e5482d4e674a57d7f59c7fde5686d1 100644 |
| --- a/chrome/browser/resources/print_preview/search/provisional_destination_resolver.js |
| +++ b/chrome/browser/resources/print_preview/search/provisional_destination_resolver.js |
| @@ -15,41 +15,6 @@ cr.define('print_preview', function() { |
| }; |
| /** |
| - * Utility class for bundling a promise object with it's resolver methods. |
| - * @param {!Promise<!print_preview.Destination>} promise A promise returning |
| - * a destination. |
| - * @param {function(!print_preview.Destination)} resolve Function resolving |
| - * the promise. |
| - * @param {function()} reject Function for rejecting the promise. |
| - * @constructor @struct |
| - */ |
| - function PromiseResolver(promise, resolve, reject) { |
|
Dan Beam
2016/03/03 21:18:24
nit: perhaps we should templatize PromiseResolver
dpapad
2016/03/04 18:58:42
Done. I templatized it in a bit simpler way compar
|
| - /** @type {!Promise<!print_preview.Destination>} */ |
| - this.promise = promise; |
| - /** @type {function(!print_preview.Destination)} */ |
| - this.resolve = resolve; |
| - /** @type {function()} */ |
| - this.reject = reject; |
| - } |
| - |
| - /** |
| - * Create a Promise and an associated PromiseResolver. |
| - * @return {!PromiseResolver} |
| - */ |
| - PromiseResolver.create = function() { |
| - var reject = null; |
| - var resolve = null; |
| - /** @type {!Promise<!print_preview.Destination>} */ |
| - var promise = new Promise(function(resolvePromise, rejectPromise) { |
| - resolve = /** @type {function(!print_preview.Destination)}*/( |
| - resolvePromise); |
| - reject = /** @type {function()} */(rejectPromise); |
| - }); |
| - |
| - return new PromiseResolver(promise, resolve, reject); |
| - }; |
| - |
| - /** |
| * Overlay used to resolve a provisional extension destination. The user is |
| * prompted to allow print preview to grant a USB device access to an |
| * extension associated with the destination. If user agrees destination |
| @@ -126,7 +91,7 @@ cr.define('print_preview', function() { |
| 'Showing overlay while not in initial state.'); |
| assert(!this.promiseResolver_, 'Promise resolver already set.'); |
| this.setState_(ResolverState.ACTIVE); |
| - this.promiseResolver_ = PromiseResolver.create(); |
| + this.promiseResolver_ = new PromiseResolver(); |
| this.getChildElement('.default').focus(); |
| } else if (this.state_ != ResolverState.DONE) { |
| assert(this.state_ != ResolverState.INITIAL, 'Hiding in initial state'); |