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 #ifndef PRINTING_BACKEND_CUPS_HELPER_H_ | 5 #ifndef PRINTING_BACKEND_CUPS_HELPER_H_ |
6 #define PRINTING_BACKEND_CUPS_HELPER_H_ | 6 #define PRINTING_BACKEND_CUPS_HELPER_H_ |
7 | 7 |
8 #include <cups/cups.h> | 8 #include <cups/cups.h> |
9 | 9 |
10 #include <string> | 10 #include "base/strings/string_piece.h" |
11 | |
12 #include "printing/printing_export.h" | 11 #include "printing/printing_export.h" |
13 | 12 |
14 class GURL; | 13 class GURL; |
15 | 14 |
16 // These are helper functions for dealing with CUPS. | 15 // These are helper functions for dealing with CUPS. |
17 namespace printing { | 16 namespace printing { |
18 | 17 |
19 struct PrinterSemanticCapsAndDefaults; | 18 struct PrinterSemanticCapsAndDefaults; |
20 | 19 |
21 // Helper wrapper around http_t structure, with connection and cleanup | 20 // Helper wrapper around http_t structure, with connection and cleanup |
22 // functionality. | 21 // functionality. |
23 class PRINTING_EXPORT HttpConnectionCUPS { | 22 class PRINTING_EXPORT HttpConnectionCUPS { |
24 public: | 23 public: |
25 HttpConnectionCUPS(const GURL& print_server_url, | 24 HttpConnectionCUPS(const GURL& print_server_url, |
26 http_encryption_t encryption); | 25 http_encryption_t encryption); |
27 ~HttpConnectionCUPS(); | 26 ~HttpConnectionCUPS(); |
28 | 27 |
29 void SetBlocking(bool blocking); | 28 void SetBlocking(bool blocking); |
30 | 29 |
31 http_t* http(); | 30 http_t* http(); |
32 | 31 |
33 private: | 32 private: |
34 http_t* http_; | 33 http_t* http_; |
35 }; | 34 }; |
36 | 35 |
37 // Helper function to parse and convert PPD capabilitites to | 36 // Helper function to parse and convert PPD capabilitites to |
38 // semantic options. | 37 // semantic options. |
39 PRINTING_EXPORT bool ParsePpdCapabilities( | 38 PRINTING_EXPORT bool ParsePpdCapabilities( |
40 const std::string& printer_name, | 39 base::StringPiece printer_name, |
41 const std::string& printer_capabilities, | 40 base::StringPiece printer_capabilities, |
42 PrinterSemanticCapsAndDefaults* printer_info); | 41 PrinterSemanticCapsAndDefaults* printer_info); |
43 | 42 |
44 } // namespace printing | 43 } // namespace printing |
45 | 44 |
46 #endif // PRINTING_BACKEND_CUPS_HELPER_H_ | 45 #endif // PRINTING_BACKEND_CUPS_HELPER_H_ |
OLD | NEW |