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

Unified Diff: chrome/browser/chromeos/printing/cups_print_job_notification_manager.cc

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_notification_manager.cc
diff --git a/chrome/browser/chromeos/printing/cups_print_job_notification_manager.cc b/chrome/browser/chromeos/printing/cups_print_job_notification_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..781d4b1a65b7e548c3902315e333a2c73bd10a2f
--- /dev/null
+++ b/chrome/browser/chromeos/printing/cups_print_job_notification_manager.cc
@@ -0,0 +1,55 @@
+// 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.
+
+#include "chrome/browser/chromeos/printing/cups_print_job_notification_manager.h"
+
+#include "chrome/browser/chromeos/printing/cups_print_job.h"
+#include "chrome/browser/profiles/profile.h"
+
+namespace chromeos {
+
+CUPSPrintJobNotificationManager::CUPSPrintJobNotificationManager(
+ Profile* profile)
+ : profile_(profile) {}
+
+CUPSPrintJobNotificationManager::~CUPSPrintJobNotificationManager() {}
+
+void CUPSPrintJobNotificationManager::OnPrintJobCreated(CUPSPrintJob* job) {
+ if (notification_map_.find(job) != notification_map_.end())
+ return;
+ notification_map_[job] =
+ base::MakeUnique<CUPSPrintJobNotification>(job, profile_);
+}
+
+void CUPSPrintJobNotificationManager::OnPrintJobStarted(CUPSPrintJob* job) {
+ DCHECK(notification_map_.find(job) != notification_map_.end());
+ notification_map_[job]->OnPrintJobStatusUpdated();
+}
+
+void CUPSPrintJobNotificationManager::OnPrintJobUpdated(CUPSPrintJob* job) {
+ DCHECK(notification_map_.find(job) != notification_map_.end());
+ notification_map_[job]->OnPrintJobStatusUpdated();
+}
+
+void CUPSPrintJobNotificationManager::OnPrintJobSuspended(CUPSPrintJob* job) {
+ DCHECK(notification_map_.find(job) != notification_map_.end());
+ notification_map_[job]->OnPrintJobStatusUpdated();
+}
+
+void CUPSPrintJobNotificationManager::OnPrintJobResumed(CUPSPrintJob* job) {
+ DCHECK(notification_map_.find(job) != notification_map_.end());
+ notification_map_[job]->OnPrintJobStatusUpdated();
+}
+
+void CUPSPrintJobNotificationManager::OnPrintJobDone(CUPSPrintJob* job) {
+ DCHECK(notification_map_.find(job) != notification_map_.end());
+ notification_map_[job]->OnPrintJobStatusUpdated();
+}
+
+void CUPSPrintJobNotificationManager::OnPrintJobError(CUPSPrintJob* job) {
+ DCHECK(notification_map_.find(job) != notification_map_.end());
+ notification_map_[job]->OnPrintJobStatusUpdated();
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698