OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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_CONNECTION_H_ | |
6 #define PRINTING_BACKEND_CUPS_CONNECTION_H_ | |
7 | |
8 #include <cups/cups.h> | |
9 | |
10 #include <memory> | |
11 #include <string> | |
12 #include <vector> | |
13 | |
14 #include "printing/backend/cups_printer.h" | |
15 #include "printing/printing_export.h" | |
16 #include "url/gurl.h" | |
17 | |
18 namespace printing { | |
19 | |
20 // Represents a connection to a CUPS server. | |
21 class PRINTING_EXPORT CupsConnection { | |
22 public: | |
23 explicit CupsConnection(const GURL& print_server_url, | |
24 http_encryption_t encryption, | |
25 bool blocking); | |
26 | |
27 CupsConnection(const CupsConnection& connection); | |
28 | |
29 ~CupsConnection(); | |
30 | |
31 // Returns the number of destinations and populates |destinations|. | |
32 std::vector<CupsPrinter> GetDests(); | |
33 | |
34 // Returns a printer for |printer_name| from the connected server. | |
35 CupsPrinter* GetPrinter(const std::string& printer_name); | |
36 | |
37 std::string server_name() const; | |
38 | |
39 int last_error() const; | |
40 | |
41 private: | |
42 // lazily initialize http connection | |
43 bool Connect(); | |
44 | |
45 GURL print_server_url_; | |
46 http_encryption_t cups_encryption_; | |
47 bool blocking_; | |
48 | |
49 std::shared_ptr<http_t> cups_http_; | |
Lei Zhang
2016/07/08 01:19:50
Currently banned: https://chromium-cpp.appspot.com
skau
2016/07/08 21:24:08
I've switched to a WeakPtr implementation. Lmk wh
| |
50 }; | |
51 | |
52 } // namespace printing | |
53 | |
54 #endif // PRINTING_BACKEND_CUPS_CONNECTION_H_ | |
OLD | NEW |