Chromium Code Reviews| Index: chrome/browser/resources/print_preview/print_preview.js |
| diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js |
| index 6f2d1a0707dfa7d01f4d4d0c2fb4597998deb3a0..bda66a66c5602cd128b5d56920b10b994d1fc49d 100644 |
| --- a/chrome/browser/resources/print_preview/print_preview.js |
| +++ b/chrome/browser/resources/print_preview/print_preview.js |
| @@ -857,6 +857,9 @@ cr.define('print_preview', function() { |
| * to the preview area. |
| * @param {KeyboardEvent} e The keyboard event. |
| * @private |
| + * @suppress {uselessCode} |
| + * Current compiler preprocessor leaves all the code inside all the <if>s, |
| + * so the compiler claims that code after first return is unreachable. |
| */ |
| onKeyDown_: function(e) { |
| // Escape key closes the dialog. |
| @@ -937,7 +940,7 @@ cr.define('print_preview', function() { |
| */ |
| onAdvancedOptionsButtonActivated_: function() { |
| this.advancedSettings_.showForDestination( |
| - this.destinationStore_.selectedDestination); |
| + assert(this.destinationStore_.selectedDestination)); |
| }, |
| /** |
| @@ -998,6 +1001,8 @@ cr.define('print_preview', function() { |
| * @private |
| */ |
| onManipulateSettingsForTest_: function(event) { |
| + event.settings = |
|
Dan Beam
2014/09/29 18:42:00
nit: var settings (try not to re-assign to argumen
Vitaly Pavlenko
2014/10/01 00:33:37
Done.
|
| + /** @type {print_preview.PreviewSettings} */(event.settings); |
| if ('selectSaveAsPdfDestination' in event.settings) { |
| this.saveAsPdfForTest_(); // No parameters. |
| } else if ('layoutSettings' in event.settings) { |
| @@ -1137,7 +1142,7 @@ cr.define('print_preview', function() { |
| if (!cr.isWindows) |
| return true; |
| var selectedDest = this.destinationStore_.selectedDestination; |
| - return selectedDest && |
| + return !!selectedDest && |
| selectedDest.origin == print_preview.Destination.Origin.LOCAL && |
| selectedDest.id != |
| print_preview.Destination.GooglePromotedId.SAVE_AS_PDF; |
| @@ -1167,7 +1172,7 @@ cr.define('print_preview', function() { |
| var selectedDest = this.destinationStore_.selectedDestination; |
| setIsVisible( |
| getRequiredElement('cloud-print-dialog-link'), |
| - selectedDest && !cr.isChromeOS && !selectedDest.isLocal); |
| + !!selectedDest && !cr.isChromeOS && !selectedDest.isLocal); |
| setIsVisible( |
| getRequiredElement('system-dialog-link'), |
| this.shouldShowSystemDialogLink_()); |
| @@ -1187,8 +1192,8 @@ cr.define('print_preview', function() { |
| this.cloudPrintInterface_ && |
| this.userInfo_.activeUser && |
| !this.appState_.isGcpPromoDismissed && |
| - !this.destinationStore_.isLocalDestinationsSearchInProgress && |
| - !this.destinationStore_.isCloudDestinationsSearchInProgress && |
| + !this.destinationStore_.isLocalDestinationSearchInProgress && |
| + !this.destinationStore_.isCloudDestinationSearchInProgress && |
| this.destinationStore_.hasOnlyDefaultCloudDestinations(); |
| setIsVisible(this.getChildElement('#no-destinations-promo'), |
| isPromoVisible); |