Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: printing/backend/print_backend.h

Issue 1979903002: Print Preview: Get printer info with capabilities. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cups_14
Patch Set: nit Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "printing/print_job_constants.h" 13 #include "printing/print_job_constants.h"
14 #include "printing/printing_export.h" 14 #include "printing/printing_export.h"
15 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
16 16
17 namespace base { 17 namespace base {
18 class DictionaryValue; 18 class DictionaryValue;
19 } 19 }
20 20
21 // This is the interface for platform-specific code for a print backend 21 // This is the interface for platform-specific code for a print backend
22 namespace printing { 22 namespace printing {
23 23
24 // Note: There are raw values. The |printer_name| and |printer_description|
25 // require further interpretation on Mac. See existing callers for examples.
24 struct PRINTING_EXPORT PrinterBasicInfo { 26 struct PRINTING_EXPORT PrinterBasicInfo {
25 PrinterBasicInfo(); 27 PrinterBasicInfo();
26 PrinterBasicInfo(const PrinterBasicInfo& other); 28 PrinterBasicInfo(const PrinterBasicInfo& other);
27 ~PrinterBasicInfo(); 29 ~PrinterBasicInfo();
28 30
29 std::string printer_name; 31 std::string printer_name;
30 std::string printer_description; 32 std::string printer_description;
31 int printer_status; 33 int printer_status;
32 int is_default; 34 int is_default;
33 std::map<std::string, std::string> options; 35 std::map<std::string, std::string> options;
34 }; 36 };
35 37
36 typedef std::vector<PrinterBasicInfo> PrinterList; 38 using PrinterList = std::vector<PrinterBasicInfo>;
37 39
38 struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults { 40 struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults {
39 PrinterSemanticCapsAndDefaults(); 41 PrinterSemanticCapsAndDefaults();
40 PrinterSemanticCapsAndDefaults(const PrinterSemanticCapsAndDefaults& other); 42 PrinterSemanticCapsAndDefaults(const PrinterSemanticCapsAndDefaults& other);
41 ~PrinterSemanticCapsAndDefaults(); 43 ~PrinterSemanticCapsAndDefaults();
42 44
43 bool collate_capable; 45 bool collate_capable;
44 bool collate_default; 46 bool collate_default;
45 47
46 bool copies_capable; 48 bool copies_capable;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Please note, that PrintBackend is not platform specific, but rather 84 // Please note, that PrintBackend is not platform specific, but rather
83 // print system specific. For example, CUPS is available on both Linux and Mac, 85 // print system specific. For example, CUPS is available on both Linux and Mac,
84 // but not available on ChromeOS, etc. This design allows us to add more 86 // but not available on ChromeOS, etc. This design allows us to add more
85 // functionality on some platforms, while reusing core (CUPS) functions. 87 // functionality on some platforms, while reusing core (CUPS) functions.
86 class PRINTING_EXPORT PrintBackend 88 class PRINTING_EXPORT PrintBackend
87 : public base::RefCountedThreadSafe<PrintBackend> { 89 : public base::RefCountedThreadSafe<PrintBackend> {
88 public: 90 public:
89 // Enumerates the list of installed local and network printers. 91 // Enumerates the list of installed local and network printers.
90 virtual bool EnumeratePrinters(PrinterList* printer_list) = 0; 92 virtual bool EnumeratePrinters(PrinterList* printer_list) = 0;
91 93
92 // Get the default printer name. Empty string if no default printer. 94 // Gets the default printer name. Empty string if no default printer.
93 virtual std::string GetDefaultPrinterName() = 0; 95 virtual std::string GetDefaultPrinterName() = 0;
94 96
97 // Gets the basic printer info for a specific printer.
98 virtual bool GetPrinterBasicInfo(const std::string& printer_name,
99 PrinterBasicInfo* printer_info) = 0;
100
95 // Gets the semantic capabilities and defaults for a specific printer. 101 // Gets the semantic capabilities and defaults for a specific printer.
96 // This is usually a lighter implementation than GetPrinterCapsAndDefaults(). 102 // This is usually a lighter implementation than GetPrinterCapsAndDefaults().
97 // NOTE: on some old platforms (WinXP without XPS pack) 103 // NOTE: on some old platforms (WinXP without XPS pack)
98 // GetPrinterCapsAndDefaults() will fail, while this function will succeed. 104 // GetPrinterCapsAndDefaults() will fail, while this function will succeed.
99 virtual bool GetPrinterSemanticCapsAndDefaults( 105 virtual bool GetPrinterSemanticCapsAndDefaults(
100 const std::string& printer_name, 106 const std::string& printer_name,
101 PrinterSemanticCapsAndDefaults* printer_info) = 0; 107 PrinterSemanticCapsAndDefaults* printer_info) = 0;
102 108
103 // Gets the capabilities and defaults for a specific printer. 109 // Gets the capabilities and defaults for a specific printer.
104 virtual bool GetPrinterCapsAndDefaults( 110 virtual bool GetPrinterCapsAndDefaults(
105 const std::string& printer_name, 111 const std::string& printer_name,
106 PrinterCapsAndDefaults* printer_info) = 0; 112 PrinterCapsAndDefaults* printer_info) = 0;
107 113
108 // Gets the information about driver for a specific printer. 114 // Gets the information about driver for a specific printer.
109 virtual std::string GetPrinterDriverInfo( 115 virtual std::string GetPrinterDriverInfo(
110 const std::string& printer_name) = 0; 116 const std::string& printer_name) = 0;
111 117
112 // Returns true if printer_name points to a valid printer. 118 // Returns true if printer_name points to a valid printer.
113 virtual bool IsValidPrinter(const std::string& printer_name) = 0; 119 virtual bool IsValidPrinter(const std::string& printer_name) = 0;
114 120
115 // Allocate a print backend. If |print_backend_settings| is NULL, default 121 // Allocates a print backend. If |print_backend_settings| is nullptr, default
116 // settings will be used. 122 // settings will be used.
117 static scoped_refptr<PrintBackend> CreateInstance( 123 static scoped_refptr<PrintBackend> CreateInstance(
118 const base::DictionaryValue* print_backend_settings); 124 const base::DictionaryValue* print_backend_settings);
119 125
120 protected: 126 protected:
121 friend class base::RefCountedThreadSafe<PrintBackend>; 127 friend class base::RefCountedThreadSafe<PrintBackend>;
122 virtual ~PrintBackend(); 128 virtual ~PrintBackend();
123 }; 129 };
124 130
125 } // namespace printing 131 } // namespace printing
126 132
127 #endif // PRINTING_BACKEND_PRINT_BACKEND_H_ 133 #endif // PRINTING_BACKEND_PRINT_BACKEND_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.cc ('k') | printing/backend/print_backend_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698