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