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 |