| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_view_manager_base.h" | 5 #include "chrome/browser/printing/print_view_manager_base.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) { | 185 if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) { |
| 186 NOTREACHED() << "Invalid metafile header"; | 186 NOTREACHED() << "Invalid metafile header"; |
| 187 web_contents()->Stop(); | 187 web_contents()->Stop(); |
| 188 return; | 188 return; |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 #if defined(OS_WIN) | 192 #if defined(OS_WIN) |
| 193 print_job_->AppendPrintedPage(params.page_number); | 193 print_job_->AppendPrintedPage(params.page_number); |
| 194 if (metafile_must_be_valid) { | 194 if (metafile_must_be_valid) { |
| 195 bool print_text_with_gdi = | |
| 196 document->settings().print_text_with_gdi() && | |
| 197 !document->settings().printer_is_xps() && | |
| 198 !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 199 switches::kDisableGDITextPrinting); | |
| 200 scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes( | 195 scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes( |
| 201 reinterpret_cast<const unsigned char*>(shared_buf->memory()), | 196 reinterpret_cast<const unsigned char*>(shared_buf->memory()), |
| 202 params.data_size); | 197 params.data_size); |
| 203 | 198 |
| 204 document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf")); | 199 document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf")); |
| 200 // TODO(thestig): Figure out why rendering text with GDI results in random |
| 201 // missing characters for some users. https://crbug.com/658606 |
| 205 print_job_->StartPdfToEmfConversion( | 202 print_job_->StartPdfToEmfConversion( |
| 206 bytes, params.page_size, params.content_area, print_text_with_gdi); | 203 bytes, params.page_size, params.content_area, |
| 204 false /* print_text_with_gdi? */); |
| 207 } | 205 } |
| 208 #else | 206 #else |
| 209 // Update the rendered document. It will send notifications to the listener. | 207 // Update the rendered document. It will send notifications to the listener. |
| 210 document->SetPage(params.page_number, std::move(metafile), params.page_size, | 208 document->SetPage(params.page_number, std::move(metafile), params.page_size, |
| 211 params.content_area); | 209 params.content_area); |
| 212 | 210 |
| 213 ShouldQuitFromInnerMessageLoop(); | 211 ShouldQuitFromInnerMessageLoop(); |
| 214 #endif | 212 #endif |
| 215 } | 213 } |
| 216 | 214 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 scoped_refptr<PrinterQuery> printer_query; | 533 scoped_refptr<PrinterQuery> printer_query; |
| 536 printer_query = queue_->PopPrinterQuery(cookie); | 534 printer_query = queue_->PopPrinterQuery(cookie); |
| 537 if (!printer_query.get()) | 535 if (!printer_query.get()) |
| 538 return; | 536 return; |
| 539 BrowserThread::PostTask( | 537 BrowserThread::PostTask( |
| 540 BrowserThread::IO, FROM_HERE, | 538 BrowserThread::IO, FROM_HERE, |
| 541 base::Bind(&PrinterQuery::StopWorker, printer_query)); | 539 base::Bind(&PrinterQuery::StopWorker, printer_query)); |
| 542 } | 540 } |
| 543 | 541 |
| 544 } // namespace printing | 542 } // namespace printing |
| OLD | NEW |