Chromium Code Reviews| 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" | |
| 15 #include "chromeos/chromeos_export.h" | 16 #include "chromeos/chromeos_export.h" |
| 16 #include "chromeos/printing/printer_configuration.h" | 17 #include "chromeos/printing/printer_configuration.h" |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 namespace printing { | 24 namespace printing { |
| 24 | 25 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 | 69 |
| 69 // hostname of quirks server to query. | 70 // hostname of quirks server to query. |
| 70 std::string quirks_server = "chromeosquirksserver-pa.googleapis.com"; | 71 std::string quirks_server = "chromeosquirksserver-pa.googleapis.com"; |
| 71 | 72 |
| 72 // Maximum size of the contents of a PPD file, in bytes. Trying to use a | 73 // Maximum size of the contents of a PPD file, in bytes. Trying to use a |
| 73 // PPD file bigger than this will cause INTERNAL_ERRORs at resolution time. | 74 // PPD file bigger than this will cause INTERNAL_ERRORs at resolution time. |
| 74 size_t max_ppd_contents_size_ = 100 * 1024; | 75 size_t max_ppd_contents_size_ = 100 * 1024; |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 // Create and return a new PpdProvider with the given cache and options. | 78 // Create and return a new PpdProvider with the given cache and options. |
| 79 // |disk_task_runner| is used to run operations that hit the disk. References | |
| 80 // to |url_context_getter| and |disk_task_runner| are taken. | |
|
skau
2016/11/09 00:01:09
If you're taking a reference to these objects, you
Carlson
2016/11/10 19:22:50
Ugh, I had found (apparently older) advice that sa
| |
| 78 static std::unique_ptr<PpdProvider> Create( | 81 static std::unique_ptr<PpdProvider> Create( |
| 79 const std::string& api_key, | 82 const std::string& api_key, |
| 80 scoped_refptr<net::URLRequestContextGetter> url_context_getter, | 83 net::URLRequestContextGetter* url_context_getter, |
| 84 base::SequencedTaskRunner* disk_task_runner, | |
| 81 std::unique_ptr<PpdCache> cache, | 85 std::unique_ptr<PpdCache> cache, |
| 82 const Options& options = Options()); | 86 const Options& options = Options()); |
| 83 | 87 |
| 84 virtual ~PpdProvider() {} | 88 virtual ~PpdProvider() {} |
| 85 | 89 |
| 86 // Given a PpdReference, attempt to resolve the PPD for printing. | 90 // Given a PpdReference, attempt to resolve the PPD for printing. |
| 87 // | 91 // |
| 88 // Must be called from a Sequenced Task context (i.e. | 92 // Must be called from a Sequenced Task context (i.e. |
| 89 // base::SequencedTaskRunnerHandle::IsSet() must be true). | 93 // base::SequencedTaskRunnerHandle::IsSet() must be true). |
| 90 // | 94 // |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 // whatever they give us directly into the cache without doing a resolve. | 126 // whatever they give us directly into the cache without doing a resolve. |
| 123 // This hook lets is do that. | 127 // This hook lets is do that. |
| 124 virtual bool CachePpd(const Printer::PpdReference& ppd_reference, | 128 virtual bool CachePpd(const Printer::PpdReference& ppd_reference, |
| 125 const base::FilePath& ppd_path) = 0; | 129 const base::FilePath& ppd_path) = 0; |
| 126 }; | 130 }; |
| 127 | 131 |
| 128 } // namespace printing | 132 } // namespace printing |
| 129 } // namespace chromeos | 133 } // namespace chromeos |
| 130 | 134 |
| 131 #endif // CHROMEOS_PRINTING_PPD_PROVIDER_H_ | 135 #endif // CHROMEOS_PRINTING_PPD_PROVIDER_H_ |
| OLD | NEW |