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

Side by Side Diff: chrome/utility/printing_handler.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/utility/printing_handler.h ('k') | components/printing/common/print_messages.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/utility/printing_handler.h" 5 #include "chrome/utility/printing_handler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 22 matching lines...) Expand all
33 namespace { 33 namespace {
34 34
35 bool Send(IPC::Message* message) { 35 bool Send(IPC::Message* message) {
36 return content::UtilityThread::Get()->Send(message); 36 return content::UtilityThread::Get()->Send(message);
37 } 37 }
38 38
39 void ReleaseProcessIfNeeded() { 39 void ReleaseProcessIfNeeded() {
40 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); 40 content::UtilityThread::Get()->ReleaseProcessIfNeeded();
41 } 41 }
42 42
43 #if defined(OS_WIN)
44 void PreCacheFontCharacters(const LOGFONT* logfont,
45 const wchar_t* text,
46 size_t text_length) {
47 Send(new ChromeUtilityHostMsg_PreCacheFontCharacters(
48 *logfont, base::string16(text, text_length)));
49 }
50 #endif
51
43 } // namespace 52 } // namespace
44 53
45 PrintingHandler::PrintingHandler() {} 54 PrintingHandler::PrintingHandler() {
55 #if defined(OS_WIN)
56 chrome_pdf::SetPDFEnsureTypefaceCharactersAccessible(PreCacheFontCharacters);
57 #endif
58 }
46 59
47 PrintingHandler::~PrintingHandler() {} 60 PrintingHandler::~PrintingHandler() {}
48 61
49 bool PrintingHandler::OnMessageReceived(const IPC::Message& message) { 62 bool PrintingHandler::OnMessageReceived(const IPC::Message& message) {
50 bool handled = true; 63 bool handled = true;
51 IPC_BEGIN_MESSAGE_MAP(PrintingHandler, message) 64 IPC_BEGIN_MESSAGE_MAP(PrintingHandler, message)
52 #if defined(OS_WIN) 65 #if defined(OS_WIN)
53 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles, 66 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
54 OnRenderPDFPagesToMetafile) 67 OnRenderPDFPagesToMetafile)
55 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage, 68 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage,
(...skipping 10 matching lines...) Expand all
66 OnGetPrinterSemanticCapsAndDefaults) 79 OnGetPrinterSemanticCapsAndDefaults)
67 #endif // ENABLE_PRINT_PREVIEW 80 #endif // ENABLE_PRINT_PREVIEW
68 IPC_MESSAGE_UNHANDLED(handled = false) 81 IPC_MESSAGE_UNHANDLED(handled = false)
69 IPC_END_MESSAGE_MAP() 82 IPC_END_MESSAGE_MAP()
70 return handled; 83 return handled;
71 } 84 }
72 85
73 #if defined(OS_WIN) 86 #if defined(OS_WIN)
74 void PrintingHandler::OnRenderPDFPagesToMetafile( 87 void PrintingHandler::OnRenderPDFPagesToMetafile(
75 IPC::PlatformFileForTransit pdf_transit, 88 IPC::PlatformFileForTransit pdf_transit,
76 const PdfRenderSettings& settings) { 89 const PdfRenderSettings& settings,
90 bool print_text_with_gdi) {
77 pdf_rendering_settings_ = settings; 91 pdf_rendering_settings_ = settings;
92 chrome_pdf::SetPDFUseGDIPrinting(print_text_with_gdi);
78 base::File pdf_file = IPC::PlatformFileForTransitToFile(pdf_transit); 93 base::File pdf_file = IPC::PlatformFileForTransitToFile(pdf_transit);
79 int page_count = LoadPDF(std::move(pdf_file)); 94 int page_count = LoadPDF(std::move(pdf_file));
80 Send( 95 Send(
81 new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount(page_count)); 96 new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount(page_count));
82 } 97 }
83 98
84 void PrintingHandler::OnRenderPDFPagesToMetafileGetPage( 99 void PrintingHandler::OnRenderPDFPagesToMetafileGetPage(
85 int page_number, 100 int page_number,
86 IPC::PlatformFileForTransit output_file) { 101 IPC::PlatformFileForTransit output_file) {
87 base::File emf_file = IPC::PlatformFileForTransitToFile(output_file); 102 base::File emf_file = IPC::PlatformFileForTransitToFile(output_file);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 printer_name, printer_info)); 319 printer_name, printer_info));
305 } else { 320 } else {
306 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed( 321 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed(
307 printer_name)); 322 printer_name));
308 } 323 }
309 ReleaseProcessIfNeeded(); 324 ReleaseProcessIfNeeded();
310 } 325 }
311 #endif // ENABLE_PRINT_PREVIEW 326 #endif // ENABLE_PRINT_PREVIEW
312 327
313 } // namespace printing 328 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/utility/printing_handler.h ('k') | components/printing/common/print_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698