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

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

Issue 2435303003: [CUPS] Implement the Print Job notification. (Closed)
Patch Set: Bug fix. 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..aad91cdc1a6ac567f3c3217a765eb7e5012f28ac
--- /dev/null
+++ b/chrome/browser/chromeos/printing/cups_print_job.h
@@ -0,0 +1,83 @@
+// 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 {
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.
+ public:
+ 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.
+ STATE_NONE,
+ STATE_WAITING,
+ STATE_STARTED,
+ STATE_PAGE_DONE,
+ STATE_CANCELLED,
+ STATE_SUSPENDED,
+ STATE_RESUMED,
+ STATE_DOCUMENT_DONE,
+ STATE_ERROR
+ };
+
+ enum ErrorCode {
stevenjb 2016/10/26 19:59:58 ditto
xdai1 2016/10/26 22:55:18 Done.
+ NO_ERROR,
+ PAPER_JAM,
+ OUT_OUT_INK,
+ PRINTER_UNREACHABLE,
+ UNKNOWN_ERROR,
+ };
+
+ CUPSPrintJob(const std::string& printer_id,
+ int job_id,
+ const std::string& document_title,
+ int total_page_number);
+ 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 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.
+ 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.
+
+ // 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_NONE;
+ ErrorCode error_code_ = 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