OLD | NEW |
1 // Copyright (c) 2011 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 "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/printing/print_job.h" | 10 #include "chrome/browser/printing/print_job.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 owner_->message_loop()->PostTask(FROM_HERE, task); | 300 owner_->message_loop()->PostTask(FROM_HERE, task); |
301 | 301 |
302 // Preprocess. | 302 // Preprocess. |
303 if (printing_context_->NewPage() != PrintingContext::OK) { | 303 if (printing_context_->NewPage() != PrintingContext::OK) { |
304 OnFailure(); | 304 OnFailure(); |
305 return; | 305 return; |
306 } | 306 } |
307 | 307 |
308 // Actual printing. | 308 // Actual printing. |
309 #if defined(OS_WIN) || defined(OS_MACOSX) | 309 #if defined(OS_WIN) || defined(OS_MACOSX) |
310 document_->RenderPrintedPage(page, printing_context_->context()); | 310 if(!document_->RenderPrintedPage(page, printing_context_->context())){ |
| 311 OnFailure(); |
| 312 return; |
| 313 } |
311 #elif defined(OS_POSIX) | 314 #elif defined(OS_POSIX) |
312 document_->RenderPrintedPage(page, printing_context_.get()); | 315 if(!document_->RenderPrintedPage(page, printing_context_.get())){ |
| 316 OnFailure(); |
| 317 return; |
| 318 } |
313 #endif | 319 #endif |
314 | 320 |
315 // Postprocess. | 321 // Postprocess. |
316 if (printing_context_->PageDone() != PrintingContext::OK) { | 322 if (printing_context_->PageDone() != PrintingContext::OK) { |
317 OnFailure(); | 323 OnFailure(); |
318 return; | 324 return; |
319 } | 325 } |
320 | 326 |
321 // Signal everyone that the page is printed. | 327 // Signal everyone that the page is printed. |
322 task = new NotificationTask(); | 328 task = new NotificationTask(); |
(...skipping 29 matching lines...) Expand all Loading... |
352 printing::PrintJobWorker* obj) { | 358 printing::PrintJobWorker* obj) { |
353 DCHECK(!owner_.get()); | 359 DCHECK(!owner_.get()); |
354 owner_ = obj->owner_; | 360 owner_ = obj->owner_; |
355 } | 361 } |
356 | 362 |
357 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( | 363 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( |
358 printing::PrintJobWorker* obj) { | 364 printing::PrintJobWorker* obj) { |
359 DCHECK_EQ(owner_, obj->owner_); | 365 DCHECK_EQ(owner_, obj->owner_); |
360 owner_ = NULL; | 366 owner_ = NULL; |
361 } | 367 } |
OLD | NEW |