Chromium Code Reviews| 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 CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "chromeos/printing/printer_configuration.h" | |
| 12 | |
| 13 namespace chromeos { | |
| 14 | |
| 15 class CUPSPrintJob { | |
|
stevenjb
2016/10/26 19:59:57
Even though "CUPS" is generally all caps, we tend
xdai1
2016/10/26 22:55:18
I see. Thanks. Done.
| |
| 16 public: | |
| 17 enum State { | |
|
stevenjb
2016/10/26 19:59:58
I believe there is a preference now to use 'enum c
xdai1
2016/10/26 22:55:18
Done.
| |
| 18 STATE_NONE, | |
| 19 STATE_WAITING, | |
| 20 STATE_STARTED, | |
| 21 STATE_PAGE_DONE, | |
| 22 STATE_CANCELLED, | |
| 23 STATE_SUSPENDED, | |
| 24 STATE_RESUMED, | |
| 25 STATE_DOCUMENT_DONE, | |
| 26 STATE_ERROR | |
| 27 }; | |
| 28 | |
| 29 enum ErrorCode { | |
|
stevenjb
2016/10/26 19:59:58
ditto
xdai1
2016/10/26 22:55:18
Done.
| |
| 30 NO_ERROR, | |
| 31 PAPER_JAM, | |
| 32 OUT_OUT_INK, | |
| 33 PRINTER_UNREACHABLE, | |
| 34 UNKNOWN_ERROR, | |
| 35 }; | |
| 36 | |
| 37 CUPSPrintJob(const std::string& printer_id, | |
| 38 int job_id, | |
| 39 const std::string& document_title, | |
| 40 int total_page_number); | |
| 41 CUPSPrintJob(const Printer& printer, | |
| 42 int job_id, | |
| 43 const std::string& document_title, | |
| 44 int total_page_number); | |
| 45 ~CUPSPrintJob(); | |
| 46 | |
| 47 // Returns a unique id for the print job. | |
| 48 std::string GetId() const; | |
|
stevenjb
2016/10/26 19:59:58
nit: GetUniqueId to make it clear that this is not
xdai1
2016/10/26 22:55:18
Done.
| |
| 49 Printer* GetPrinter(); | |
|
stevenjb
2016/10/26 19:59:58
Do we really need this? Passing a non-const pointe
xdai1
2016/10/26 22:55:18
You're right. It's not necessary. Removed it.
| |
| 50 | |
| 51 // Getters. | |
| 52 const Printer& printer() const { return printer_; } | |
| 53 int job_id() const { return job_id_; } | |
| 54 const std::string& document_title() const { return document_title_; } | |
| 55 int total_page_number() const { return total_page_number_; } | |
| 56 int printed_page_number() const { return printed_page_number_; } | |
| 57 State state() const { return state_; } | |
| 58 ErrorCode error_code() const { return error_code_; } | |
| 59 | |
| 60 // Setters. | |
| 61 void set_printed_page_number(int page_number) { | |
| 62 printed_page_number_ = page_number; | |
| 63 } | |
| 64 void set_state(State state) { state_ = state; } | |
| 65 void set_error_code(ErrorCode error_code) { error_code_ = error_code; } | |
| 66 | |
| 67 private: | |
| 68 Printer printer_; | |
| 69 int job_id_; | |
| 70 | |
| 71 std::string document_title_; | |
| 72 int total_page_number_ = 0; | |
| 73 int printed_page_number_ = 0; | |
| 74 | |
| 75 State state_ = STATE_NONE; | |
| 76 ErrorCode error_code_ = NO_ERROR; | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(CUPSPrintJob); | |
| 79 }; | |
| 80 | |
| 81 } // namespace chromeos | |
| 82 | |
| 83 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_H_ | |
| OLD | NEW |