summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorkmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 16:43:56 +0000
committerkmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 16:43:56 +0000
commit540fead9ca2d4c454b7e3461b59f64c911155c6c (patch)
tree6180cbf97febce531dacb5bd69aea6f608d8be54 /printing
parent8f8146f2af6da72ea93020727f2c712baa71f73b (diff)
downloadchromium_src-540fead9ca2d4c454b7e3461b59f64c911155c6c.zip
chromium_src-540fead9ca2d4c454b7e3461b59f64c911155c6c.tar.gz
chromium_src-540fead9ca2d4c454b7e3461b59f64c911155c6c.tar.bz2
Revert 105087 - PrintPreview: Fix printer color settings issues based on printer ppd/schema information.
Show/Hide the color options based on printer ppd/schema information. Some printers does not provide sufficient information in the printer schema/ppd regarding the color settings and they use custom advance settings to print in black & white/greyscale. In those cases, users need to print using native dialog in order to set these advance color settings. BUG=93811, 93490, 87344, 96658, 98768 TEST= Please refer to bug description. Review URL: http://codereview.chromium.org/8138020 TBR=kmadhusu@chromium.org Review URL: http://codereview.chromium.org/8245012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/print_job_constants.cc18
-rw-r--r--printing/print_job_constants.h40
-rw-r--r--printing/print_settings.cc96
-rw-r--r--printing/print_settings.h10
-rw-r--r--printing/printing_context_mac.mm20
5 files changed, 13 insertions, 171 deletions
diff --git a/printing/print_job_constants.cc b/printing/print_job_constants.cc
index 5420e74..3efb488 100644
--- a/printing/print_job_constants.cc
+++ b/printing/print_job_constants.cc
@@ -121,22 +121,4 @@ const char kSettingPrintToPDF[] = "printToPDF";
const int FIRST_PAGE_INDEX = 0;
const int COMPLETE_PREVIEW_DOCUMENT_INDEX = -1;
-#if defined (USE_CUPS)
-const char kBlack[] = "Black";
-const char kCMYK[] = "CMYK";
-const char kKCMY[] = "KCMY";
-const char kCMY_K[] = "CMY+K";
-const char kCMY[] = "CMY";
-const char kColor[] = "Color";
-const char kGray[] = "Gray";
-const char kGrayscale[] = "Grayscale";
-const char kGreyscale[] = "Greyscale";
-const char kMonochrome[] = "Monochrome";
-const char kNormal[] = "Normal";
-const char kNormalGray[] = "Normal.Gray";
-const char kRGB[] = "RGB";
-const char kRGBA[] = "RGBA";
-const char kRGB16[] = "RGB16";
-#endif
-
} // namespace printing
diff --git a/printing/print_job_constants.h b/printing/print_job_constants.h
index 8b3c638..cbdad74 100644
--- a/printing/print_job_constants.h
+++ b/printing/print_job_constants.h
@@ -48,25 +48,6 @@ PRINTING_EXPORT extern const char kSettingPrintToPDF[];
PRINTING_EXPORT extern const int FIRST_PAGE_INDEX;
PRINTING_EXPORT extern const int COMPLETE_PREVIEW_DOCUMENT_INDEX;
-#if defined (USE_CUPS)
-// Printer color models
-PRINTING_EXPORT extern const char kBlack[];
-PRINTING_EXPORT extern const char kCMYK[];
-PRINTING_EXPORT extern const char kKCMY[];
-PRINTING_EXPORT extern const char kCMY_K[];
-PRINTING_EXPORT extern const char kCMY[];
-PRINTING_EXPORT extern const char kColor[];
-PRINTING_EXPORT extern const char kGray[];
-PRINTING_EXPORT extern const char kGrayscale[];
-PRINTING_EXPORT extern const char kGreyscale[];
-PRINTING_EXPORT extern const char kMonochrome[];
-PRINTING_EXPORT extern const char kNormal[];
-PRINTING_EXPORT extern const char kNormalGray[];
-PRINTING_EXPORT extern const char kRGB[];
-PRINTING_EXPORT extern const char kRGBA[];
-PRINTING_EXPORT extern const char kRGB16[];
-#endif
-
// Print job duplex mode values.
enum DuplexMode {
UNKNOWN_DUPLEX_MODE = -1,
@@ -89,27 +70,10 @@ enum VerticalHeaderFooterPosition {
};
// Print job color mode values.
-enum ColorModels {
- UNKNOWN_COLOR_MODEL,
- GRAY,
+enum ColorMode {
+ GRAY = 1,
COLOR,
CMYK,
- CMY,
- KCMY,
- CMY_K, // CMY_K represents CMY+K.
- BLACK,
- RGB,
- RGB16,
- RGBA,
- COLORMODE_COLOR, // Used in samsung printer ppds.
- COLORMODE_MONOCHROME, // Used in samsung printer ppds.
- HP_COLOR_COLOR, // Used in HP color printer ppds.
- HP_COLOR_BLACK, // Used in HP color printer ppds.
- PRINTOUTMODE_NORMAL, // Used in foomatic ppds.
- PRINTOUTMODE_NORMAL_GRAY, // Used in foomatic ppds.
- PROCESSCOLORMODEL_CMYK, // Used in canon printer ppds.
- PROCESSCOLORMODEL_GREYSCALE, // Used in canon printer ppds.
- PROCESSCOLORMODEL_RGB, // Used in canon printer ppds
};
} // namespace printing
diff --git a/printing/print_settings.cc b/printing/print_settings.cc
index 06aac453d..d08d02f5 100644
--- a/printing/print_settings.cc
+++ b/printing/print_settings.cc
@@ -10,102 +10,6 @@
namespace printing {
-#if defined (USE_CUPS)
-void GetColorModelForMode(
- int color_mode, std::string* color_setting_name, std::string* color_value) {
-#if defined(OS_MACOSX)
- const char kCUPSColorMode[] = "ColorMode";
- const char kCUPSColorModel[] = "ColorModel";
- const char kCUPSPrintoutMode[] = "PrintoutMode";
- const char kCUPSProcessColorModel[] = "ProcessColorModel";
-#else
- const char kCUPSColorMode[] = "cups-ColorMode";
- const char kCUPSColorModel[] = "cups-ColorModel";
- const char kCUPSPrintoutMode[] = "cups-PrintoutMode";
- const char kCUPSProcessColorModel[] = "cups-ProcessColorModel";
-#endif
-
- color_setting_name->assign(kCUPSColorModel);
- switch (color_mode) {
- case printing::COLOR:
- color_value->assign(printing::kColor);
- break;
- case printing::CMYK:
- color_value->assign(printing::kCMYK);
- break;
- case printing::PRINTOUTMODE_NORMAL:
- color_value->assign(printing::kNormal);
- color_setting_name->assign(kCUPSPrintoutMode);
- break;
- case printing::PRINTOUTMODE_NORMAL_GRAY:
- color_value->assign(printing::kNormalGray);
- color_setting_name->assign(kCUPSPrintoutMode);
- break;
- case printing::RGB16:
- color_value->assign(printing::kRGB16);
- break;
- case printing::RGBA:
- color_value->assign(printing::kRGBA);
- break;
- case printing::RGB:
- color_value->assign(printing::kRGB);
- break;
- case printing::CMY:
- color_value->assign(printing::kCMY);
- break;
- case printing::CMY_K:
- color_value->assign(printing::kCMY_K);
- break;
- case printing::BLACK:
- color_value->assign(printing::kBlack);
- break;
- case printing::GRAY:
- color_value->assign(printing::kGray);
- break;
- case printing::COLORMODE_COLOR:
- color_setting_name->assign(kCUPSColorMode);
- color_value->assign(printing::kColor);
- break;
- case printing::COLORMODE_MONOCHROME:
- color_setting_name->assign(kCUPSColorMode);
- color_value->assign(printing::kMonochrome);
- break;
- case printing::HP_COLOR_COLOR:
- color_setting_name->assign(kColor);
- color_value->assign(printing::kColor);
- break;
- case printing::HP_COLOR_BLACK:
- color_setting_name->assign(kColor);
- color_value->assign(printing::kBlack);
- break;
- case printing::PROCESSCOLORMODEL_CMYK:
- color_setting_name->assign(kCUPSProcessColorModel);
- color_value->assign(printing::kCMYK);
- break;
- case printing::PROCESSCOLORMODEL_GREYSCALE:
- color_setting_name->assign(kCUPSProcessColorModel);
- color_value->assign(printing::kGreyscale);
- break;
- case printing::PROCESSCOLORMODEL_RGB:
- color_setting_name->assign(kCUPSProcessColorModel);
- color_value->assign(printing::kRGB);
- break;
- default:
- color_value->assign(printing::kGrayscale);
- break;
- }
-}
-#endif
-
-bool isColorModelSelected(int model) {
- return (model != printing::GRAY &&
- model != printing::BLACK &&
- model != printing::PRINTOUTMODE_NORMAL_GRAY &&
- model != printing::COLORMODE_MONOCHROME &&
- model != printing::PROCESSCOLORMODEL_GREYSCALE &&
- model != printing::HP_COLOR_BLACK);
-}
-
// Global SequenceNumber used for generating unique cookie values.
static base::AtomicSequenceNumber cookie_seq(base::LINKER_INITIALIZED);
diff --git a/printing/print_settings.h b/printing/print_settings.h
index 6101684..4e40231 100644
--- a/printing/print_settings.h
+++ b/printing/print_settings.h
@@ -15,16 +15,6 @@
namespace printing {
-// Returns true if color model is selected.
-bool isColorModelSelected(int model);
-
-#if defined (USE_CUPS)
- // Get the color model setting name and value for the |color_mode|.
- void GetColorModelForMode(int color_mode,
- std::string* color_setting_name,
- std::string* color_value);
-#endif
-
// OS-independent print settings.
class PRINTING_EXPORT PrintSettings {
public:
diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm
index bfb9817..15348a0 100644
--- a/printing/printing_context_mac.mm
+++ b/printing/printing_context_mac.mm
@@ -15,6 +15,10 @@
#include "base/values.h"
#include "printing/print_settings_initializer_mac.h"
+static const CFStringRef kColorModel = CFSTR("ColorModel");
+static const CFStringRef kGrayColor = CFSTR("Gray");
+static const CFStringRef kCMYK = CFSTR("CMYK");
+
namespace printing {
// static
@@ -249,17 +253,15 @@ bool PrintingContextMac::SetDuplexModeInPrintSettings(DuplexMode mode) {
bool PrintingContextMac::SetOutputColor(int color_mode) {
PMPrintSettings pmPrintSettings =
static_cast<PMPrintSettings>([print_info_.get() PMPrintSettings]);
- std::string color_setting_name;
- std::string color_value;
- printing::GetColorModelForMode(color_mode, &color_setting_name, &color_value);
- base::mac::ScopedCFTypeRef<CFStringRef> color_setting(
- base::SysUTF8ToCFStringRef(color_setting_name));
- base::mac::ScopedCFTypeRef<CFStringRef> output_color(
- base::SysUTF8ToCFStringRef(color_value));
+ CFStringRef output_color = NULL;
+ if (color_mode == printing::GRAY)
+ output_color = kGrayColor;
+ else if (color_mode == printing::CMYK)
+ output_color = kCMYK;
return PMPrintSettingsSetValue(pmPrintSettings,
- color_setting.get(),
- output_color.get(),
+ kColorModel,
+ output_color,
false) == noErr;
}