Chromium Code Reviews| 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..d6f1b939bad9571989b2f0a75fa1f41e7594dcef 100644 |
| --- a/chrome/browser/resources/print_preview/copies_settings.js |
| +++ b/chrome/browser/resources/print_preview/copies_settings.js |
| @@ -22,6 +22,15 @@ cr.define('print_preview', function() { |
| this.collateCheckbox_ = $('collate'); |
| this.hint_ = $('copies-hint'); |
| this.twoSidedCheckbox_ = $('two-sided'); |
| + |
| + // Constant values matches printing::DuplexMode enum. Not using const |
| + // keyword because it is not allowed by JS strict mode. |
| + this.SIMPLEX = 0; |
| + this.LONG_EDGE = 1; |
| + this.UNKNOWN = -1; |
| + // Store the default duplex setting value which we got from the printer. |
| + this.DUPLEX = 1; |
| + this.printerDefaultDuplexValue_ = this.UNKNOWN; |
| } |
| cr.addSingletonGetter(CopiesSettings); |
| @@ -56,15 +65,21 @@ cr.define('print_preview', function() { |
| }, |
| /** |
| - * Gets the duplex mode for printing. |
| + * Gets the duplex mode information for printing. |
| * @return {number} duplex mode. |
| */ |
| - get duplexMode() { |
| - // Constant values matches printing::DuplexMode enum. Not using const |
| - // keyword because it is not allowed by JS strict mode. |
| - var SIMPLEX = 0; |
| - var LONG_EDGE = 1; |
| - return !this.twoSidedCheckbox_.checked ? SIMPLEX : LONG_EDGE; |
| + get duplexMode() { |
| + // On Windows, some printer doesn't specify their duplex values in the |
|
vandebo (ex-Chrome)
2011/09/04 17:06:53
nit: printer doesn't => printers don't
kmadhusu
2011/09/07 20:57:33
Done.
|
| + // printer schema. If the printer duplex value is UNKNOWN, it is better |
| + // to assign either "0" or "1" in DEVMODE structure according to user |
| + // selected duplex value. |
| + // Ref bug: http://crbug.com/89204 |
| + if (!this.twoSidedCheckbox_.checked) |
| + return this.SIMPLEX; |
| + else if (this.printerDefaultDuplexValue == this.UNKNOWN) |
| + return this.DUPLEX; |
|
vandebo (ex-Chrome)
2011/09/04 17:06:53
Wait, I'm confused, this.DUPLEX and this.LONG_EDGE
kmadhusu
2011/09/07 20:57:33
It was a typo.. I have removed DUPLEX now.
|
| + else |
| + return this.LONG_EDGE; |
| }, |
| /** |
| @@ -158,7 +173,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 != this.UNKNOWN) |
| + this.twoSidedCheckbox_.checked = this.printerDefaultDuplexValue; |
| }, |
| /** |