Chromium Code Reviews| 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 CupsPrintJobManager* print_job_manager) | |
| 15 : print_job_manager_(print_job_manager), profile_(profile) { | |
| 16 if (print_job_manager_) | |
| 17 print_job_manager_->AddObserver(this); | |
| 18 } | |
| 19 | |
| 20 CupsPrintJobNotificationManager::~CupsPrintJobNotificationManager() { | |
| 21 if (print_job_manager_) | |
| 22 print_job_manager_->RemoveObserver(this); | |
| 23 } | |
| 24 | |
| 25 void CupsPrintJobNotificationManager::OnPrintJobCreated(CupsPrintJob* job) { | |
| 26 if (notification_map_.find(job) != notification_map_.end()) | |
|
skau
2016/10/27 01:43:01
you can use base::ContainsKey() for this. It's a
xdai1
2016/10/28 23:59:54
Done.
| |
| 27 return; | |
| 28 notification_map_[job] = | |
| 29 base::MakeUnique<CupsPrintJobNotification>(job, profile_); | |
| 30 } | |
| 31 | |
| 32 void CupsPrintJobNotificationManager::OnPrintJobStarted(CupsPrintJob* job) { | |
| 33 DCHECK(notification_map_.find(job) != notification_map_.end()); | |
| 34 notification_map_[job]->OnPrintJobStatusUpdated(); | |
|
skau
2016/10/27 01:43:01
If we end up extracting all the information from t
xdai1
2016/10/28 23:59:54
I think it's nicer to have different changes other
skau
2016/10/31 15:39:05
Okay. I was wondering if OnPrintJobStatusUpdated(
| |
| 35 } | |
| 36 | |
| 37 void CupsPrintJobNotificationManager::OnPrintJobUpdated(CupsPrintJob* job) { | |
| 38 DCHECK(notification_map_.find(job) != notification_map_.end()); | |
| 39 notification_map_[job]->OnPrintJobStatusUpdated(); | |
| 40 } | |
| 41 | |
| 42 void CupsPrintJobNotificationManager::OnPrintJobSuspended(CupsPrintJob* job) { | |
| 43 DCHECK(notification_map_.find(job) != notification_map_.end()); | |
| 44 notification_map_[job]->OnPrintJobStatusUpdated(); | |
| 45 } | |
| 46 | |
| 47 void CupsPrintJobNotificationManager::OnPrintJobResumed(CupsPrintJob* job) { | |
| 48 DCHECK(notification_map_.find(job) != notification_map_.end()); | |
| 49 notification_map_[job]->OnPrintJobStatusUpdated(); | |
| 50 } | |
| 51 | |
| 52 void CupsPrintJobNotificationManager::OnPrintJobDone(CupsPrintJob* job) { | |
| 53 DCHECK(notification_map_.find(job) != notification_map_.end()); | |
| 54 notification_map_[job]->OnPrintJobStatusUpdated(); | |
| 55 } | |
| 56 | |
| 57 void CupsPrintJobNotificationManager::OnPrintJobError(CupsPrintJob* job) { | |
| 58 DCHECK(notification_map_.find(job) != notification_map_.end()); | |
| 59 notification_map_[job]->OnPrintJobStatusUpdated(); | |
| 60 } | |
| 61 | |
| 62 } // namespace chromeos | |
| OLD | NEW |