| 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 "printing/backend/print_backend.h" | 5 #include "printing/backend/print_backend.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // PrintBackend implementation. | 107 // PrintBackend implementation. |
| 108 virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE; | 108 virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE; |
| 109 | 109 |
| 110 virtual std::string GetDefaultPrinterName() OVERRIDE; | 110 virtual std::string GetDefaultPrinterName() OVERRIDE; |
| 111 | 111 |
| 112 virtual bool GetPrinterCapsAndDefaults( | 112 virtual bool GetPrinterCapsAndDefaults( |
| 113 const std::string& printer_name, | 113 const std::string& printer_name, |
| 114 PrinterCapsAndDefaults* printer_info) OVERRIDE; | 114 PrinterCapsAndDefaults* printer_info) OVERRIDE; |
| 115 | 115 |
| 116 virtual bool GetPrinterDriverInfo(const std::string& printer_name, | 116 virtual bool GetPrinterDriverInfo(const std::string& printer_name, |
| 117 PrinterDriverInfo* driver_info) OVERRIDE; | 117 std::string* driver_info) OVERRIDE; |
| 118 | 118 |
| 119 virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; | 119 virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 // Following functions are wrappers around corresponding CUPS functions. | 122 // Following functions are wrappers around corresponding CUPS functions. |
| 123 // <functions>2() are called when print server is specified, and plain | 123 // <functions>2() are called when print server is specified, and plain |
| 124 // version in another case. There is an issue specifing CUPS_HTTP_DEFAULT | 124 // version in another case. There is an issue specifing CUPS_HTTP_DEFAULT |
| 125 // in the <functions>2(), it does not work in CUPS prior to 1.4. | 125 // in the <functions>2(), it does not work in CUPS prior to 1.4. |
| 126 int GetDests(cups_dest_t** dests); | 126 int GetDests(cups_dest_t** dests); |
| 127 FilePath GetPPD(const char* name); | 127 FilePath GetPPD(const char* name); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 printer_info->caps_mime_type = "application/pagemaker"; | 222 printer_info->caps_mime_type = "application/pagemaker"; |
| 223 // In CUPS, printer defaults is a part of PPD file. Nothing to upload here. | 223 // In CUPS, printer defaults is a part of PPD file. Nothing to upload here. |
| 224 printer_info->printer_defaults.clear(); | 224 printer_info->printer_defaults.clear(); |
| 225 printer_info->defaults_mime_type.clear(); | 225 printer_info->defaults_mime_type.clear(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 return res; | 228 return res; |
| 229 } | 229 } |
| 230 | 230 |
| 231 bool PrintBackendCUPS::GetPrinterDriverInfo(const std::string& printer_name, | 231 bool PrintBackendCUPS::GetPrinterDriverInfo(const std::string& printer_name, |
| 232 PrinterDriverInfo* driver_info) { | 232 std::string* driver_info) { |
| 233 // TODO(vitalybuka): MAC implementation. http://crbug.com/108194 | 233 // TODO(vitalybuka): MAC implementation. http://crbug.com/108194 |
| 234 return false; | 234 return false; |
| 235 } | 235 } |
| 236 | 236 |
| 237 bool PrintBackendCUPS::IsValidPrinter(const std::string& printer_name) { | 237 bool PrintBackendCUPS::IsValidPrinter(const std::string& printer_name) { |
| 238 // This is not very efficient way to get specific printer info. CUPS 1.4 | 238 // This is not very efficient way to get specific printer info. CUPS 1.4 |
| 239 // supports cupsGetNamedDest() function. However, CUPS 1.4 is not available | 239 // supports cupsGetNamedDest() function. However, CUPS 1.4 is not available |
| 240 // everywhere (for example, it supported from Mac OS 10.6 only). | 240 // everywhere (for example, it supported from Mac OS 10.6 only). |
| 241 PrinterList printer_list; | 241 PrinterList printer_list; |
| 242 EnumeratePrinters(&printer_list); | 242 EnumeratePrinters(&printer_list); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 << ", HTTP error: " << http_error; | 319 << ", HTTP error: " << http_error; |
| 320 file_util::Delete(ppd_path, false); | 320 file_util::Delete(ppd_path, false); |
| 321 ppd_path.clear(); | 321 ppd_path.clear(); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 return ppd_path; | 325 return ppd_path; |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace printing | 328 } // namespace printing |
| OLD | NEW |