Chromium Code Reviews| Index: chrome/browser/resources/print_preview/search/destination_search.js |
| diff --git a/chrome/browser/resources/print_preview/search/destination_search.js b/chrome/browser/resources/print_preview/search/destination_search.js |
| index ff1957341397ba17d089d6208d31120eac64daab..f0705ab91adea00a9a8e18c0166ebc55be6e27a0 100644 |
| --- a/chrome/browser/resources/print_preview/search/destination_search.js |
| +++ b/chrome/browser/resources/print_preview/search/destination_search.js |
| @@ -583,6 +583,36 @@ cr.define('print_preview', function() { |
| * @private |
| */ |
| handleOnDestinationSelect_: function(destination) { |
| + if (destination.origin == print_preview.Destination.Origin.CROS && |
| + !destination.capabilities) { |
| + // local printers on CrOS require setup. |
| + assert(!this.printerConfigurer_); |
| + this.printerConfigurer_ = new print_preview.CrosDestinationResolver( |
| + this.destinationStore_, destination); |
| + this.addChild(this.printerConfigurer_); |
| + this.printerConfigurer_.run(this.getElement()) |
| + .then( |
|
dpapad
2017/01/11 20:36:31
From JS styleguide "Always put the operator on the
skau
2017/01/12 00:36:16
Weird. I never noticed that. I've fixed the simi
|
| + /** |
| + * @param {Object} result |
| + * An object containing the printerId and capabilities. |
| + */ |
| + function(result) { |
| + assert(result.printerId == destination.id); |
| + destination.capabilities = result.capabilities; |
| + this.handleOnDestinationSelect_(destination); |
| + }.bind(this)) |
| + .catch( |
| + function() { |
| + console.log('Failed to setup destination: ' + destination.id); |
|
dpapad
2017/01/11 20:36:31
console.error?
skau
2017/01/12 00:36:16
I've made it a warning. We'll want to know if it
|
| + }) |
| + .then( |
| + function() { |
| + this.removeChild(this.printerConfigurer_); |
| + this.printerConfigurer_ = null; |
| + }.bind(this)); |
| + return; |
| + } |
| + |
| if (destination.isProvisional) { |
| assert(!this.provisionalDestinationResolver_, |
| 'Provisional destination resolver already exists.'); |