 Chromium Code Reviews
 Chromium Code Reviews Issue 2343983004:
  Add PPDProvider barebones implementation and associated cache skeleton.  (Closed)
    
  
    Issue 2343983004:
  Add PPDProvider barebones implementation and associated cache skeleton.  (Closed) 
  | Index: chromeos/printing/printer_configuration.h | 
| diff --git a/chromeos/printing/printer_configuration.h b/chromeos/printing/printer_configuration.h | 
| index fc82c293798c94a84e7f71e5216374fdf54c69d9..1d5bfcc727ea4d1bc5555aa711df9c190513e307 100644 | 
| --- a/chromeos/printing/printer_configuration.h | 
| +++ b/chromeos/printing/printer_configuration.h | 
| @@ -15,21 +15,32 @@ namespace chromeos { | 
| class CHROMEOS_EXPORT Printer { | 
| public: | 
| - // Represents a Postscript Printer Description with which the printer was | 
| - // setup. | 
| - struct PPDFile { | 
| - // Identifier from the quirks server. -1 otherwise. | 
| - int id = -1; | 
| - | 
| - std::string file_name; | 
| - | 
| - // If there is a file with a later version on the quirks server, that file | 
| - // should be used. The default value is 0. | 
| - int version_number = 0; | 
| - | 
| - // This will be true if the file was retrived from the quirks server. | 
| - // Otherwise, the file was saved to disk by the user. | 
| - bool from_quirks_server = false; | 
| + // Information needed to find the PPD file for this printer. | 
| 
Lei Zhang
2016/10/17 17:54:07
Why is this still here? Didn't these changes land
 
Carlson
2016/10/18 19:05:01
Done.
 | 
| + // | 
| + // If you add fields to this struct, you almost certainly will | 
| + // want to update PpdResolver and PpdCache::GetCachePath. | 
| + // | 
| + // At resolution time, we look for a cached PPD that used the same | 
| + // PpdReference before. | 
| + // | 
| + // If one is not found and user_supplied_ppd_url is set, we'll fail | 
| + // out with NOT FOUND | 
| + // | 
| + // Otherwise, we'll hit QuirksServer to see if we can resolve a Ppd | 
| + // using manufacturer/model | 
| + struct PpdReference { | 
| + // If non-empty, this is the url of a specific PPD the user has specified | 
| + // for use with this printer. | 
| + std::string user_supplied_ppd_url; | 
| + | 
| + // The *effective* manufacturer and model of this printer, in other words, | 
| + // the manufacturer and model of the printer for which we grab a PPD. This | 
| + // doesn’t have to (but can) be the actual manufacturer/model of the | 
| + // printer. We should always try to fill these fields in, even if we don’t | 
| + // think they’ll be needed, as they provide a fallback mechanism for | 
| + // finding a PPD. | 
| + std::string effective_manufacturer; | 
| + std::string effective_model; | 
| }; | 
| // Constructs a printer object that is completely empty. | 
| @@ -68,8 +79,8 @@ class CHROMEOS_EXPORT Printer { | 
| const std::string& uri() const { return uri_; } | 
| void set_uri(const std::string& uri) { uri_ = uri; } | 
| - const PPDFile& ppd() const { return ppd_; } | 
| - void SetPPD(std::unique_ptr<PPDFile> ppd); | 
| + const PpdReference& ppd_reference() const { return ppd_reference_; } | 
| + PpdReference* mutable_ppd_reference() { return &ppd_reference_; } | 
| const std::string& uuid() const { return uuid_; } | 
| void set_uuid(const std::string& uuid) { uuid_ = uuid; } | 
| @@ -94,8 +105,8 @@ class CHROMEOS_EXPORT Printer { | 
| // Contains protocol, hostname, port, and queue. | 
| std::string uri_; | 
| - // The associated postscript printer description. | 
| - PPDFile ppd_; | 
| + // How to find the associated postscript printer description. | 
| + PpdReference ppd_reference_; | 
| // The UUID from an autoconf protocol for deduplication. Could be empty. | 
| std::string uuid_; |