Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chromeos/printing/printer_configuration.h

Issue 2858353004: Track printer installations for each configuration. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/time/time.h"
12 #include "chromeos/chromeos_export.h" 13 #include "chromeos/chromeos_export.h"
13 14
14 namespace chromeos { 15 namespace chromeos {
15 16
16 class CHROMEOS_EXPORT Printer { 17 class CHROMEOS_EXPORT Printer {
17 public: 18 public:
18 // Information needed to find the PPD file for this printer. 19 // Information needed to find the PPD file for this printer.
19 // 20 //
20 // If you add fields to this struct, you almost certainly will 21 // If you add fields to this struct, you almost certainly will
21 // want to update PpdResolver and PpdCache::GetCachePath. 22 // want to update PpdResolver and PpdCache::GetCachePath.
(...skipping 17 matching lines...) Expand all
39 40
40 // The location where the printer is stored. 41 // The location where the printer is stored.
41 enum Source { 42 enum Source {
42 SRC_USER_PREFS, 43 SRC_USER_PREFS,
43 SRC_POLICY, 44 SRC_POLICY,
44 }; 45 };
45 46
46 // Constructs a printer object that is completely empty. 47 // Constructs a printer object that is completely empty.
47 Printer(); 48 Printer();
48 49
49 // Constructs a printer object with an id. 50 // Constructs a printer object with an |id| and a |last_updated| timestamp.
50 explicit Printer(const std::string& id); 51 explicit Printer(const std::string& id, const base::Time& last_updated = {});
51 52
52 // Copy constructor and assignment. 53 // Copy constructor and assignment.
53 Printer(const Printer& printer); 54 Printer(const Printer& printer);
54 Printer& operator=(const Printer& printer); 55 Printer& operator=(const Printer& printer);
55 56
56 ~Printer(); 57 ~Printer();
57 58
58 const std::string& id() const { return id_; } 59 const std::string& id() const { return id_; }
59 void set_id(const std::string& id) { id_ = id; } 60 void set_id(const std::string& id) { id_ = id; }
60 61
(...skipping 25 matching lines...) Expand all
86 void set_uuid(const std::string& uuid) { uuid_ = uuid; } 87 void set_uuid(const std::string& uuid) { uuid_ = uuid; }
87 88
88 // Returns true if the printer should be automatically configured using 89 // Returns true if the printer should be automatically configured using
89 // IPP Everywhere. Computed using information from |ppd_reference_| and 90 // IPP Everywhere. Computed using information from |ppd_reference_| and
90 // |uri_|. 91 // |uri_|.
91 bool IsIppEverywhere() const; 92 bool IsIppEverywhere() const;
92 93
93 Source source() const { return source_; } 94 Source source() const { return source_; }
94 void set_source(const Source source) { source_ = source; } 95 void set_source(const Source source) { source_ = source; }
95 96
97 // Returns the timestamp for the most recent update. Returns 0 if the
98 // printer was not created with a valid timestamp.
99 base::Time last_updated() const { return last_updated_; }
100
96 private: 101 private:
97 // Globally unique identifier. Empty indicates a new printer. 102 // Globally unique identifier. Empty indicates a new printer.
98 std::string id_; 103 std::string id_;
99 104
100 // User defined string for printer identification. 105 // User defined string for printer identification.
101 std::string display_name_; 106 std::string display_name_;
102 107
103 // User defined string for additional printer information. 108 // User defined string for additional printer information.
104 std::string description_; 109 std::string description_;
105 110
106 // The manufacturer of the printer, e.g. HP 111 // The manufacturer of the printer, e.g. HP
107 std::string manufacturer_; 112 std::string manufacturer_;
108 113
109 // The model of the printer, e.g. OfficeJet 415 114 // The model of the printer, e.g. OfficeJet 415
110 std::string model_; 115 std::string model_;
111 116
112 // The full path for the printer. Suitable for configuration in CUPS. 117 // The full path for the printer. Suitable for configuration in CUPS.
113 // Contains protocol, hostname, port, and queue. 118 // Contains protocol, hostname, port, and queue.
114 std::string uri_; 119 std::string uri_;
115 120
116 // How to find the associated postscript printer description. 121 // How to find the associated postscript printer description.
117 PpdReference ppd_reference_; 122 PpdReference ppd_reference_;
118 123
119 // The UUID from an autoconf protocol for deduplication. Could be empty. 124 // The UUID from an autoconf protocol for deduplication. Could be empty.
120 std::string uuid_; 125 std::string uuid_;
121 126
122 // The datastore which holds this printer. 127 // The datastore which holds this printer.
123 Source source_; 128 Source source_;
129
130 // Timestamp of most recent change.
131 base::Time last_updated_;
124 }; 132 };
125 133
126 } // namespace chromeos 134 } // namespace chromeos
127 135
128 #endif // CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_ 136 #endif // CHROMEOS_PRINTING_PRINTER_CONFIGURATION_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc ('k') | chromeos/printing/printer_configuration.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698