| 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 // True if the printer should be auto-configured and a PPD is unnecessary. | 40 // True if the printer should be auto-configured and a PPD is unnecessary. |
| 41 bool autoconf = false; | 41 bool autoconf = false; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 // The location where the printer is stored. | 44 // The location where the printer is stored. |
| 45 enum Source { | 45 enum Source { |
| 46 SRC_USER_PREFS, | 46 SRC_USER_PREFS, |
| 47 SRC_POLICY, | 47 SRC_POLICY, |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // An enumeration of printer protocols. Do not change these values as they |
| 51 // are used in enums.xml. |
| 52 enum PrinterProtocol { |
| 53 kUnknown = 0, |
| 54 kUsb = 1, |
| 55 kIpp = 2, |
| 56 kIpps = 3, |
| 57 kHttp = 4, |
| 58 kHttps = 5, |
| 59 kSocket = 6, |
| 60 kLpd = 7, |
| 61 kProtocolMax |
| 62 }; |
| 63 |
| 50 // Constructs a printer object that is completely empty. | 64 // Constructs a printer object that is completely empty. |
| 51 Printer(); | 65 Printer(); |
| 52 | 66 |
| 53 // Constructs a printer object with an |id| and a |last_updated| timestamp. | 67 // Constructs a printer object with an |id| and a |last_updated| timestamp. |
| 54 explicit Printer(const std::string& id, const base::Time& last_updated = {}); | 68 explicit Printer(const std::string& id, const base::Time& last_updated = {}); |
| 55 | 69 |
| 56 // Copy constructor and assignment. | 70 // Copy constructor and assignment. |
| 57 Printer(const Printer& printer); | 71 Printer(const Printer& printer); |
| 58 Printer& operator=(const Printer& printer); | 72 Printer& operator=(const Printer& printer); |
| 59 | 73 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 87 PpdReference* mutable_ppd_reference() { return &ppd_reference_; } | 101 PpdReference* mutable_ppd_reference() { return &ppd_reference_; } |
| 88 | 102 |
| 89 const std::string& uuid() const { return uuid_; } | 103 const std::string& uuid() const { return uuid_; } |
| 90 void set_uuid(const std::string& uuid) { uuid_ = uuid; } | 104 void set_uuid(const std::string& uuid) { uuid_ = uuid; } |
| 91 | 105 |
| 92 // Returns true if the printer should be automatically configured using | 106 // Returns true if the printer should be automatically configured using |
| 93 // IPP Everywhere. Computed using information from |ppd_reference_| and | 107 // IPP Everywhere. Computed using information from |ppd_reference_| and |
| 94 // |uri_|. | 108 // |uri_|. |
| 95 bool IsIppEverywhere() const; | 109 bool IsIppEverywhere() const; |
| 96 | 110 |
| 111 // Returns the printer protocol the printer is configured with. |
| 112 Printer::PrinterProtocol GetProtocol() const; |
| 113 |
| 97 Source source() const { return source_; } | 114 Source source() const { return source_; } |
| 98 void set_source(const Source source) { source_ = source; } | 115 void set_source(const Source source) { source_ = source; } |
| 99 | 116 |
| 100 // Returns the timestamp for the most recent update. Returns 0 if the | 117 // Returns the timestamp for the most recent update. Returns 0 if the |
| 101 // printer was not created with a valid timestamp. | 118 // printer was not created with a valid timestamp. |
| 102 base::Time last_updated() const { return last_updated_; } | 119 base::Time last_updated() const { return last_updated_; } |
| 103 | 120 |
| 104 private: | 121 private: |
| 105 // Globally unique identifier. Empty indicates a new printer. | 122 // Globally unique identifier. Empty indicates a new printer. |
| 106 std::string id_; | 123 std::string id_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 130 // The datastore which holds this printer. | 147 // The datastore which holds this printer. |
| 131 Source source_; | 148 Source source_; |
| 132 | 149 |
| 133 // Timestamp of most recent change. | 150 // Timestamp of most recent change. |
| 134 base::Time last_updated_; | 151 base::Time last_updated_; |
| 135 }; | 152 }; |
| 136 | 153 |
| 137 } // namespace chromeos | 154 } // namespace chromeos |
| 138 | 155 |
| 139 #endif // CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ | 156 #endif // CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ |
| OLD | NEW |