Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4537)

Unified Diff: chrome/browser/resources/print_preview/print_preview.js

Issue 588713002: Compile print_preview, part 3: reduce down to 185 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@I_print_preview_2
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 deec69a5ac832a5f990944bee90fd2b29ebe6d95..0395c7210569b6cf8f8bb2a8071c399b9a1e867a 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -262,23 +262,6 @@ cr.define('print_preview', function() {
};
/**
- * States of the print preview.
- * @enum {string}
- * @private
- */
- PrintPreview.UiState_ = {
- INITIALIZING: 'initializing',
- READY: 'ready',
- OPENING_PDF_PREVIEW: 'opening-pdf-preview',
- OPENING_CLOUD_PRINT_DIALOG: 'opening-cloud-print-dialog',
- OPENING_NATIVE_PRINT_DIALOG: 'opening-native-print-dialog',
- PRINTING: 'printing',
- FILE_SELECTION: 'file-selection',
- CLOSING: 'closing',
- ERROR: 'error'
- };
-
- /**
* What can happen when print preview tries to print.
* @enum {string}
* @private
@@ -841,6 +824,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.
@@ -924,7 +910,7 @@ cr.define('print_preview', function() {
*/
onAdvancedOptionsButtonActivated_: function() {
this.advancedSettings_.showForDestination(
- this.destinationStore_.selectedDestination);
+ assert(this.destinationStore_.selectedDestination));
},
/**
@@ -985,6 +971,8 @@ cr.define('print_preview', function() {
* @private
*/
onManipulateSettingsForTest_: function(event) {
+ event.settings =
+ /** @type {print_preview.PreviewSettings} */(event.settings);
if ('selectSaveAsPdfDestination' in event.settings) {
this.saveAsPdfForTest_(); // No parameters.
} else if ('layoutSettings' in event.settings) {
@@ -1124,7 +1112,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;
@@ -1154,7 +1142,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_());
@@ -1174,8 +1162,6 @@ cr.define('print_preview', function() {
this.cloudPrintInterface_ &&
this.userInfo_.activeUser &&
!this.appState_.isGcpPromoDismissed &&
Aleksey Shlyapnikov 2014/09/22 22:00:40 It should be: !this.destinationStore_.isLocalD
Vitaly Pavlenko 2014/09/22 22:33:11 Done.
- !this.destinationStore_.isLocalDestinationsSearchInProgress &&
- !this.destinationStore_.isCloudDestinationsSearchInProgress &&
this.destinationStore_.hasOnlyDefaultCloudDestinations();
setIsVisible(this.getChildElement('#no-destinations-promo'),
isPromoVisible);
@@ -1218,6 +1204,23 @@ cr.define('print_preview', function() {
};
});
+/**
+ * States of the print preview.
+ * @enum {string}
+ * @private
+ */
+print_preview.PrintPreview.UiState_ = {
+ INITIALIZING: 'initializing',
+ READY: 'ready',
+ OPENING_PDF_PREVIEW: 'opening-pdf-preview',
+ OPENING_CLOUD_PRINT_DIALOG: 'opening-cloud-print-dialog',
+ OPENING_NATIVE_PRINT_DIALOG: 'opening-native-print-dialog',
+ PRINTING: 'printing',
+ FILE_SELECTION: 'file-selection',
+ CLOSING: 'closing',
+ ERROR: 'error'
+};
+
// Pull in all other scripts in a single shot.
<include src="common/overlay.js"/>
<include src="common/search_box.js"/>

Powered by Google App Engine
This is Rietveld 408576698