| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/printing/cups_print_job_notification_manager.h
" | 5 #include "chrome/browser/chromeos/printing/cups_print_job_notification_manager.h
" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/chromeos/printing/cups_print_job.h" | 8 #include "chrome/browser/chromeos/printing/cups_print_job.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 void CupsPrintJobNotificationManager::OnPrintJobCreated(CupsPrintJob* job) { | 26 void CupsPrintJobNotificationManager::OnPrintJobCreated(CupsPrintJob* job) { |
| 27 if (base::ContainsKey(notification_map_, job)) | 27 if (base::ContainsKey(notification_map_, job)) |
| 28 return; | 28 return; |
| 29 notification_map_[job] = | 29 notification_map_[job] = |
| 30 base::MakeUnique<CupsPrintJobNotification>(job, profile_); | 30 base::MakeUnique<CupsPrintJobNotification>(job, profile_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void CupsPrintJobNotificationManager::OnPrintJobStarted(CupsPrintJob* job) { | 33 void CupsPrintJobNotificationManager::OnPrintJobStarted(CupsPrintJob* job) { |
| 34 UpdateNotification(job); |
| 35 } |
| 36 |
| 37 void CupsPrintJobNotificationManager::OnPrintJobUpdated(CupsPrintJob* job) { |
| 38 UpdateNotification(job); |
| 39 } |
| 40 |
| 41 void CupsPrintJobNotificationManager::OnPrintJobSuspended(CupsPrintJob* job) { |
| 42 UpdateNotification(job); |
| 43 } |
| 44 |
| 45 void CupsPrintJobNotificationManager::OnPrintJobResumed(CupsPrintJob* job) { |
| 46 UpdateNotification(job); |
| 47 } |
| 48 |
| 49 void CupsPrintJobNotificationManager::OnPrintJobDone(CupsPrintJob* job) { |
| 50 UpdateNotification(job); |
| 51 } |
| 52 |
| 53 void CupsPrintJobNotificationManager::OnPrintJobError(CupsPrintJob* job) { |
| 54 UpdateNotification(job); |
| 55 } |
| 56 |
| 57 void CupsPrintJobNotificationManager::OnPrintJobCancelled(CupsPrintJob* job) { |
| 58 UpdateNotification(job); |
| 59 } |
| 60 |
| 61 void CupsPrintJobNotificationManager::UpdateNotification(CupsPrintJob* job) { |
| 34 DCHECK(base::ContainsKey(notification_map_, job)); | 62 DCHECK(base::ContainsKey(notification_map_, job)); |
| 35 notification_map_[job]->OnPrintJobStatusUpdated(); | 63 notification_map_[job]->OnPrintJobStatusUpdated(); |
| 36 } | 64 } |
| 37 | |
| 38 void CupsPrintJobNotificationManager::OnPrintJobUpdated(CupsPrintJob* job) { | |
| 39 DCHECK(base::ContainsKey(notification_map_, job)); | |
| 40 notification_map_[job]->OnPrintJobStatusUpdated(); | |
| 41 } | |
| 42 | |
| 43 void CupsPrintJobNotificationManager::OnPrintJobSuspended(CupsPrintJob* job) { | |
| 44 DCHECK(base::ContainsKey(notification_map_, job)); | |
| 45 notification_map_[job]->OnPrintJobStatusUpdated(); | |
| 46 } | |
| 47 | |
| 48 void CupsPrintJobNotificationManager::OnPrintJobResumed(CupsPrintJob* job) { | |
| 49 DCHECK(base::ContainsKey(notification_map_, job)); | |
| 50 notification_map_[job]->OnPrintJobStatusUpdated(); | |
| 51 } | |
| 52 | |
| 53 void CupsPrintJobNotificationManager::OnPrintJobDone(CupsPrintJob* job) { | |
| 54 DCHECK(base::ContainsKey(notification_map_, job)); | |
| 55 notification_map_[job]->OnPrintJobStatusUpdated(); | |
| 56 } | |
| 57 | |
| 58 void CupsPrintJobNotificationManager::OnPrintJobError(CupsPrintJob* job) { | |
| 59 DCHECK(base::ContainsKey(notification_map_, job)); | |
| 60 notification_map_[job]->OnPrintJobStatusUpdated(); | |
| 61 } | |
| 62 | 65 |
| 63 } // namespace chromeos | 66 } // namespace chromeos |
| OLD | NEW |