OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/printing/print_job.h" | 9 #include "chrome/browser/printing/print_job.h" |
10 #include "chrome/browser/printing/printer_query.h" | 10 #include "chrome/browser/printing/printer_query.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 this, | 40 this, |
41 NotificationType::PRINTED_DOCUMENT_UPDATED, | 41 NotificationType::PRINTED_DOCUMENT_UPDATED, |
42 NotificationService::AllSources()); | 42 NotificationService::AllSources()); |
43 } | 43 } |
44 | 44 |
45 void PrintJobManager::OnQuit() { | 45 void PrintJobManager::OnQuit() { |
46 // Common case, no print job pending. | 46 // Common case, no print job pending. |
47 if (current_jobs_.size() == 0) | 47 if (current_jobs_.size() == 0) |
48 return; | 48 return; |
49 { | 49 { |
50 // Don't take a chance and copy the array since it can be modified in transi
t. | 50 // Don't take a chance and copy the array since it can be modified in |
| 51 // transit. |
51 PrintJobs current_jobs(current_jobs_); | 52 PrintJobs current_jobs(current_jobs_); |
52 // Wait for every jobs to finish. | 53 // Wait for every jobs to finish. |
53 for (size_t i = 0; i < current_jobs.size(); ++i) { | 54 for (size_t i = 0; i < current_jobs.size(); ++i) { |
54 PrintJob* job = current_jobs[i]; | 55 PrintJob* job = current_jobs[i]; |
55 if (!job) | 56 if (!job) |
56 continue; | 57 continue; |
57 // Wait for 120 seconds for the print job to be spooled. | 58 // Wait for 120 seconds for the print job to be spooled. |
58 job->FlushJob(120000); | 59 job->FlushJob(120000); |
59 job->Stop(); | 60 job->Stop(); |
60 } | 61 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 filename += StringPrintf(L"%02d", page.page_number()); | 189 filename += StringPrintf(L"%02d", page.page_number()); |
189 filename += L"_.emf"; | 190 filename += L"_.emf"; |
190 file_util::ReplaceIllegalCharacters(&filename, '_'); | 191 file_util::ReplaceIllegalCharacters(&filename, '_'); |
191 std::wstring path(debug_dump_path_); | 192 std::wstring path(debug_dump_path_); |
192 file_util::AppendToPath(&path, filename); | 193 file_util::AppendToPath(&path, filename); |
193 page.emf()->SaveTo(path); | 194 page.emf()->SaveTo(path); |
194 } | 195 } |
195 | 196 |
196 } // namespace printing | 197 } // namespace printing |
197 | 198 |
OLD | NEW |