| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| 46 // PrintBackend class will provide interface for different print backends | 56 // PrintBackend class will provide interface for different print backends |
| 47 // (Windows, CUPS) to implement. User will call CreateInstance() to | 57 // (Windows, CUPS) to implement. User will call CreateInstance() to |
| 48 // obtain available print backend. | 58 // obtain available print backend. |
| 49 // Please note, that PrintBackend is not platform specific, but rather | 59 // Please note, that PrintBackend is not platform specific, but rather |
| 50 // print system specific. For example, CUPS is available on both Linux and Mac, | 60 // print system specific. For example, CUPS is available on both Linux and Mac, |
| 51 // but not available on ChromeOS, etc. This design allows us to add more | 61 // but not available on ChromeOS, etc. This design allows us to add more |
| 52 // functionality on some platforms, while reusing core (CUPS) functions. | 62 // functionality on some platforms, while reusing core (CUPS) functions. |
| 53 class PRINTING_EXPORT PrintBackend | 63 class PRINTING_EXPORT PrintBackend |
| 54 : public base::RefCountedThreadSafe<PrintBackend> { | 64 : public base::RefCountedThreadSafe<PrintBackend> { |
| 55 public: | 65 public: |
| 56 virtual ~PrintBackend(); | 66 virtual ~PrintBackend(); |
| 57 | 67 |
| 58 // Enumerates the list of installed local and network printers. | 68 // Enumerates the list of installed local and network printers. |
| 59 virtual bool EnumeratePrinters(PrinterList* printer_list) = 0; | 69 virtual bool EnumeratePrinters(PrinterList* printer_list) = 0; |
| 60 | 70 |
| 61 // Get the default printer name. Empty string if no default printer. | 71 // Get the default printer name. Empty string if no default printer. |
| 62 virtual std::string GetDefaultPrinterName() = 0; | 72 virtual std::string GetDefaultPrinterName() = 0; |
| 63 | 73 |
| 64 // Gets the capabilities and defaults for a specific printer. | 74 // Gets the capabilities and defaults for a specific printer. |
| 65 virtual bool GetPrinterCapsAndDefaults( | 75 virtual bool GetPrinterCapsAndDefaults( |
| 66 const std::string& printer_name, | 76 const std::string& printer_name, |
| 67 PrinterCapsAndDefaults* printer_info) = 0; | 77 PrinterCapsAndDefaults* printer_info) = 0; |
| 68 | 78 |
| 79 // Gets the information about driver for a specific printer. |
| 80 virtual bool GetPrinterDriverInfo( |
| 81 const std::string& printer_name, |
| 82 PrinterDriverInfo* driver_info) = 0; |
| 83 |
| 69 // Returns true if printer_name points to a valid printer. | 84 // Returns true if printer_name points to a valid printer. |
| 70 virtual bool IsValidPrinter(const std::string& printer_name) = 0; | 85 virtual bool IsValidPrinter(const std::string& printer_name) = 0; |
| 71 | 86 |
| 72 // Allocate a print backend. If |print_backend_settings| is NULL, default | 87 // Allocate a print backend. If |print_backend_settings| is NULL, default |
| 73 // settings will be used. | 88 // settings will be used. |
| 74 // Return NULL if no print backend available. | 89 // Return NULL if no print backend available. |
| 75 static scoped_refptr<PrintBackend> CreateInstance( | 90 static scoped_refptr<PrintBackend> CreateInstance( |
| 76 const base::DictionaryValue* print_backend_settings); | 91 const base::DictionaryValue* print_backend_settings); |
| 77 }; | 92 }; |
| 78 | 93 |
| 79 } // namespace printing | 94 } // namespace printing |
| 80 | 95 |
| 81 #endif // PRINTING_BACKEND_PRINT_BACKEND_H_ | 96 #endif // PRINTING_BACKEND_PRINT_BACKEND_H_ |
| OLD | NEW |