OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 static const char kCUPSPrinterInfoOpt[] = "printer-info"; | 90 static const char kCUPSPrinterInfoOpt[] = "printer-info"; |
91 static const char kCUPSPrinterStateOpt[] = "printer-state"; | 91 static const char kCUPSPrinterStateOpt[] = "printer-state"; |
92 static const char kCUPSPrinterTypeOpt[] = "printer-type"; | 92 static const char kCUPSPrinterTypeOpt[] = "printer-type"; |
93 | 93 |
94 class PrintBackendCUPS : public PrintBackend { | 94 class PrintBackendCUPS : public PrintBackend { |
95 public: | 95 public: |
96 PrintBackendCUPS(const GURL& print_server_url, bool blocking); | 96 PrintBackendCUPS(const GURL& print_server_url, bool blocking); |
97 virtual ~PrintBackendCUPS() {} | 97 virtual ~PrintBackendCUPS() {} |
98 | 98 |
99 // PrintBackend implementation. | 99 // PrintBackend implementation. |
100 virtual bool EnumeratePrinters(PrinterList* printer_list); | 100 virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE; |
101 | 101 |
102 virtual std::string GetDefaultPrinterName(); | 102 virtual std::string GetDefaultPrinterName() OVERRIDE; |
103 | 103 |
104 virtual bool GetPrinterCapsAndDefaults(const std::string& printer_name, | 104 virtual bool GetPrinterCapsAndDefaults( |
105 PrinterCapsAndDefaults* printer_info); | 105 const std::string& printer_name, |
| 106 PrinterCapsAndDefaults* printer_info) OVERRIDE; |
106 | 107 |
107 virtual bool IsValidPrinter(const std::string& printer_name); | 108 virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; |
108 | 109 |
109 private: | 110 private: |
110 // Following functions are wrappers around corresponding CUPS functions. | 111 // Following functions are wrappers around corresponding CUPS functions. |
111 // <functions>2() are called when print server is specified, and plain | 112 // <functions>2() are called when print server is specified, and plain |
112 // version in another case. There is an issue specifing CUPS_HTTP_DEFAULT | 113 // version in another case. There is an issue specifing CUPS_HTTP_DEFAULT |
113 // in the <functions>2(), it does not work in CUPS prior to 1.4. | 114 // in the <functions>2(), it does not work in CUPS prior to 1.4. |
114 int GetDests(cups_dest_t** dests); | 115 int GetDests(cups_dest_t** dests); |
115 FilePath GetPPD(const char* name); | 116 FilePath GetPPD(const char* name); |
116 | 117 |
117 GURL print_server_url_; | 118 GURL print_server_url_; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 << ", HTTP error: " << http_error; | 302 << ", HTTP error: " << http_error; |
302 file_util::Delete(ppd_path, false); | 303 file_util::Delete(ppd_path, false); |
303 ppd_path.clear(); | 304 ppd_path.clear(); |
304 } | 305 } |
305 } | 306 } |
306 } | 307 } |
307 return ppd_path; | 308 return ppd_path; |
308 } | 309 } |
309 | 310 |
310 } // namespace printing | 311 } // namespace printing |
OLD | NEW |