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_PRINTER_CONFIGURATION_H_ | 5 #ifndef CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ |
6 #define CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ | 6 #define CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 // The location where the printer is stored. | 40 // The location where the printer is stored. |
41 enum Source { | 41 enum Source { |
42 SRC_USER_PREFS, | 42 SRC_USER_PREFS, |
43 SRC_POLICY, | 43 SRC_POLICY, |
44 }; | 44 }; |
45 | 45 |
46 // Constructs a printer object that is completely empty. | 46 // Constructs a printer object that is completely empty. |
47 Printer(); | 47 Printer(); |
48 | 48 |
49 // Constructs a printer object with an id. | 49 // Constructs a printer object with an id. |
50 explicit Printer(const std::string& id); | 50 explicit Printer(const std::string& id, int64_t last_updated = 0); |
51 | 51 |
52 // Copy constructor and assignment. | 52 // Copy constructor and assignment. |
53 Printer(const Printer& printer); | 53 Printer(const Printer& printer); |
54 Printer& operator=(const Printer& printer); | 54 Printer& operator=(const Printer& printer); |
55 | 55 |
56 ~Printer(); | 56 ~Printer(); |
57 | 57 |
58 const std::string& id() const { return id_; } | 58 const std::string& id() const { return id_; } |
59 void set_id(const std::string& id) { id_ = id; } | 59 void set_id(const std::string& id) { id_ = id; } |
60 | 60 |
(...skipping 25 matching lines...) Expand all Loading... |
86 void set_uuid(const std::string& uuid) { uuid_ = uuid; } | 86 void set_uuid(const std::string& uuid) { uuid_ = uuid; } |
87 | 87 |
88 // Returns true if the printer should be automatically configured using | 88 // Returns true if the printer should be automatically configured using |
89 // IPP Everywhere. Computed using information from |ppd_reference_| and | 89 // IPP Everywhere. Computed using information from |ppd_reference_| and |
90 // |uri_|. | 90 // |uri_|. |
91 bool IsIppEverywhere() const; | 91 bool IsIppEverywhere() const; |
92 | 92 |
93 Source source() const { return source_; } | 93 Source source() const { return source_; } |
94 void set_source(const Source source) { source_ = source; } | 94 void set_source(const Source source) { source_ = source; } |
95 | 95 |
| 96 // Returns the timestamp for the most recent update. Returns 0 if the |
| 97 // printer was not created with a valid timestamp. |
| 98 int64_t last_updated() const { return last_updated_; } |
| 99 |
96 private: | 100 private: |
97 // Globally unique identifier. Empty indicates a new printer. | 101 // Globally unique identifier. Empty indicates a new printer. |
98 std::string id_; | 102 std::string id_; |
99 | 103 |
100 // User defined string for printer identification. | 104 // User defined string for printer identification. |
101 std::string display_name_; | 105 std::string display_name_; |
102 | 106 |
103 // User defined string for additional printer information. | 107 // User defined string for additional printer information. |
104 std::string description_; | 108 std::string description_; |
105 | 109 |
106 // The manufacturer of the printer, e.g. HP | 110 // The manufacturer of the printer, e.g. HP |
107 std::string manufacturer_; | 111 std::string manufacturer_; |
108 | 112 |
109 // The model of the printer, e.g. OfficeJet 415 | 113 // The model of the printer, e.g. OfficeJet 415 |
110 std::string model_; | 114 std::string model_; |
111 | 115 |
112 // The full path for the printer. Suitable for configuration in CUPS. | 116 // The full path for the printer. Suitable for configuration in CUPS. |
113 // Contains protocol, hostname, port, and queue. | 117 // Contains protocol, hostname, port, and queue. |
114 std::string uri_; | 118 std::string uri_; |
115 | 119 |
116 // How to find the associated postscript printer description. | 120 // How to find the associated postscript printer description. |
117 PpdReference ppd_reference_; | 121 PpdReference ppd_reference_; |
118 | 122 |
119 // The UUID from an autoconf protocol for deduplication. Could be empty. | 123 // The UUID from an autoconf protocol for deduplication. Could be empty. |
120 std::string uuid_; | 124 std::string uuid_; |
121 | 125 |
122 // The datastore which holds this printer. | 126 // The datastore which holds this printer. |
123 Source source_; | 127 Source source_; |
| 128 |
| 129 // Timestamp of most recent change. |
| 130 int64_t last_updated_; |
124 }; | 131 }; |
125 | 132 |
126 } // namespace chromeos | 133 } // namespace chromeos |
127 | 134 |
128 #endif // CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ | 135 #endif // CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ |
OLD | NEW |