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

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

Issue 7817013: PrintPreview: Added code to identify the printer default duplex value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test failures Created 9 years, 4 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/copies_settings.js
diff --git a/chrome/browser/resources/print_preview/copies_settings.js b/chrome/browser/resources/print_preview/copies_settings.js
index 3c48e45e271cd50787056e8a05a498e00e9954e9..23b322330117eb66aa8bd823a9958e9bdf3f993a 100644
--- a/chrome/browser/resources/print_preview/copies_settings.js
+++ b/chrome/browser/resources/print_preview/copies_settings.js
@@ -22,6 +22,8 @@ cr.define('print_preview', function() {
this.collateCheckbox_ = $('collate');
this.hint_ = $('copies-hint');
this.twoSidedCheckbox_ = $('two-sided');
+ // Store the default duplex setting value which we got from the printer.
+ this.printerDefaultDuplexValue = -1;
dpapad 2011/09/02 03:01:07 Rename member var to printerDefaultDuplexValue_.
kmadhusu 2011/09/03 00:34:00 Done.
}
cr.addSingletonGetter(CopiesSettings);
@@ -56,15 +58,18 @@ cr.define('print_preview', function() {
},
/**
- * Gets the duplex mode for printing.
- * @return {number} duplex mode.
+ * Gets the duplex mode information for printing.
+ * @return {object} duplex mode object specifies the printer specified
dpapad 2011/09/02 03:01:07 Nit: s/{object}/{Object} Nit (optional): Change @r
kmadhusu 2011/09/03 00:34:00 Reverted the code to return a number.
+ * default value and user selected duplex mode value.
*/
- get duplexMode() {
+ get duplexModeInfo() {
// Constant values matches printing::DuplexMode enum. Not using const
// keyword because it is not allowed by JS strict mode.
var SIMPLEX = 0;
dpapad 2011/09/02 03:01:07 You can define these constants as regular member v
kmadhusu 2011/09/03 00:34:00 Done.
var LONG_EDGE = 1;
- return !this.twoSidedCheckbox_.checked ? SIMPLEX : LONG_EDGE;
+ return {'printerDefaultDuplexValue': this.printerDefaultDuplexValue,
+ 'userSelectedDuplexValue': !this.twoSidedCheckbox_.checked ?
+ SIMPLEX : LONG_EDGE};
},
/**
@@ -158,7 +163,10 @@ cr.define('print_preview', function() {
fadeInElement(this.copiesOption_);
$('hr-before-copies').classList.add('invisible');
}
- this.twoSidedCheckbox_.checked = e.printerCapabilities.setDuplexAsDefault;
+ this.printerDefaultDuplexValue =
+ e.printerCapabilities.printerDefaultDuplexValue;
+ if (this.printerDefaultDuplexValue >= 0)
dpapad 2011/09/02 03:01:07 I think this if statement is equivalent to this.tw
kmadhusu 2011/09/03 00:34:00 No. this.printerDefaultDuplexValue is not a boolea
+ this.twoSidedCheckbox_.checked = this.printerDefaultDuplexValue;
},
/**

Powered by Google App Engine
This is Rietveld 408576698