OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/printing/cups_print_job_notification_manager.h
" |
| 6 |
| 7 #include "chrome/browser/chromeos/printing/cups_print_job.h" |
| 8 #include "chrome/browser/profiles/profile.h" |
| 9 |
| 10 namespace chromeos { |
| 11 |
| 12 CUPSPrintJobNotificationManager::CUPSPrintJobNotificationManager( |
| 13 Profile* profile) |
| 14 : profile_(profile) {} |
| 15 |
| 16 CUPSPrintJobNotificationManager::~CUPSPrintJobNotificationManager() {} |
| 17 |
| 18 void CUPSPrintJobNotificationManager::OnPrintJobCreated(CUPSPrintJob* job) { |
| 19 if (notification_map_.find(job) != notification_map_.end()) |
| 20 return; |
| 21 notification_map_[job] = |
| 22 base::MakeUnique<CUPSPrintJobNotification>(job, profile_); |
| 23 } |
| 24 |
| 25 void CUPSPrintJobNotificationManager::OnPrintJobStarted(CUPSPrintJob* job) { |
| 26 DCHECK(notification_map_.find(job) != notification_map_.end()); |
| 27 notification_map_[job]->OnPrintJobStatusUpdated(); |
| 28 } |
| 29 |
| 30 void CUPSPrintJobNotificationManager::OnPrintJobUpdated(CUPSPrintJob* job) { |
| 31 DCHECK(notification_map_.find(job) != notification_map_.end()); |
| 32 notification_map_[job]->OnPrintJobStatusUpdated(); |
| 33 } |
| 34 |
| 35 void CUPSPrintJobNotificationManager::OnPrintJobSuspended(CUPSPrintJob* job) { |
| 36 DCHECK(notification_map_.find(job) != notification_map_.end()); |
| 37 notification_map_[job]->OnPrintJobStatusUpdated(); |
| 38 } |
| 39 |
| 40 void CUPSPrintJobNotificationManager::OnPrintJobResumed(CUPSPrintJob* job) { |
| 41 DCHECK(notification_map_.find(job) != notification_map_.end()); |
| 42 notification_map_[job]->OnPrintJobStatusUpdated(); |
| 43 } |
| 44 |
| 45 void CUPSPrintJobNotificationManager::OnPrintJobDone(CUPSPrintJob* job) { |
| 46 DCHECK(notification_map_.find(job) != notification_map_.end()); |
| 47 notification_map_[job]->OnPrintJobStatusUpdated(); |
| 48 } |
| 49 |
| 50 void CUPSPrintJobNotificationManager::OnPrintJobError(CUPSPrintJob* job) { |
| 51 DCHECK(notification_map_.find(job) != notification_map_.end()); |
| 52 notification_map_[job]->OnPrintJobStatusUpdated(); |
| 53 } |
| 54 |
| 55 } // namespace chromeos |
OLD | NEW |