OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 CHROMEOS_PRINTING_PPD_PROVIDER_H_ | 5 #ifndef CHROMEOS_PRINTING_PPD_PROVIDER_H_ |
6 #define CHROMEOS_PRINTING_PPD_PROVIDER_H_ | 6 #define CHROMEOS_PRINTING_PPD_PROVIDER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/sequenced_task_runner.h" | |
16 #include "chromeos/chromeos_export.h" | 15 #include "chromeos/chromeos_export.h" |
17 #include "chromeos/printing/printer_configuration.h" | 16 #include "chromeos/printing/printer_configuration.h" |
18 | 17 |
19 namespace net { | 18 namespace net { |
20 class URLRequestContextGetter; | 19 class URLRequestContextGetter; |
21 } | 20 } |
22 | 21 |
23 namespace chromeos { | 22 namespace chromeos { |
24 namespace printing { | 23 namespace printing { |
25 | 24 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // NOT_FOUND means we don't know about this Usb device. | 83 // NOT_FOUND means we don't know about this Usb device. |
85 using ResolveUsbIdsCallback = | 84 using ResolveUsbIdsCallback = |
86 base::Callback<void(CallbackResultCode, const std::string&)>; | 85 base::Callback<void(CallbackResultCode, const std::string&)>; |
87 | 86 |
88 // Create and return a new PpdProvider with the given cache and options. | 87 // Create and return a new PpdProvider with the given cache and options. |
89 // A references to |url_context_getter| is taken. | 88 // A references to |url_context_getter| is taken. |
90 static scoped_refptr<PpdProvider> Create( | 89 static scoped_refptr<PpdProvider> Create( |
91 const std::string& browser_locale, | 90 const std::string& browser_locale, |
92 scoped_refptr<net::URLRequestContextGetter> url_context_getter, | 91 scoped_refptr<net::URLRequestContextGetter> url_context_getter, |
93 scoped_refptr<PpdCache> cache, | 92 scoped_refptr<PpdCache> cache, |
94 scoped_refptr<base::SequencedTaskRunner> disk_task_runner, | |
95 const Options& options = Options()); | 93 const Options& options = Options()); |
96 | 94 |
97 // Get all manufacturers for which we have drivers. Keys of the map will be | 95 // Get all manufacturers for which we have drivers. Keys of the map will be |
98 // localized in the default browser locale or the closest available fallback. | 96 // localized in the default browser locale or the closest available fallback. |
99 // | 97 // |
100 // |cb| will be called on the invoking thread, and will be sequenced. | 98 // |cb| will be called on the invoking thread, and will be sequenced. |
101 virtual void ResolveManufacturers(const ResolveManufacturersCallback& cb) = 0; | 99 virtual void ResolveManufacturers(const ResolveManufacturersCallback& cb) = 0; |
102 | 100 |
103 // Get all models from a given manufacturer, localized in the default browser | 101 // Get all models from a given manufacturer, localized in the default browser |
104 // locale or the closest available fallback. |manufacturer| must be a value | 102 // locale or the closest available fallback. |manufacturer| must be a value |
(...skipping 22 matching lines...) Expand all Loading... |
127 virtual bool GetPpdReference(const std::string& manufacturer, | 125 virtual bool GetPpdReference(const std::string& manufacturer, |
128 const std::string& printer, | 126 const std::string& printer, |
129 Printer::PpdReference* reference) const = 0; | 127 Printer::PpdReference* reference) const = 0; |
130 | 128 |
131 // Given a PpdReference, attempt to get the PPD for printing. | 129 // Given a PpdReference, attempt to get the PPD for printing. |
132 // | 130 // |
133 // |cb| will be called on the invoking thread, and will be sequenced. | 131 // |cb| will be called on the invoking thread, and will be sequenced. |
134 virtual void ResolvePpd(const Printer::PpdReference& reference, | 132 virtual void ResolvePpd(const Printer::PpdReference& reference, |
135 const ResolvePpdCallback& cb) = 0; | 133 const ResolvePpdCallback& cb) = 0; |
136 | 134 |
137 // Hook for testing. Returns true if there are no API calls that have not | |
138 // yet completed. | |
139 virtual bool Idle() const = 0; | |
140 | |
141 protected: | 135 protected: |
142 friend class base::RefCounted<PpdProvider>; | 136 friend class base::RefCounted<PpdProvider>; |
143 virtual ~PpdProvider() {} | 137 virtual ~PpdProvider() {} |
144 }; | 138 }; |
145 | 139 |
146 } // namespace printing | 140 } // namespace printing |
147 } // namespace chromeos | 141 } // namespace chromeos |
148 | 142 |
149 #endif // CHROMEOS_PRINTING_PPD_PROVIDER_H_ | 143 #endif // CHROMEOS_PRINTING_PPD_PROVIDER_H_ |
OLD | NEW |