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

Side by Side Diff: chrome/browser/chromeos/printing/fake_cups_print_job_manager.cc

Issue 2748253005: Cleanup jobs which have failed. (Closed)
Patch Set: fix fake Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/printing/fake_cups_print_job_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/fake_cups_print_job_manager.h" 5 #include "chrome/browser/chromeos/printing/fake_cups_print_job_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 30 matching lines...) Expand all
41 // Show the waiting-for-printing notification immediately. 41 // Show the waiting-for-printing notification immediately.
42 base::SequencedTaskRunnerHandle::Get()->PostNonNestableDelayedTask( 42 base::SequencedTaskRunnerHandle::Get()->PostNonNestableDelayedTask(
43 FROM_HERE, 43 FROM_HERE,
44 base::Bind(&FakeCupsPrintJobManager::ChangePrintJobState, 44 base::Bind(&FakeCupsPrintJobManager::ChangePrintJobState,
45 weak_ptr_factory_.GetWeakPtr(), print_jobs_.back().get()), 45 weak_ptr_factory_.GetWeakPtr(), print_jobs_.back().get()),
46 base::TimeDelta()); 46 base::TimeDelta());
47 47
48 return true; 48 return true;
49 } 49 }
50 50
51 bool FakeCupsPrintJobManager::CancelPrintJob(CupsPrintJob* job) { 51 void FakeCupsPrintJobManager::CancelPrintJob(CupsPrintJob* job) {
52 job->set_state(CupsPrintJob::State::STATE_CANCELLED); 52 job->set_state(CupsPrintJob::State::STATE_CANCELLED);
53 NotifyJobCanceled(job); 53 NotifyJobCanceled(job);
54 54
55 // Note: |job| is deleted here. 55 // Note: |job| is deleted here.
56 for (auto iter = print_jobs_.begin(); iter != print_jobs_.end(); ++iter) { 56 for (auto iter = print_jobs_.begin(); iter != print_jobs_.end(); ++iter) {
57 if (iter->get() == job) { 57 if (iter->get() == job) {
58 print_jobs_.erase(iter); 58 print_jobs_.erase(iter);
59 break; 59 break;
60 } 60 }
61 } 61 }
62
63 return true;
64 } 62 }
65 63
66 bool FakeCupsPrintJobManager::SuspendPrintJob(CupsPrintJob* job) { 64 bool FakeCupsPrintJobManager::SuspendPrintJob(CupsPrintJob* job) {
67 job->set_state(CupsPrintJob::State::STATE_SUSPENDED); 65 job->set_state(CupsPrintJob::State::STATE_SUSPENDED);
68 NotifyJobSuspended(job); 66 NotifyJobSuspended(job);
69 return true; 67 return true;
70 } 68 }
71 69
72 bool FakeCupsPrintJobManager::ResumePrintJob(CupsPrintJob* job) { 70 bool FakeCupsPrintJobManager::ResumePrintJob(CupsPrintJob* job) {
73 job->set_state(CupsPrintJob::State::STATE_RESUMED); 71 job->set_state(CupsPrintJob::State::STATE_RESUMED);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 weak_ptr_factory_.GetWeakPtr(), job), 137 weak_ptr_factory_.GetWeakPtr(), job),
140 base::TimeDelta::FromMilliseconds(3000)); 138 base::TimeDelta::FromMilliseconds(3000));
141 } 139 }
142 140
143 // static 141 // static
144 CupsPrintJobManager* CupsPrintJobManager::CreateInstance(Profile* profile) { 142 CupsPrintJobManager* CupsPrintJobManager::CreateInstance(Profile* profile) {
145 return new FakeCupsPrintJobManager(profile); 143 return new FakeCupsPrintJobManager(profile);
146 } 144 }
147 145
148 } // namespace chromeos 146 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/printing/fake_cups_print_job_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698