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