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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
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, |
| 117 PrinterDriverInfo* driver_info) OVERRIDE; |
| 118 |
116 virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; | 119 virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; |
117 | 120 |
118 private: | 121 private: |
119 // Following functions are wrappers around corresponding CUPS functions. | 122 // Following functions are wrappers around corresponding CUPS functions. |
120 // <functions>2() are called when print server is specified, and plain | 123 // <functions>2() are called when print server is specified, and plain |
121 // 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 |
122 // 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. |
123 int GetDests(cups_dest_t** dests); | 126 int GetDests(cups_dest_t** dests); |
124 FilePath GetPPD(const char* name); | 127 FilePath GetPPD(const char* name); |
125 | 128 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 printer_info->printer_capabilities.swap(content); | 221 printer_info->printer_capabilities.swap(content); |
219 printer_info->caps_mime_type = "application/pagemaker"; | 222 printer_info->caps_mime_type = "application/pagemaker"; |
220 // 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. |
221 printer_info->printer_defaults.clear(); | 224 printer_info->printer_defaults.clear(); |
222 printer_info->defaults_mime_type.clear(); | 225 printer_info->defaults_mime_type.clear(); |
223 } | 226 } |
224 | 227 |
225 return res; | 228 return res; |
226 } | 229 } |
227 | 230 |
| 231 bool PrintBackendCUPS::GetPrinterDriverInfo(const std::string& printer_name, |
| 232 PrinterDriverInfo* driver_info) { |
| 233 // TODO(vitalybuka): MAC implementation. http://crbug.com/108194 |
| 234 return false; |
| 235 } |
| 236 |
228 bool PrintBackendCUPS::IsValidPrinter(const std::string& printer_name) { | 237 bool PrintBackendCUPS::IsValidPrinter(const std::string& printer_name) { |
229 // 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 |
230 // supports cupsGetNamedDest() function. However, CUPS 1.4 is not available | 239 // supports cupsGetNamedDest() function. However, CUPS 1.4 is not available |
231 // everywhere (for example, it supported from Mac OS 10.6 only). | 240 // everywhere (for example, it supported from Mac OS 10.6 only). |
232 PrinterList printer_list; | 241 PrinterList printer_list; |
233 EnumeratePrinters(&printer_list); | 242 EnumeratePrinters(&printer_list); |
234 | 243 |
235 PrinterList::iterator it; | 244 PrinterList::iterator it; |
236 for (it = printer_list.begin(); it != printer_list.end(); ++it) | 245 for (it = printer_list.begin(); it != printer_list.end(); ++it) |
237 if (it->printer_name == printer_name) | 246 if (it->printer_name == printer_name) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 << ", HTTP error: " << http_error; | 319 << ", HTTP error: " << http_error; |
311 file_util::Delete(ppd_path, false); | 320 file_util::Delete(ppd_path, false); |
312 ppd_path.clear(); | 321 ppd_path.clear(); |
313 } | 322 } |
314 } | 323 } |
315 } | 324 } |
316 return ppd_path; | 325 return ppd_path; |
317 } | 326 } |
318 | 327 |
319 } // namespace printing | 328 } // namespace printing |
OLD | NEW |