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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 namespace printing { | 96 namespace printing { |
97 | 97 |
98 static const char kCUPSPrinterInfoOpt[] = "printer-info"; | 98 static const char kCUPSPrinterInfoOpt[] = "printer-info"; |
99 static const char kCUPSPrinterStateOpt[] = "printer-state"; | 99 static const char kCUPSPrinterStateOpt[] = "printer-state"; |
100 static const char kCUPSPrinterTypeOpt[] = "printer-type"; | 100 static const char kCUPSPrinterTypeOpt[] = "printer-type"; |
101 static const char kCUPSPrinterMakeModelOpt[] = "printer-make-and-model"; | 101 static const char kCUPSPrinterMakeModelOpt[] = "printer-make-and-model"; |
102 | 102 |
103 class PrintBackendCUPS : public PrintBackend { | 103 class PrintBackendCUPS : public PrintBackend { |
104 public: | 104 public: |
105 PrintBackendCUPS(const GURL& print_server_url, bool blocking); | 105 PrintBackendCUPS(const GURL& print_server_url, bool blocking); |
106 virtual ~PrintBackendCUPS() {} | |
107 | 106 |
108 // PrintBackend implementation. | 107 // PrintBackend implementation. |
109 virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE; | 108 virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE; |
110 | |
111 virtual std::string GetDefaultPrinterName() OVERRIDE; | 109 virtual std::string GetDefaultPrinterName() OVERRIDE; |
112 | |
113 virtual bool GetPrinterCapsAndDefaults( | 110 virtual bool GetPrinterCapsAndDefaults( |
114 const std::string& printer_name, | 111 const std::string& printer_name, |
115 PrinterCapsAndDefaults* printer_info) OVERRIDE; | 112 PrinterCapsAndDefaults* printer_info) OVERRIDE; |
116 | |
117 virtual std::string GetPrinterDriverInfo( | 113 virtual std::string GetPrinterDriverInfo( |
118 const std::string& printer_name) OVERRIDE; | 114 const std::string& printer_name) OVERRIDE; |
| 115 virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; |
119 | 116 |
120 virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; | 117 protected: |
| 118 virtual ~PrintBackendCUPS() {} |
121 | 119 |
122 private: | 120 private: |
123 // Following functions are wrappers around corresponding CUPS functions. | 121 // Following functions are wrappers around corresponding CUPS functions. |
124 // <functions>2() are called when print server is specified, and plain | 122 // <functions>2() are called when print server is specified, and plain |
125 // version in another case. There is an issue specifing CUPS_HTTP_DEFAULT | 123 // version in another case. There is an issue specifing CUPS_HTTP_DEFAULT |
126 // in the <functions>2(), it does not work in CUPS prior to 1.4. | 124 // in the <functions>2(), it does not work in CUPS prior to 1.4. |
127 int GetDests(cups_dest_t** dests); | 125 int GetDests(cups_dest_t** dests); |
128 FilePath GetPPD(const char* name); | 126 FilePath GetPPD(const char* name); |
129 | 127 |
130 GURL print_server_url_; | 128 GURL print_server_url_; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 << ", HTTP error: " << http_error; | 338 << ", HTTP error: " << http_error; |
341 file_util::Delete(ppd_path, false); | 339 file_util::Delete(ppd_path, false); |
342 ppd_path.clear(); | 340 ppd_path.clear(); |
343 } | 341 } |
344 } | 342 } |
345 } | 343 } |
346 return ppd_path; | 344 return ppd_path; |
347 } | 345 } |
348 | 346 |
349 } // namespace printing | 347 } // namespace printing |
OLD | NEW |