| 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 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" | 14 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" |
| 15 #include "chrome/common/child_process_logging.h" | 15 #include "chrome/common/crash_keys.h" |
| 16 #include "printing/backend/print_backend.h" | 16 #include "printing/backend/print_backend.h" |
| 17 #include "printing/print_job_constants.h" | 17 #include "printing/print_job_constants.h" |
| 18 #include "printing/print_settings.h" | 18 #include "printing/print_settings.h" |
| 19 | 19 |
| 20 #if defined(USE_CUPS) | 20 #if defined(USE_CUPS) |
| 21 #include <cups/cups.h> | 21 #include <cups/cups.h> |
| 22 #include <cups/ppd.h> | 22 #include <cups/ppd.h> |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 using content::BrowserThread; | 25 using content::BrowserThread; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 void PrintSystemTaskProxy::SetupPrinterList(ListValue* printers) { | 106 void PrintSystemTaskProxy::SetupPrinterList(ListValue* printers) { |
| 107 if (handler_.get()) | 107 if (handler_.get()) |
| 108 handler_->SetupPrinterList(*printers); | 108 handler_->SetupPrinterList(*printers); |
| 109 delete printers; | 109 delete printers; |
| 110 } | 110 } |
| 111 | 111 |
| 112 void PrintSystemTaskProxy::GetPrinterCapabilities( | 112 void PrintSystemTaskProxy::GetPrinterCapabilities( |
| 113 const std::string& printer_name) { | 113 const std::string& printer_name) { |
| 114 VLOG(1) << "Get printer capabilities start for " << printer_name; | 114 VLOG(1) << "Get printer capabilities start for " << printer_name; |
| 115 child_process_logging::ScopedPrinterInfoSetter prn_info( | 115 crash_keys::ScopedPrinterInfo crash_key( |
| 116 print_backend_->GetPrinterDriverInfo(printer_name)); | 116 print_backend_->GetPrinterDriverInfo(printer_name)); |
| 117 | 117 |
| 118 if (!print_backend_->IsValidPrinter(printer_name)) { | 118 if (!print_backend_->IsValidPrinter(printer_name)) { |
| 119 // TODO(gene): Notify explicitly if printer is not valid, instead of | 119 // TODO(gene): Notify explicitly if printer is not valid, instead of |
| 120 // failed to get capabilities. | 120 // failed to get capabilities. |
| 121 BrowserThread::PostTask( | 121 BrowserThread::PostTask( |
| 122 BrowserThread::UI, FROM_HERE, | 122 BrowserThread::UI, FROM_HERE, |
| 123 base::Bind(&PrintSystemTaskProxy::SendFailedToGetPrinterCapabilities, | 123 base::Bind(&PrintSystemTaskProxy::SendFailedToGetPrinterCapabilities, |
| 124 this, printer_name)); | 124 this, printer_name)); |
| 125 return; | 125 return; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 if (handler_.get()) | 165 if (handler_.get()) |
| 166 handler_->SendPrinterCapabilities(*settings_info); | 166 handler_->SendPrinterCapabilities(*settings_info); |
| 167 delete settings_info; | 167 delete settings_info; |
| 168 } | 168 } |
| 169 | 169 |
| 170 void PrintSystemTaskProxy::SendFailedToGetPrinterCapabilities( | 170 void PrintSystemTaskProxy::SendFailedToGetPrinterCapabilities( |
| 171 const std::string& printer_name) { | 171 const std::string& printer_name) { |
| 172 if (handler_.get()) | 172 if (handler_.get()) |
| 173 handler_->SendFailedToGetPrinterCapabilities(printer_name); | 173 handler_->SendFailedToGetPrinterCapabilities(printer_name); |
| 174 } | 174 } |
| OLD | NEW |