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

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

Issue 2114583002: Windows: Make it possible to print text with GDI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again, resolve conflicts Created 4 years, 3 months 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 | « chrome/browser/printing/print_job_worker.cc ('k') | chrome/browser/printing/printer_query.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 23 matching lines...) Expand all
34 #include "content/public/browser/render_view_host.h" 34 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
36 #include "printing/pdf_metafile_skia.h" 36 #include "printing/pdf_metafile_skia.h"
37 #include "printing/printed_document.h" 37 #include "printing/printed_document.h"
38 #include "ui/base/l10n/l10n_util.h" 38 #include "ui/base/l10n/l10n_util.h"
39 39
40 #if defined(ENABLE_PRINT_PREVIEW) 40 #if defined(ENABLE_PRINT_PREVIEW)
41 #include "chrome/browser/printing/print_error_dialog.h" 41 #include "chrome/browser/printing/print_error_dialog.h"
42 #endif 42 #endif
43 43
44 #if defined(OS_WIN)
45 #include "base/command_line.h"
46 #include "chrome/common/chrome_switches.h"
47 #endif
48
44 using base::TimeDelta; 49 using base::TimeDelta;
45 using content::BrowserThread; 50 using content::BrowserThread;
46 51
47 namespace printing { 52 namespace printing {
48 53
49 namespace { 54 namespace {
50 55
51 void ShowWarningMessageBox(const base::string16& message) { 56 void ShowWarningMessageBox(const base::string16& message) {
52 // Runs always on the UI thread. 57 // Runs always on the UI thread.
53 static bool is_dialog_shown = false; 58 static bool is_dialog_shown = false;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) { 183 if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) {
179 NOTREACHED() << "Invalid metafile header"; 184 NOTREACHED() << "Invalid metafile header";
180 web_contents()->Stop(); 185 web_contents()->Stop();
181 return; 186 return;
182 } 187 }
183 } 188 }
184 189
185 #if defined(OS_WIN) 190 #if defined(OS_WIN)
186 print_job_->AppendPrintedPage(params.page_number); 191 print_job_->AppendPrintedPage(params.page_number);
187 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 !base::CommandLine::ForCurrentProcess()->HasSwitch(
196 switches::kDisableGDITextPrinting);
188 scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes( 197 scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
189 reinterpret_cast<const unsigned char*>(shared_buf->memory()), 198 reinterpret_cast<const unsigned char*>(shared_buf->memory()),
190 params.data_size); 199 params.data_size);
191 200
192 document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf")); 201 document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
193 print_job_->StartPdfToEmfConversion( 202 print_job_->StartPdfToEmfConversion(
194 bytes, params.page_size, params.content_area); 203 bytes, params.page_size, params.content_area, print_text_with_gdi);
195 } 204 }
196 #else 205 #else
197 // Update the rendered document. It will send notifications to the listener. 206 // Update the rendered document. It will send notifications to the listener.
198 document->SetPage(params.page_number, std::move(metafile), params.page_size, 207 document->SetPage(params.page_number, std::move(metafile), params.page_size,
199 params.content_area); 208 params.content_area);
200 209
201 ShouldQuitFromInnerMessageLoop(); 210 ShouldQuitFromInnerMessageLoop();
202 #endif 211 #endif
203 } 212 }
204 213
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 scoped_refptr<PrinterQuery> printer_query; 532 scoped_refptr<PrinterQuery> printer_query;
524 printer_query = queue_->PopPrinterQuery(cookie); 533 printer_query = queue_->PopPrinterQuery(cookie);
525 if (!printer_query.get()) 534 if (!printer_query.get())
526 return; 535 return;
527 BrowserThread::PostTask( 536 BrowserThread::PostTask(
528 BrowserThread::IO, FROM_HERE, 537 BrowserThread::IO, FROM_HERE,
529 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); 538 base::Bind(&PrinterQuery::StopWorker, printer_query.get()));
530 } 539 }
531 540
532 } // namespace printing 541 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job_worker.cc ('k') | chrome/browser/printing/printer_query.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698