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 { | |
| 16 public: | |
| 17 enum class State { | |
| 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 class ErrorCode { | |
| 30 NO_ERROR, | |
| 31 PAPER_JAM, | |
| 32 OUT_OUT_INK, | |
|
skau
2016/10/27 01:43:00
OUT_OF_INK,
xdai1
2016/10/28 23:59:53
Done.
| |
| 33 PRINTER_UNREACHABLE, | |
| 34 UNKNOWN_ERROR, | |
| 35 }; | |
| 36 | |
| 37 CupsPrintJob(const Printer& printer, | |
| 38 int job_id, | |
| 39 const std::string& document_title, | |
| 40 int total_page_number); | |
| 41 ~CupsPrintJob(); | |
| 42 | |
| 43 // Returns a unique id for the print job. | |
| 44 std::string GetUniqueId() const; | |
| 45 | |
| 46 // Getters. | |
| 47 const Printer& printer() const { return printer_; } | |
| 48 int job_id() const { return job_id_; } | |
| 49 const std::string& document_title() const { return document_title_; } | |
| 50 int total_page_number() const { return total_page_number_; } | |
| 51 int printed_page_number() const { return printed_page_number_; } | |
| 52 State state() const { return state_; } | |
| 53 ErrorCode error_code() const { return error_code_; } | |
| 54 | |
| 55 // Setters. | |
| 56 void set_printed_page_number(int page_number) { | |
| 57 printed_page_number_ = page_number; | |
| 58 } | |
| 59 void set_state(State state) { state_ = state; } | |
| 60 void set_error_code(ErrorCode error_code) { error_code_ = error_code; } | |
| 61 | |
| 62 private: | |
| 63 Printer printer_; | |
| 64 int job_id_; | |
| 65 | |
| 66 std::string document_title_; | |
| 67 int total_page_number_ = 0; | |
| 68 int printed_page_number_ = 0; | |
| 69 | |
| 70 State state_ = State::STATE_NONE; | |
| 71 ErrorCode error_code_ = ErrorCode::NO_ERROR; | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(CupsPrintJob); | |
| 74 }; | |
| 75 | |
| 76 } // namespace chromeos | |
| 77 | |
| 78 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_H_ | |
| OLD | NEW |