OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ |
| 6 #define CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "chromeos/chromeos_export.h" |
| 13 |
| 14 namespace chromeos { |
| 15 |
| 16 class CHROMEOS_EXPORT Printer { |
| 17 public: |
| 18 // Represents a Postscript Printer Description with which the printer was |
| 19 // setup. |
| 20 struct PPDFile { |
| 21 // Identifier from the quirks server. -1 otherwise. |
| 22 int id; |
| 23 |
| 24 std::string file_name; |
| 25 |
| 26 // If there is a file with a later version on the quirks server, that file |
| 27 // should be used. The default value is 0. |
| 28 int version_number; |
| 29 |
| 30 // This will be true if the file was retrived from the quirks server. |
| 31 // Otherwise, the file was saved to disk by the user. |
| 32 bool from_quirks_server; |
| 33 }; |
| 34 |
| 35 // Constructs a printer object that is completely empty. |
| 36 Printer(); |
| 37 |
| 38 // Constructs a printer object with an id. |
| 39 explicit Printer(const std::string& id); |
| 40 |
| 41 ~Printer(); |
| 42 |
| 43 const std::string& id() const { return id_; } |
| 44 void set_id(const std::string& id) { id_ = id; } |
| 45 |
| 46 const std::string& display_name() const { return display_name_; } |
| 47 void set_display_name(const std::string& display_name) { |
| 48 display_name_ = display_name; |
| 49 } |
| 50 |
| 51 const std::string& description() const { return description_; } |
| 52 void set_description(const std::string& description) { |
| 53 description_ = description; |
| 54 } |
| 55 |
| 56 const std::string& manufacturer() const { return manufacturer_; } |
| 57 void set_manufacturer(const std::string& manufacturer) { |
| 58 manufacturer_ = manufacturer; |
| 59 } |
| 60 |
| 61 const std::string& model() const { return model_; } |
| 62 void set_model(const std::string& model) { model_ = model; } |
| 63 |
| 64 const std::string& uri() const { return uri_; } |
| 65 void set_uri(const std::string& uri) { uri_ = uri; } |
| 66 |
| 67 const PPDFile& ppd() const { return ppd_; } |
| 68 void SetPPD(std::unique_ptr<PPDFile> ppd); |
| 69 |
| 70 const std::string& uuid() const { return uuid_; } |
| 71 void set_uuid(const std::string& uuid) { uuid_ = uuid; } |
| 72 |
| 73 private: |
| 74 // Globally unique identifier. Empty indicates a new printer. |
| 75 std::string id_; |
| 76 |
| 77 // User defined string for printer identification. |
| 78 std::string display_name_; |
| 79 |
| 80 // User defined string for additional printer information. |
| 81 std::string description_; |
| 82 |
| 83 // The manufacturer of the printer, e.g. HP |
| 84 std::string manufacturer_; |
| 85 |
| 86 // The model of the printer, e.g. OfficeJet 415 |
| 87 std::string model_; |
| 88 |
| 89 // The full path for the printer. Suitable for configuration in CUPS. |
| 90 // Contains protocol, hostname, port, and queue. |
| 91 std::string uri_; |
| 92 |
| 93 // The associated postscript printer description. |
| 94 PPDFile ppd_; |
| 95 |
| 96 // The UUID from an autoconf protocol for deduplication. Could be empty. |
| 97 std::string uuid_; |
| 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(Printer); |
| 100 }; |
| 101 |
| 102 } // namespace chromeos |
| 103 |
| 104 #endif // CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ |
OLD | NEW |