| 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_CACHE_H_ | 5 #ifndef CHROMEOS_PRINTING_PPD_CACHE_H_ |
| 6 #define CHROMEOS_PRINTING_PPD_CACHE_H_ | 6 #define CHROMEOS_PRINTING_PPD_CACHE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 base::TimeDelta max_available_list_staleness = | 39 base::TimeDelta max_available_list_staleness = |
| 40 base::TimeDelta::FromDays(14); | 40 base::TimeDelta::FromDays(14); |
| 41 | 41 |
| 42 // Size limit on the serialized cached available printer list, in bytes. | 42 // Size limit on the serialized cached available printer list, in bytes. |
| 43 // This is just a check to make sure we don't consume ridiculous amounts of | 43 // This is just a check to make sure we don't consume ridiculous amounts of |
| 44 // disk if we get bad data. | 44 // disk if we get bad data. |
| 45 // Default is 10 MB | 45 // Default is 10 MB |
| 46 size_t max_available_list_cached_size = 10 * 1024 * 1024; | 46 size_t max_available_list_cached_size = 10 * 1024 * 1024; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // Create and return a Ppdcache that uses cache_dir to store state. | 49 // Create and return a Ppdcache that uses cache_dir to store state. If |
| 50 // cache_base_dir does not exist, it will be lazily created the first time the |
| 51 // cache needs to store state. |
| 50 static std::unique_ptr<PpdCache> Create(const base::FilePath& cache_base_dir, | 52 static std::unique_ptr<PpdCache> Create(const base::FilePath& cache_base_dir, |
| 51 const Options& options = Options()); | 53 const Options& options = Options()); |
| 52 virtual ~PpdCache() {} | 54 virtual ~PpdCache() {} |
| 53 | 55 |
| 54 // Find a PPD that was previously cached with the given reference. Note that | 56 // Find a PPD that was previously cached with the given reference. Note that |
| 55 // all fields of the reference must be the same, otherwise we'll miss in the | 57 // all fields of the reference must be the same, otherwise we'll miss in the |
| 56 // cache and re-run resolution for the PPD. | 58 // cache and re-run resolution for the PPD. |
| 57 // | 59 // |
| 58 // If a FilePath is returned, it is guaranteed to be non-empty and | 60 // If a FilePath is returned, it is guaranteed to be non-empty and |
| 59 // remain valid until the next Store() call. | 61 // remain valid until the next Store() call. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 83 // Store |available_printers|, replacing any existing entry. | 85 // Store |available_printers|, replacing any existing entry. |
| 84 virtual void StoreAvailablePrinters( | 86 virtual void StoreAvailablePrinters( |
| 85 std::unique_ptr<PpdProvider::AvailablePrintersMap> | 87 std::unique_ptr<PpdProvider::AvailablePrintersMap> |
| 86 available_printers) = 0; | 88 available_printers) = 0; |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 } // namespace printing | 91 } // namespace printing |
| 90 } // namespace chromeos | 92 } // namespace chromeos |
| 91 | 93 |
| 92 #endif // CHROMEOS_PRINTING_PPD_CACHE_H_ | 94 #endif // CHROMEOS_PRINTING_PPD_CACHE_H_ |
| OLD | NEW |