summaryrefslogtreecommitdiff
path: root/chromium/chromeos/components/print_management
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chromeos/components/print_management')
-rw-r--r--chromium/chromeos/components/print_management/BUILD.gn1
-rw-r--r--chromium/chromeos/components/print_management/mojom/printing_manager.mojom88
-rw-r--r--chromium/chromeos/components/print_management/resources/BUILD.gn25
3 files changed, 110 insertions, 4 deletions
diff --git a/chromium/chromeos/components/print_management/BUILD.gn b/chromium/chromeos/components/print_management/BUILD.gn
index bd7f136ca1b..509720315ea 100644
--- a/chromium/chromeos/components/print_management/BUILD.gn
+++ b/chromium/chromeos/components/print_management/BUILD.gn
@@ -14,6 +14,7 @@ static_library("print_management") {
deps = [
"//chromeos/components/print_management/mojom",
+ "//chromeos/components/web_applications",
"//chromeos/constants",
"//chromeos/resources:print_management_resources",
"//chromeos/strings/",
diff --git a/chromium/chromeos/components/print_management/mojom/printing_manager.mojom b/chromium/chromeos/components/print_management/mojom/printing_manager.mojom
index 6dc89ead47d..c76e7b4f8bd 100644
--- a/chromium/chromeos/components/print_management/mojom/printing_manager.mojom
+++ b/chromium/chromeos/components/print_management/mojom/printing_manager.mojom
@@ -15,6 +15,55 @@ enum PrintJobCompletionStatus {
kPrinted
};
+// Enumeration of all the possible printer error codes. The order of these enums
+// must match that of chrome/browser/chromeos/printing/printer_error_codes.h
+enum PrinterErrorCode {
+ kNoError,
+ kPaperJam,
+ kOutOfPaper,
+ kOutOfInk,
+ kDoorOpen,
+ kPrinterUnreachable,
+ kTrayMissing,
+ kOutputFull,
+ kStopped,
+ kFilterFailed,
+ kUnknownError,
+};
+
+// Contains information about a completed print job. Completed print jobs are
+// stored to the local database. Information of this struct includes the
+// completion status and error code associated with the print job. This struct
+// is null for active print jobs, i.e. jobs that are currently being printed and
+// are not stored in the local database.
+struct CompletedPrintJobInfo {
+ // Corresponds to the status of the print job after it has completed.
+ PrintJobCompletionStatus completion_status;
+
+ // Corresponds to the error code reported by the printer.
+ PrinterErrorCode printer_error_code;
+};
+
+// Enumeration of ongoing print job status.
+enum ActivePrintJobState {
+ // Print job is currently being printed.
+ kStarted,
+
+ // The print job's document is considered finished to the printer.
+ // This includes successful, failed, and cancelled print jobs.
+ kDocumentDone,
+};
+
+// Contains all relevant information in regards to an active print job i.e. one
+// that is current being printed.
+struct ActivePrintJobInfo {
+ // Number of current printed pages.
+ uint32 printed_pages;
+
+ // Current state of the print job.
+ ActivePrintJobState active_state;
+};
+
// Contains all the information in regards to a print job. Information is
// provided by the printer. Printer details, i.e. name and uri, can be edited
// via print settings.
@@ -25,10 +74,6 @@ struct PrintJobInfo {
// Title of the print job. Usually the name of the printed file.
mojo_base.mojom.String16 title;
- // Corresponds to the status of the print job after it the print job has
- // finished.
- PrintJobCompletionStatus completion_status;
-
// Time of when the print job was requested.
mojo_base.mojom.Time creation_time;
@@ -40,6 +85,24 @@ struct PrintJobInfo {
// The URI of the printer the print job was requested to.
url.mojom.Url printer_uri;
+
+ // Information of a completed print job. Null struct if the print job is
+ // currently being printed.
+ CompletedPrintJobInfo? completed_info;
+
+ // Contains information relevant to an active print job. Null struct if
+ // the print job is from the local database.
+ ActivePrintJobInfo? active_print_job_info;
+};
+
+// Observer interface that sends remote updates to the print management app UI
+// receiver.
+interface PrintJobsObserver {
+ // Notifies that the local print job database has been cleared.
+ OnAllPrintJobsDeleted();
+
+ // Notifies that an ongoing print job has been updated.
+ OnPrintJobUpdate(PrintJobInfo print_job);
};
// Provides APIs to retrieve print metadata information. This API is exposed
@@ -47,6 +110,13 @@ struct PrintJobInfo {
// implemented by a browser service. Interacts with PrintHistory API to retrieve
// print job metadatas.
interface PrintingMetadataProvider {
+ // Takes in a remote so that the implementer binds it and send notifications
+ // to the receiver in the print management app. This is to set up automatic
+ // updates from the browser process to the renderer process.
+ // (print management app UI). This is guaranteed to not send remote updates
+ // to disconnected receivers.
+ ObservePrintJobs(pending_remote<PrintJobsObserver> observer) => ();
+
// Returns an array of PrintJobInfo. This is the main function to retrieve
// the print history of a device.
GetPrintJobs() => (array<PrintJobInfo> print_jobs);
@@ -55,4 +125,14 @@ interface PrintingMetadataProvider {
// print jobs was successful. Returns false if there was an error with
// retrieving the print jobs to delete in this device.
DeleteAllPrintJobs() => (bool success);
+
+ // Cancels an ongoing print job keyed by PrintJobInfo.id.
+ // This is a best effort attempt as there is no guarantee that we can cancel
+ // a print job. Returns true if cancelling the print job was attempted.
+ // Returns false if cancelling the print job was not attempted.
+ CancelPrintJob(string id) => (bool attempted_cancel);
+
+ // Returns true if the user is allowed to delete their own print job history
+ // (default value is true for non-managed users).
+ GetDeletePrintJobHistoryAllowedByPolicy() => (bool is_allowed_by_policy);
};
diff --git a/chromium/chromeos/components/print_management/resources/BUILD.gn b/chromium/chromeos/components/print_management/resources/BUILD.gn
index 7d0f5cc9ab5..8b28696840b 100644
--- a/chromium/chromeos/components/print_management/resources/BUILD.gn
+++ b/chromium/chromeos/components/print_management/resources/BUILD.gn
@@ -17,10 +17,19 @@ js_type_check("closure_compile_module") {
]
}
+js_library("icons") {
+ deps = [
+ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ ]
+}
+
js_library("print_job_entry") {
deps = [
+ ":icons",
"//chromeos/components/print_management/mojom:mojom_js_library_for_compile",
+ "//third_party/polymer/v3_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+ "//ui/webui/resources/js:i18n_behavior.m",
"//ui/webui/resources/js:load_time_data.m",
"//ui/webui/resources/js/cr/ui:focus_row_behavior.m",
]
@@ -33,7 +42,9 @@ js_library("print_management") {
":print_job_entry",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/cr_elements/cr_button:cr_button.m",
+ "//ui/webui/resources/cr_elements/policy:cr_policy_indicator.m",
"//ui/webui/resources/js:i18n_behavior.m",
+ "//ui/webui/resources/js:load_time_data.m",
]
}
@@ -54,6 +65,12 @@ js_library("mojo_interface_provider") {
]
}
+polymer_modulizer("icons") {
+ js_file = "icons.js"
+ html_file = "icons.html"
+ html_type = "v3-ready"
+}
+
polymer_modulizer("print_management") {
js_file = "print_management.js"
html_file = "print_management.html"
@@ -72,6 +89,12 @@ polymer_modulizer("print_management_shared_css") {
html_type = "v3-ready"
}
+polymer_modulizer("print_management_fonts_css") {
+ html_file = "print_management_fonts_css.html"
+ js_file = "print_management_fonts_css.js"
+ html_type = "v3-ready"
+}
+
polymer_modulizer("print_job_clear_history_dialog") {
html_file = "print_job_clear_history_dialog.html"
js_file = "print_job_clear_history_dialog.js"
@@ -86,8 +109,10 @@ polymer_modulizer("scanning_page") {
group("polymer3_elements") {
public_deps = [
+ ":icons_module",
":print_job_clear_history_dialog_module",
":print_job_entry_module",
+ ":print_management_fonts_css_module",
":print_management_module",
":print_management_shared_css_module",
":scanning_page_module",