OLD | NEW |
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.h" | 5 #include "chrome/browser/printing/print_job.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 void PrintJob::StartPdfToEmfConversion( | 276 void PrintJob::StartPdfToEmfConversion( |
277 const scoped_refptr<base::RefCountedMemory>& bytes, | 277 const scoped_refptr<base::RefCountedMemory>& bytes, |
278 const gfx::Size& page_size, | 278 const gfx::Size& page_size, |
279 const gfx::Rect& content_area, | 279 const gfx::Rect& content_area, |
280 bool print_text_with_gdi) { | 280 bool print_text_with_gdi) { |
281 DCHECK(!pdf_conversion_state_); | 281 DCHECK(!pdf_conversion_state_); |
282 pdf_conversion_state_ = | 282 pdf_conversion_state_ = |
283 base::MakeUnique<PdfConversionState>(page_size, content_area); | 283 base::MakeUnique<PdfConversionState>(page_size, content_area); |
284 const int kPrinterDpi = settings().dpi(); | 284 const int kPrinterDpi = settings().dpi(); |
285 PdfRenderSettings settings( | 285 PdfRenderSettings settings( |
286 content_area, gfx::Point(0,0), kPrinterDpi, /*autorotate=*/true, | 286 content_area, gfx::Point(0, 0), kPrinterDpi, /*autorotate=*/true, |
287 print_text_with_gdi ? PdfRenderSettings::Mode::GDI_TEXT | 287 print_text_with_gdi ? PdfRenderSettings::Mode::GDI_TEXT |
288 : PdfRenderSettings::Mode::NORMAL); | 288 : PdfRenderSettings::Mode::NORMAL); |
289 pdf_conversion_state_->Start( | 289 pdf_conversion_state_->Start( |
290 bytes, settings, base::Bind(&PrintJob::OnPdfConversionStarted, this)); | 290 bytes, settings, base::Bind(&PrintJob::OnPdfConversionStarted, this)); |
291 } | 291 } |
292 | 292 |
293 void PrintJob::OnPdfConversionStarted(int page_count) { | 293 void PrintJob::OnPdfConversionStarted(int page_count) { |
294 if (page_count <= 0) { | 294 if (page_count <= 0) { |
295 pdf_conversion_state_.reset(); | 295 pdf_conversion_state_.reset(); |
296 Cancel(); | 296 Cancel(); |
(...skipping 27 matching lines...) Expand all Loading... |
324 void PrintJob::StartPdfToPostScriptConversion( | 324 void PrintJob::StartPdfToPostScriptConversion( |
325 const scoped_refptr<base::RefCountedMemory>& bytes, | 325 const scoped_refptr<base::RefCountedMemory>& bytes, |
326 const gfx::Rect& content_area, | 326 const gfx::Rect& content_area, |
327 const gfx::Point& physical_offsets, | 327 const gfx::Point& physical_offsets, |
328 bool ps_level2) { | 328 bool ps_level2) { |
329 DCHECK(!pdf_conversion_state_); | 329 DCHECK(!pdf_conversion_state_); |
330 pdf_conversion_state_ = base::MakeUnique<PdfConversionState>( | 330 pdf_conversion_state_ = base::MakeUnique<PdfConversionState>( |
331 gfx::Size(), gfx::Rect()); | 331 gfx::Size(), gfx::Rect()); |
332 const int kPrinterDpi = settings().dpi(); | 332 const int kPrinterDpi = settings().dpi(); |
333 PdfRenderSettings settings( | 333 PdfRenderSettings settings( |
334 content_area, physical_offsets, kPrinterDpi, true /* autorotate? */, | 334 content_area, physical_offsets, kPrinterDpi, /*autorotate=*/true, |
335 ps_level2 ? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2 | 335 ps_level2 ? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2 |
336 : PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3); | 336 : PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3); |
337 pdf_conversion_state_->Start( | 337 pdf_conversion_state_->Start( |
338 bytes, settings, base::Bind(&PrintJob::OnPdfConversionStarted, this)); | 338 bytes, settings, base::Bind(&PrintJob::OnPdfConversionStarted, this)); |
339 } | 339 } |
340 #endif // defined(OS_WIN) | 340 #endif // defined(OS_WIN) |
341 | 341 |
342 void PrintJob::UpdatePrintedDocument(PrintedDocument* new_document) { | 342 void PrintJob::UpdatePrintedDocument(PrintedDocument* new_document) { |
343 if (document_.get() == new_document) | 343 if (document_.get() == new_document) |
344 return; | 344 return; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 : document_(document), page_(page), type_(type), job_id_(job_id) {} | 473 : document_(document), page_(page), type_(type), job_id_(job_id) {} |
474 | 474 |
475 JobEventDetails::~JobEventDetails() { | 475 JobEventDetails::~JobEventDetails() { |
476 } | 476 } |
477 | 477 |
478 PrintedDocument* JobEventDetails::document() const { return document_.get(); } | 478 PrintedDocument* JobEventDetails::document() const { return document_.get(); } |
479 | 479 |
480 PrintedPage* JobEventDetails::page() const { return page_.get(); } | 480 PrintedPage* JobEventDetails::page() const { return page_.get(); } |
481 | 481 |
482 } // namespace printing | 482 } // namespace printing |
OLD | NEW |