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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 #if defined(OS_WIN) | 183 #if defined(OS_WIN) |
184 print_job_->AppendPrintedPage(params.page_number); | 184 print_job_->AppendPrintedPage(params.page_number); |
185 if (metafile_must_be_valid) { | 185 if (metafile_must_be_valid) { |
186 scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes( | 186 scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes( |
187 reinterpret_cast<const unsigned char*>(shared_buf->memory()), | 187 reinterpret_cast<const unsigned char*>(shared_buf->memory()), |
188 params.data_size); | 188 params.data_size); |
189 document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf")); | 189 document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf")); |
190 | 190 |
191 const auto& settings = document->settings(); | 191 const auto& settings = document->settings(); |
192 if ((settings.printer_is_ps2() || settings.printer_is_ps3()) && | 192 if (settings.printer_is_textonly()) { |
193 !base::FeatureList::IsEnabled(features::kDisablePostScriptPrinting)) { | 193 print_job_->StartPdfToTextConversion(bytes, params.page_size); |
| 194 } else if ((settings.printer_is_ps2() || settings.printer_is_ps3()) && |
| 195 !base::FeatureList::IsEnabled( |
| 196 features::kDisablePostScriptPrinting)) { |
194 print_job_->StartPdfToPostScriptConversion(bytes, params.content_area, | 197 print_job_->StartPdfToPostScriptConversion(bytes, params.content_area, |
195 params.physical_offsets, | 198 params.physical_offsets, |
196 settings.printer_is_ps2()); | 199 settings.printer_is_ps2()); |
197 } else { | 200 } else { |
198 // TODO(thestig): Figure out why rendering text with GDI results in random | 201 // TODO(thestig): Figure out why rendering text with GDI results in random |
199 // missing characters for some users. https://crbug.com/658606 | 202 // missing characters for some users. https://crbug.com/658606 |
200 // Update : The missing letters seem to have been caused by the same | 203 // Update : The missing letters seem to have been caused by the same |
201 // problem as https://crbug.com/659604 which was resolved. GDI printing | 204 // problem as https://crbug.com/659604 which was resolved. GDI printing |
202 // seems to work with the fix for this bug applied. | 205 // seems to work with the fix for this bug applied. |
203 bool print_text_with_gdi = settings.print_text_with_gdi() && | 206 bool print_text_with_gdi = settings.print_text_with_gdi() && |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 BrowserThread::IO, FROM_HERE, | 581 BrowserThread::IO, FROM_HERE, |
579 base::BindOnce(&PrinterQuery::StopWorker, printer_query)); | 582 base::BindOnce(&PrinterQuery::StopWorker, printer_query)); |
580 } | 583 } |
581 | 584 |
582 void PrintViewManagerBase::SendPrintingEnabled(bool enabled, | 585 void PrintViewManagerBase::SendPrintingEnabled(bool enabled, |
583 content::RenderFrameHost* rfh) { | 586 content::RenderFrameHost* rfh) { |
584 rfh->Send(new PrintMsg_SetPrintingEnabled(rfh->GetRoutingID(), enabled)); | 587 rfh->Send(new PrintMsg_SetPrintingEnabled(rfh->GetRoutingID(), enabled)); |
585 } | 588 } |
586 | 589 |
587 } // namespace printing | 590 } // namespace printing |
OLD | NEW |