Index: chrome/browser/resources/print_preview/page_settings.js |
diff --git a/chrome/browser/resources/print_preview/page_settings.js b/chrome/browser/resources/print_preview/page_settings.js |
index a0c36d0701f38d3fc5d444cc52e13687661d0603..dd36aaa2bb77b0f20454824d11182c7752b10a4d 100644 |
--- a/chrome/browser/resources/print_preview/page_settings.js |
+++ b/chrome/browser/resources/print_preview/page_settings.js |
@@ -177,9 +177,8 @@ cr.define('print_preview', function() { |
/** |
* Updates |this.previouslySelectedPages_| with the currently selected |
* pages. |
- * @private |
*/ |
- updatePageSelection_: function() { |
+ updatePageSelection: function() { |
this.previouslySelectedPages_ = this.selectedPagesSet; |
}, |
@@ -194,6 +193,14 @@ cr.define('print_preview', function() { |
}, |
/** |
+ * Checks if the page selection has changed and is valid. |
+ * @return {boolean} true if the page selection is changed and is valid. |
+ */ |
+ hasPageSelectionChangedAndIsValid: function() { |
+ return this.isPageSelectionValid() && this.hasPageSelectionChanged_(); |
+ }, |
+ |
+ /** |
* Validates the contents of |this.selectedPagesTextfield|. |
* |
* @return {boolean} true if the text is valid. |
@@ -212,8 +219,8 @@ cr.define('print_preview', function() { |
* @return {boolean} true if a new preview was requested. |
*/ |
requestPrintPreviewIfNeeded: function() { |
- if (this.isPageSelectionValid() && this.hasPageSelectionChanged_()) { |
- this.updatePageSelection_(); |
+ if (this.hasPageSelectionChangedAndIsValid()) { |
+ this.updatePageSelection(); |
requestPrintPreview(); |
return true; |
} |
@@ -274,7 +281,6 @@ cr.define('print_preview', function() { |
cr.dispatchSimpleEvent(document, 'updatePrintButton'); |
return; |
} |
- this.previouslySelectedPages_ = this.selectedPagesSet; |
requestPrintPreview(); |
}, |