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( | |
271 page, reinterpret_cast<PrintingContextCairo*>(printing_context_.get())); | |
sanjeevr
2011/02/17 21:09:48
Why is this cast done here and not within the impl
Lei Zhang
2011/02/18 00:10:08
Fixed.
| |
272 #endif | |
268 | 273 |
269 // Postprocess. | 274 // Postprocess. |
270 if (printing_context_->PageDone() != PrintingContext::OK) { | 275 if (printing_context_->PageDone() != PrintingContext::OK) { |
271 OnFailure(); | 276 OnFailure(); |
272 return; | 277 return; |
273 } | 278 } |
274 | 279 |
275 // Signal everyone that the page is printed. | 280 // Signal everyone that the page is printed. |
276 task = new NotificationTask(); | 281 task = new NotificationTask(); |
277 task->Init(owner_, | 282 task->Init(owner_, |
(...skipping 28 matching lines...) Expand all Loading... | |
306 printing::PrintJobWorker* obj) { | 311 printing::PrintJobWorker* obj) { |
307 DCHECK(!owner_.get()); | 312 DCHECK(!owner_.get()); |
308 owner_ = obj->owner_; | 313 owner_ = obj->owner_; |
309 } | 314 } |
310 | 315 |
311 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( | 316 void RunnableMethodTraits<printing::PrintJobWorker>::ReleaseCallee( |
312 printing::PrintJobWorker* obj) { | 317 printing::PrintJobWorker* obj) { |
313 DCHECK_EQ(owner_, obj->owner_); | 318 DCHECK_EQ(owner_, obj->owner_); |
314 owner_ = NULL; | 319 owner_ = NULL; |
315 } | 320 } |
OLD | NEW |