OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_worker.h" | 5 #include "chrome/browser/printing/print_job_worker.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
10 #include "chrome/browser/printing/print_job.h" | 10 #include "chrome/browser/printing/print_job.h" |
11 #include "chrome/common/notification_service.h" | 11 #include "chrome/common/notification_service.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 &page); | 257 &page); |
258 owner_->message_loop()->PostTask(FROM_HERE, task); | 258 owner_->message_loop()->PostTask(FROM_HERE, task); |
259 | 259 |
260 // Preprocess. | 260 // Preprocess. |
261 if (printing_context_->NewPage() != PrintingContext::OK) { | 261 if (printing_context_->NewPage() != PrintingContext::OK) { |
262 OnFailure(); | 262 OnFailure(); |
263 return; | 263 return; |
264 } | 264 } |
265 | 265 |
266 // Actual printing. | 266 // Actual printing. |
| 267 #if defined(OS_WIN) || defined(OS_MACOSX) |
267 document_->RenderPrintedPage(page, printing_context_->context()); | 268 document_->RenderPrintedPage(page, printing_context_->context()); |
| 269 #elif defined(OS_POSIX) |
| 270 document_->RenderPrintedPage(page, printing_context_.get()); |
| 271 #endif |
268 | 272 |
269 // Postprocess. | 273 // Postprocess. |
270 if (printing_context_->PageDone() != PrintingContext::OK) { | 274 if (printing_context_->PageDone() != PrintingContext::OK) { |
271 OnFailure(); | 275 OnFailure(); |
272 return; | 276 return; |
273 } | 277 } |
274 | 278 |
275 // Signal everyone that the page is printed. | 279 // Signal everyone that the page is printed. |
276 task = new NotificationTask(); | 280 task = new NotificationTask(); |
277 task->Init(owner_, | 281 task->Init(owner_, |
(...skipping 28 matching lines...) Expand all Loading... |
306 printing::PrintJobWorker* obj) { | 310 printing::PrintJobWorker* obj) { |
307 DCHECK(!owner_.get()); | 311 DCHECK(!owner_.get()); |
308 owner_ = obj->owner_; | 312 owner_ = obj->owner_; |
309 } | 313 } |
310 | 314 |
311 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( | 315 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( |
312 printing::PrintJobWorker* obj) { | 316 printing::PrintJobWorker* obj) { |
313 DCHECK_EQ(owner_, obj->owner_); | 317 DCHECK_EQ(owner_, obj->owner_); |
314 owner_ = NULL; | 318 owner_ = NULL; |
315 } | 319 } |
OLD | NEW |