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

Side by Side Diff: chrome/browser/printing/print_job_manager.cc

Issue 10412028: Convert printing code to use base::TimeDelta in PostDelayedTask interfaces. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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/printing/print_job.cc ('k') | chrome/browser/printing/print_job_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/printing/print_job_manager.h" 5 #include "chrome/browser/printing/print_job_manager.h"
6 6
7 #include "chrome/browser/prefs/pref_service.h" 7 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/printing/print_job.h" 8 #include "chrome/browser/printing/print_job.h"
9 #include "chrome/browser/printing/printer_query.h" 9 #include "chrome/browser/printing/printer_query.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if (current_jobs_.empty()) 43 if (current_jobs_.empty())
44 return; 44 return;
45 { 45 {
46 // Copy the array since it can be modified in transit. 46 // Copy the array since it can be modified in transit.
47 PrintJobs current_jobs(current_jobs_); 47 PrintJobs current_jobs(current_jobs_);
48 // Wait for each job to finish. 48 // Wait for each job to finish.
49 for (size_t i = 0; i < current_jobs.size(); ++i) { 49 for (size_t i = 0; i < current_jobs.size(); ++i) {
50 PrintJob* job = current_jobs[i]; 50 PrintJob* job = current_jobs[i];
51 if (!job) 51 if (!job)
52 continue; 52 continue;
53 // Wait for 120 seconds for the print job to be spooled. 53 // Wait for two minutes for the print job to be spooled.
54 if (wait_for_finish) 54 if (wait_for_finish)
55 job->FlushJob(120000); 55 job->FlushJob(base::TimeDelta::FromMinutes(2));
56 job->Stop(); 56 job->Stop();
57 } 57 }
58 } 58 }
59 current_jobs_.clear(); 59 current_jobs_.clear();
60 } 60 }
61 61
62 void PrintJobManager::QueuePrinterQuery(PrinterQuery* job) { 62 void PrintJobManager::QueuePrinterQuery(PrinterQuery* job) {
63 base::AutoLock lock(lock_); 63 base::AutoLock lock(lock_);
64 DCHECK(job); 64 DCHECK(job);
65 queued_queries_.push_back(make_scoped_refptr(job)); 65 queued_queries_.push_back(make_scoped_refptr(job));
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 break; 156 break;
157 } 157 }
158 } 158 }
159 } 159 }
160 160
161 bool PrintJobManager::printing_enabled() const { 161 bool PrintJobManager::printing_enabled() const {
162 return *printing_enabled_; 162 return *printing_enabled_;
163 } 163 }
164 164
165 } // namespace printing 165 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job.cc ('k') | chrome/browser/printing/print_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698