Index: chrome/browser/resources/print_preview/color_settings.js |
diff --git a/chrome/browser/resources/print_preview/color_settings.js b/chrome/browser/resources/print_preview/color_settings.js |
index dc02ab02855e59682011e5caa80272ad69b8ee2b..9289c9f5c05c2a2aa935af8efc0a27414f2920b3 100644 |
--- a/chrome/browser/resources/print_preview/color_settings.js |
+++ b/chrome/browser/resources/print_preview/color_settings.js |
@@ -14,12 +14,13 @@ cr.define('print_preview', function() { |
this.colorOption_ = $('color-option'); |
this.colorRadioButton_ = $('color'); |
this.bwRadioButton_ = $('bw'); |
- this.GRAY = 1; |
- this.COLOR = 2; |
- this.CMYK = 3; // cmyk - Cyan, magenta, yellow, black |
- this.printerColorModelForColor_ = this.COLOR; |
+ |
+ this.printerColorModelForColor_ = ColorSettings.COLOR; |
+ this.printerColorModelForBlack_ = ColorSettings.GRAY; |
} |
+ ColorSettings.GRAY = 1; |
+ ColorSettings.COLOR = 2; |
cr.addSingletonGetter(ColorSettings); |
ColorSettings.prototype = { |
@@ -40,13 +41,12 @@ cr.define('print_preview', function() { |
}, |
/** |
- * Returns the color mode for print preview. |
- * @return {Number} Returns the printer color space |
+ * @return {number} The color mode for print preview. |
*/ |
get colorMode() { |
- if (this.bwRadioButton_.checked) |
- return this.GRAY; |
- return this.printerColorModelForColor_; |
+ return this.bwRadioButton_.checked ? |
+ this.printerColorModelForBlack_: |
+ this.printerColorModelForColor_; |
}, |
/** |
@@ -79,13 +79,19 @@ cr.define('print_preview', function() { |
var setColorAsDefault = e.printerCapabilities.setColorAsDefault; |
this.printerColorModelForColor_ = |
e.printerCapabilities.printerColorModelForColor; |
+ if (e.printerCapabilities.printerColorModelForBlack) { |
+ this.printerColorModelForBlack_ = |
+ e.printerCapabilities.printerColorModelForBlack; |
+ } else { |
+ this.printerColorModelForBlack_ = ColorSettings.GRAY; |
+ } |
this.colorRadioButton_.checked = setColorAsDefault; |
this.bwRadioButton_.checked = !setColorAsDefault; |
setColor(this.colorRadioButton_.checked); |
}, |
/** |
- * Listener executing when a PDFLoaded event occurs. |
+ * Executes when a PDFLoaded event occurs. |
* @private |
*/ |
onPDFLoaded_: function() { |