| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/printing/print_system_task_proxy.h" | 5 #include "chrome/browser/printing/print_system_task_proxy.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/string_split.h" | 14 #include "base/string_split.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" | 17 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" |
| 18 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h" | 18 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h" |
| 19 #include "chrome/common/child_process_logging.h" |
| 19 #include "printing/backend/print_backend.h" | 20 #include "printing/backend/print_backend.h" |
| 20 #include "printing/print_job_constants.h" | 21 #include "printing/print_job_constants.h" |
| 21 #include "printing/print_settings.h" | 22 #include "printing/print_settings.h" |
| 22 | 23 |
| 23 #if defined(USE_CUPS) | 24 #if defined(USE_CUPS) |
| 24 #include <cups/cups.h> | 25 #include <cups/cups.h> |
| 25 #include <cups/ppd.h> | 26 #include <cups/ppd.h> |
| 26 | 27 |
| 27 #include "base/file_util.h" | 28 #include "base/file_util.h" |
| 28 #endif | 29 #endif |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 } else { | 512 } else { |
| 512 *default_duplex_setting_value = printing::SIMPLEX; | 513 *default_duplex_setting_value = printing::SIMPLEX; |
| 513 } | 514 } |
| 514 } | 515 } |
| 515 } | 516 } |
| 516 #endif // defined(OS_WIN) | 517 #endif // defined(OS_WIN) |
| 517 | 518 |
| 518 void PrintSystemTaskProxy::GetPrinterCapabilities( | 519 void PrintSystemTaskProxy::GetPrinterCapabilities( |
| 519 const std::string& printer_name) { | 520 const std::string& printer_name) { |
| 520 VLOG(1) << "Get printer capabilities start for " << printer_name; | 521 VLOG(1) << "Get printer capabilities start for " << printer_name; |
| 522 child_process_logging::ScopedPrinterInfoSetter prn_info( |
| 523 print_backend_->GetPrinterDriverInfo(printer_name)); |
| 521 printing::PrinterCapsAndDefaults printer_info; | 524 printing::PrinterCapsAndDefaults printer_info; |
| 522 if (!print_backend_->GetPrinterCapsAndDefaults(printer_name, | 525 if (!print_backend_->GetPrinterCapsAndDefaults(printer_name, |
| 523 &printer_info)) { | 526 &printer_info)) { |
| 524 return; | 527 return; |
| 525 } | 528 } |
| 526 | 529 |
| 527 bool set_color_as_default = false; | 530 bool set_color_as_default = false; |
| 528 bool set_duplex_as_default = false; | 531 bool set_duplex_as_default = false; |
| 529 int printer_color_space_for_color = printing::UNKNOWN_COLOR_MODEL; | 532 int printer_color_space_for_color = printing::UNKNOWN_COLOR_MODEL; |
| 530 int printer_color_space_for_black = printing::UNKNOWN_COLOR_MODEL; | 533 int printer_color_space_for_black = printing::UNKNOWN_COLOR_MODEL; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 base::Bind(&PrintSystemTaskProxy::SendPrinterCapabilities, this, | 589 base::Bind(&PrintSystemTaskProxy::SendPrinterCapabilities, this, |
| 587 settings_info.DeepCopy())); | 590 settings_info.DeepCopy())); |
| 588 } | 591 } |
| 589 | 592 |
| 590 void PrintSystemTaskProxy::SendPrinterCapabilities( | 593 void PrintSystemTaskProxy::SendPrinterCapabilities( |
| 591 DictionaryValue* settings_info) { | 594 DictionaryValue* settings_info) { |
| 592 if (handler_) | 595 if (handler_) |
| 593 handler_->SendPrinterCapabilities(*settings_info); | 596 handler_->SendPrinterCapabilities(*settings_info); |
| 594 delete settings_info; | 597 delete settings_info; |
| 595 } | 598 } |
| OLD | NEW |