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

Unified Diff: chrome/browser/ui/webui/print_preview_handler.cc

Issue 7826040: PrintPreview: Fixed RICOH MP C3501 color print job issues. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 9 years, 3 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
« no previous file with comments | « chrome/browser/resources/print_preview/print_preview.js ('k') | chrome/renderer/mock_render_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/print_preview_handler.cc
diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc
index b9f04787aed7cca1ad2f236b938a22202007e94c..42597a5e30e44a4f877d48f3bd22df51c2e0138e 100644
--- a/chrome/browser/ui/webui/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview_handler.cc
@@ -58,9 +58,13 @@ namespace {
const char kDisableColorOption[] = "disableColorOption";
const char kSetColorAsDefault[] = "setColorAsDefault";
const char kSetDuplexAsDefault[] = "setDuplexAsDefault";
+const char kPrinterColorModelForColor[] = "printerColorModelForColor";
#if defined(USE_CUPS)
const char kColorDevice[] = "ColorDevice";
+const char kColorModel[] = "ColorModel";
+const char kColorModelForColor[] = "Color";
+const char kCMYK[] = "CMYK";
const char kDuplex[] = "Duplex";
const char kDuplexNone[] = "None";
#elif defined(OS_WIN)
@@ -163,9 +167,11 @@ void ReportPrintSettingsStats(const DictionaryValue& settings) {
if (settings.GetInteger(printing::kSettingDuplexMode, &duplex_mode))
ReportPrintSettingHistogram(duplex_mode ? DUPLEX : SIMPLEX);
- bool is_color;
- if (settings.GetBoolean(printing::kSettingColor, &is_color))
- ReportPrintSettingHistogram(is_color ? COLOR : BLACK_AND_WHITE);
+ int color_mode;
+ if (settings.GetInteger(printing::kSettingColor, &color_mode)) {
+ ReportPrintSettingHistogram(color_mode == printing::GRAY ? BLACK_AND_WHITE :
+ COLOR);
+ }
}
printing::BackgroundPrintingManager* GetBackgroundPrintingManager() {
@@ -274,6 +280,7 @@ class PrintSystemTaskProxy
printing::PrinterCapsAndDefaults printer_info;
bool supports_color = true;
bool set_duplex_as_default = false;
+ int printer_color_space = printing::GRAY;
if (!print_backend_->GetPrinterCapsAndDefaults(printer_name,
&printer_info)) {
return;
@@ -309,6 +316,17 @@ class PrintSystemTaskProxy
if (ch != NULL && strcmp(ch->choice, kDuplexNone) != 0)
set_duplex_as_default = true;
+ if (supports_color) {
+ // Identify the color space (COLOR/CMYK) for this printer.
+ ppd_option_t* color_model = ppdFindOption(ppd, kColorModel);
+ if (color_model != NULL) {
+ if (ppdFindChoice(color_model, kColorModelForColor))
+ printer_color_space = printing::COLOR;
+ else if (ppdFindChoice(color_model, kCMYK))
+ printer_color_space = printing::CMYK;
+ }
+ }
+
ppdClose(ppd);
}
file_util::Delete(ppd_file_path, false);
@@ -319,6 +337,9 @@ class PrintSystemTaskProxy
// http://msdn.microsoft.com/en-us/windows/hardware/gg463431.
supports_color = (printer_info.printer_capabilities.find(kPskColor) !=
std::string::npos);
+ if (supports_color)
+ printer_color_space = printing::COLOR;
+
set_duplex_as_default =
(printer_info.printer_defaults.find(kPskDuplexFeature) !=
std::string::npos) &&
@@ -337,6 +358,7 @@ class PrintSystemTaskProxy
PrintPreviewHandler::last_used_color_setting_);
}
settings_info.SetBoolean(kSetDuplexAsDefault, set_duplex_as_default);
+ settings_info.SetInteger(kPrinterColorModelForColor, printer_color_space);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this,
@@ -568,7 +590,10 @@ void PrintPreviewHandler::HandlePrint(const ListValue* args) {
return;
// Storing last used color setting.
- settings->GetBoolean(printing::kSettingColor, &last_used_color_setting_);
+ int color_mode;
+ if (!settings->GetInteger(printing::kSettingColor, &color_mode))
+ color_mode = printing::GRAY;
+ last_used_color_setting_ = (color_mode != printing::GRAY);
bool print_to_pdf = false;
settings->GetBoolean(printing::kSettingPrintToPDF, &print_to_pdf);
« no previous file with comments | « chrome/browser/resources/print_preview/print_preview.js ('k') | chrome/renderer/mock_render_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698