Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: chrome/browser/printing/print_view_manager_base.cc

Issue 2503663002: Printing: Add command line switch to rendering text with GDI. (Closed)
Patch Set: Sort Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) { 186 if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) {
187 NOTREACHED() << "Invalid metafile header"; 187 NOTREACHED() << "Invalid metafile header";
188 web_contents()->Stop(); 188 web_contents()->Stop();
189 return; 189 return;
190 } 190 }
191 } 191 }
192 192
193 #if defined(OS_WIN) 193 #if defined(OS_WIN)
194 print_job_->AppendPrintedPage(params.page_number); 194 print_job_->AppendPrintedPage(params.page_number);
195 if (metafile_must_be_valid) { 195 if (metafile_must_be_valid) {
196 // TODO(thestig): Figure out why rendering text with GDI results in random
197 // missing characters for some users. https://crbug.com/658606
198 bool print_text_with_gdi =
199 document->settings().print_text_with_gdi() &&
200 !document->settings().printer_is_xps() &&
201 switches::GDITextPrintingEnabled();
196 scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes( 202 scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
197 reinterpret_cast<const unsigned char*>(shared_buf->memory()), 203 reinterpret_cast<const unsigned char*>(shared_buf->memory()),
198 params.data_size); 204 params.data_size);
199 205
200 document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf")); 206 document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
201 // TODO(thestig): Figure out why rendering text with GDI results in random
202 // missing characters for some users. https://crbug.com/658606
203 print_job_->StartPdfToEmfConversion( 207 print_job_->StartPdfToEmfConversion(
204 bytes, params.page_size, params.content_area, 208 bytes, params.page_size, params.content_area,
205 false /* print_text_with_gdi? */); 209 print_text_with_gdi);
206 } 210 }
207 #else 211 #else
208 // Update the rendered document. It will send notifications to the listener. 212 // Update the rendered document. It will send notifications to the listener.
209 document->SetPage(params.page_number, std::move(metafile), params.page_size, 213 document->SetPage(params.page_number, std::move(metafile), params.page_size,
210 params.content_area); 214 params.content_area);
211 215
212 ShouldQuitFromInnerMessageLoop(); 216 ShouldQuitFromInnerMessageLoop();
213 #endif 217 #endif
214 } 218 }
215 219
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 scoped_refptr<PrinterQuery> printer_query; 538 scoped_refptr<PrinterQuery> printer_query;
535 printer_query = queue_->PopPrinterQuery(cookie); 539 printer_query = queue_->PopPrinterQuery(cookie);
536 if (!printer_query.get()) 540 if (!printer_query.get())
537 return; 541 return;
538 BrowserThread::PostTask( 542 BrowserThread::PostTask(
539 BrowserThread::IO, FROM_HERE, 543 BrowserThread::IO, FROM_HERE,
540 base::Bind(&PrinterQuery::StopWorker, printer_query)); 544 base::Bind(&PrinterQuery::StopWorker, printer_query));
541 } 545 }
542 546
543 } // namespace printing 547 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698