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_PRINT_BACKEND_H_ | 5 #ifndef PRINTING_BACKEND_PRINT_BACKEND_H_ |
6 #define PRINTING_BACKEND_PRINT_BACKEND_H_ | 6 #define PRINTING_BACKEND_PRINT_BACKEND_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 25 matching lines...) Expand all Loading... |
36 struct PRINTING_EXPORT PrinterCapsAndDefaults { | 36 struct PRINTING_EXPORT PrinterCapsAndDefaults { |
37 PrinterCapsAndDefaults(); | 37 PrinterCapsAndDefaults(); |
38 ~PrinterCapsAndDefaults(); | 38 ~PrinterCapsAndDefaults(); |
39 | 39 |
40 std::string printer_capabilities; | 40 std::string printer_capabilities; |
41 std::string caps_mime_type; | 41 std::string caps_mime_type; |
42 std::string printer_defaults; | 42 std::string printer_defaults; |
43 std::string defaults_mime_type; | 43 std::string defaults_mime_type; |
44 }; | 44 }; |
45 | 45 |
46 struct PRINTING_EXPORT PrinterDriverInfo { | |
47 PrinterDriverInfo(); | |
48 ~PrinterDriverInfo(); | |
49 | |
50 std::string driver_name; | |
51 std::string driver_version; | |
52 std::string product_name; | |
53 std::string product_version; | |
54 }; | |
55 | |
56 // PrintBackend class will provide interface for different print backends | 46 // PrintBackend class will provide interface for different print backends |
57 // (Windows, CUPS) to implement. User will call CreateInstance() to | 47 // (Windows, CUPS) to implement. User will call CreateInstance() to |
58 // obtain available print backend. | 48 // obtain available print backend. |
59 // Please note, that PrintBackend is not platform specific, but rather | 49 // Please note, that PrintBackend is not platform specific, but rather |
60 // print system specific. For example, CUPS is available on both Linux and Mac, | 50 // print system specific. For example, CUPS is available on both Linux and Mac, |
61 // but not available on ChromeOS, etc. This design allows us to add more | 51 // but not available on ChromeOS, etc. This design allows us to add more |
62 // functionality on some platforms, while reusing core (CUPS) functions. | 52 // functionality on some platforms, while reusing core (CUPS) functions. |
63 class PRINTING_EXPORT PrintBackend | 53 class PRINTING_EXPORT PrintBackend |
64 : public base::RefCountedThreadSafe<PrintBackend> { | 54 : public base::RefCountedThreadSafe<PrintBackend> { |
65 public: | 55 public: |
66 virtual ~PrintBackend(); | 56 virtual ~PrintBackend(); |
67 | 57 |
68 // Enumerates the list of installed local and network printers. | 58 // Enumerates the list of installed local and network printers. |
69 virtual bool EnumeratePrinters(PrinterList* printer_list) = 0; | 59 virtual bool EnumeratePrinters(PrinterList* printer_list) = 0; |
70 | 60 |
71 // Get the default printer name. Empty string if no default printer. | 61 // Get the default printer name. Empty string if no default printer. |
72 virtual std::string GetDefaultPrinterName() = 0; | 62 virtual std::string GetDefaultPrinterName() = 0; |
73 | 63 |
74 // Gets the capabilities and defaults for a specific printer. | 64 // Gets the capabilities and defaults for a specific printer. |
75 virtual bool GetPrinterCapsAndDefaults( | 65 virtual bool GetPrinterCapsAndDefaults( |
76 const std::string& printer_name, | 66 const std::string& printer_name, |
77 PrinterCapsAndDefaults* printer_info) = 0; | 67 PrinterCapsAndDefaults* printer_info) = 0; |
78 | 68 |
79 // Gets the information about driver for a specific printer. | 69 // Gets the information about driver for a specific printer. |
80 virtual bool GetPrinterDriverInfo( | 70 virtual bool GetPrinterDriverInfo( |
81 const std::string& printer_name, | 71 const std::string& printer_name, |
82 PrinterDriverInfo* driver_info) = 0; | 72 std::string* driver_info) = 0; |
83 | 73 |
84 // Returns true if printer_name points to a valid printer. | 74 // Returns true if printer_name points to a valid printer. |
85 virtual bool IsValidPrinter(const std::string& printer_name) = 0; | 75 virtual bool IsValidPrinter(const std::string& printer_name) = 0; |
86 | 76 |
87 // Allocate a print backend. If |print_backend_settings| is NULL, default | 77 // Allocate a print backend. If |print_backend_settings| is NULL, default |
88 // settings will be used. | 78 // settings will be used. |
89 // Return NULL if no print backend available. | 79 // Return NULL if no print backend available. |
90 static scoped_refptr<PrintBackend> CreateInstance( | 80 static scoped_refptr<PrintBackend> CreateInstance( |
91 const base::DictionaryValue* print_backend_settings); | 81 const base::DictionaryValue* print_backend_settings); |
92 }; | 82 }; |
93 | 83 |
94 } // namespace printing | 84 } // namespace printing |
95 | 85 |
96 #endif // PRINTING_BACKEND_PRINT_BACKEND_H_ | 86 #endif // PRINTING_BACKEND_PRINT_BACKEND_H_ |
OLD | NEW |