| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // PrintBackend class will provide interface for different print backends | 46 // PrintBackend class will provide interface for different print backends |
| 47 // (Windows, CUPS) to implement. User will call CreateInstance() to | 47 // (Windows, CUPS) to implement. User will call CreateInstance() to |
| 48 // obtain available print backend. | 48 // obtain available print backend. |
| 49 // Please note, that PrintBackend is not platform specific, but rather | 49 // Please note, that PrintBackend is not platform specific, but rather |
| 50 // 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, |
| 51 // 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 |
| 52 // functionality on some platforms, while reusing core (CUPS) functions. | 52 // functionality on some platforms, while reusing core (CUPS) functions. |
| 53 class PRINTING_EXPORT PrintBackend | 53 class PRINTING_EXPORT PrintBackend |
| 54 : public base::RefCountedThreadSafe<PrintBackend> { | 54 : public base::RefCountedThreadSafe<PrintBackend> { |
| 55 public: | 55 public: |
| 56 virtual ~PrintBackend(); | |
| 57 | |
| 58 // Enumerates the list of installed local and network printers. | 56 // Enumerates the list of installed local and network printers. |
| 59 virtual bool EnumeratePrinters(PrinterList* printer_list) = 0; | 57 virtual bool EnumeratePrinters(PrinterList* printer_list) = 0; |
| 60 | 58 |
| 61 // Get the default printer name. Empty string if no default printer. | 59 // Get the default printer name. Empty string if no default printer. |
| 62 virtual std::string GetDefaultPrinterName() = 0; | 60 virtual std::string GetDefaultPrinterName() = 0; |
| 63 | 61 |
| 64 // Gets the capabilities and defaults for a specific printer. | 62 // Gets the capabilities and defaults for a specific printer. |
| 65 virtual bool GetPrinterCapsAndDefaults( | 63 virtual bool GetPrinterCapsAndDefaults( |
| 66 const std::string& printer_name, | 64 const std::string& printer_name, |
| 67 PrinterCapsAndDefaults* printer_info) = 0; | 65 PrinterCapsAndDefaults* printer_info) = 0; |
| 68 | 66 |
| 69 // Gets the information about driver for a specific printer. | 67 // Gets the information about driver for a specific printer. |
| 70 virtual std::string GetPrinterDriverInfo( | 68 virtual std::string GetPrinterDriverInfo( |
| 71 const std::string& printer_name) = 0; | 69 const std::string& printer_name) = 0; |
| 72 | 70 |
| 73 // Returns true if printer_name points to a valid printer. | 71 // Returns true if printer_name points to a valid printer. |
| 74 virtual bool IsValidPrinter(const std::string& printer_name) = 0; | 72 virtual bool IsValidPrinter(const std::string& printer_name) = 0; |
| 75 | 73 |
| 76 // Allocate a print backend. If |print_backend_settings| is NULL, default | 74 // Allocate a print backend. If |print_backend_settings| is NULL, default |
| 77 // settings will be used. | 75 // settings will be used. |
| 78 // Return NULL if no print backend available. | 76 // Return NULL if no print backend available. |
| 79 static scoped_refptr<PrintBackend> CreateInstance( | 77 static scoped_refptr<PrintBackend> CreateInstance( |
| 80 const base::DictionaryValue* print_backend_settings); | 78 const base::DictionaryValue* print_backend_settings); |
| 79 |
| 80 protected: |
| 81 friend class base::RefCountedThreadSafe<PrintBackend>; |
| 82 virtual ~PrintBackend(); |
| 81 }; | 83 }; |
| 82 | 84 |
| 83 } // namespace printing | 85 } // namespace printing |
| 84 | 86 |
| 85 #endif // PRINTING_BACKEND_PRINT_BACKEND_H_ | 87 #endif // PRINTING_BACKEND_PRINT_BACKEND_H_ |
| OLD | NEW |