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

Unified Diff: chrome/browser/chromeos/printing/cups_print_job.h

Issue 2435303003: [CUPS] Implement the Print Job notification. (Closed)
Patch Set: Address stevenjb@'s comments. Rebase. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/printing/cups_print_job.h
diff --git a/chrome/browser/chromeos/printing/cups_print_job.h b/chrome/browser/chromeos/printing/cups_print_job.h
new file mode 100644
index 0000000000000000000000000000000000000000..f7fc9a949d05250266b801d81ec5004a597d774b
--- /dev/null
+++ b/chrome/browser/chromeos/printing/cups_print_job.h
@@ -0,0 +1,78 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_H_
+#define CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "chromeos/printing/printer_configuration.h"
+
+namespace chromeos {
+
+class CupsPrintJob {
+ public:
+ enum class State {
+ STATE_NONE,
+ STATE_WAITING,
+ STATE_STARTED,
+ STATE_PAGE_DONE,
+ STATE_CANCELLED,
+ STATE_SUSPENDED,
+ STATE_RESUMED,
+ STATE_DOCUMENT_DONE,
+ STATE_ERROR
+ };
+
+ enum class ErrorCode {
+ NO_ERROR,
+ PAPER_JAM,
+ OUT_OUT_INK,
skau 2016/10/27 01:43:00 OUT_OF_INK,
xdai1 2016/10/28 23:59:53 Done.
+ PRINTER_UNREACHABLE,
+ UNKNOWN_ERROR,
+ };
+
+ CupsPrintJob(const Printer& printer,
+ int job_id,
+ const std::string& document_title,
+ int total_page_number);
+ ~CupsPrintJob();
+
+ // Returns a unique id for the print job.
+ std::string GetUniqueId() const;
+
+ // Getters.
+ const Printer& printer() const { return printer_; }
+ int job_id() const { return job_id_; }
+ const std::string& document_title() const { return document_title_; }
+ int total_page_number() const { return total_page_number_; }
+ int printed_page_number() const { return printed_page_number_; }
+ State state() const { return state_; }
+ ErrorCode error_code() const { return error_code_; }
+
+ // Setters.
+ void set_printed_page_number(int page_number) {
+ printed_page_number_ = page_number;
+ }
+ void set_state(State state) { state_ = state; }
+ void set_error_code(ErrorCode error_code) { error_code_ = error_code; }
+
+ private:
+ Printer printer_;
+ int job_id_;
+
+ std::string document_title_;
+ int total_page_number_ = 0;
+ int printed_page_number_ = 0;
+
+ State state_ = State::STATE_NONE;
+ ErrorCode error_code_ = ErrorCode::NO_ERROR;
+
+ DISALLOW_COPY_AND_ASSIGN(CupsPrintJob);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_H_

Powered by Google App Engine
This is Rietveld 408576698