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

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

Issue 8138020: PrintPreview: Fix printer color settings issues based on printer ppd/schema information. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 9 years, 2 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/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() {
« no previous file with comments | « chrome/browser/printing/print_system_task_proxy_unittest.cc ('k') | chrome/browser/resources/print_preview/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698