OLD | NEW |
---|---|
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 return handled; | 84 return handled; |
85 } | 85 } |
86 | 86 |
87 #if defined(OS_WIN) | 87 #if defined(OS_WIN) |
88 void PrintingHandler::OnRenderPDFPagesToMetafile( | 88 void PrintingHandler::OnRenderPDFPagesToMetafile( |
89 IPC::PlatformFileForTransit pdf_transit, | 89 IPC::PlatformFileForTransit pdf_transit, |
90 const PdfRenderSettings& settings) { | 90 const PdfRenderSettings& settings) { |
91 pdf_rendering_settings_ = settings; | 91 pdf_rendering_settings_ = settings; |
92 chrome_pdf::SetPDFUseGDIPrinting(pdf_rendering_settings_.mode == | 92 chrome_pdf::SetPDFUseGDIPrinting(pdf_rendering_settings_.mode == |
93 PdfRenderSettings::Mode::GDI_TEXT); | 93 PdfRenderSettings::Mode::GDI_TEXT); |
94 int postscript_level; | 94 int printing_mode; |
95 switch (pdf_rendering_settings_.mode) { | 95 switch (pdf_rendering_settings_.mode) { |
96 case PdfRenderSettings::Mode::TEXTONLY: | |
97 printing_mode = 1; | |
Lei Zhang
2017/07/12 00:21:15
If you add another enum in pdf/pdf.h and change Se
rbpotter
2017/07/13 18:46:15
Done.
| |
98 break; | |
96 case PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2: | 99 case PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2: |
97 postscript_level = 2; | 100 printing_mode = 2; |
98 break; | 101 break; |
99 case PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3: | 102 case PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3: |
100 postscript_level = 3; | 103 printing_mode = 3; |
101 break; | 104 break; |
102 default: | 105 default: |
103 postscript_level = 0; // Not using postscript. | 106 printing_mode = 0; // Not using postscript or text only. |
104 } | 107 } |
105 chrome_pdf::SetPDFPostscriptPrintingLevel(postscript_level); | 108 chrome_pdf::SetPDFUsePrintMode(printing_mode); |
106 | 109 |
107 base::File pdf_file = IPC::PlatformFileForTransitToFile(pdf_transit); | 110 base::File pdf_file = IPC::PlatformFileForTransitToFile(pdf_transit); |
108 int page_count = LoadPDF(std::move(pdf_file)); | 111 int page_count = LoadPDF(std::move(pdf_file)); |
109 Send( | 112 Send( |
110 new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount(page_count)); | 113 new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount(page_count)); |
111 } | 114 } |
112 | 115 |
113 void PrintingHandler::OnRenderPDFPagesToMetafileGetPage( | 116 void PrintingHandler::OnRenderPDFPagesToMetafileGetPage( |
114 int page_number, | 117 int page_number, |
115 IPC::PlatformFileForTransit output_file) { | 118 IPC::PlatformFileForTransit output_file) { |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 printer_name, printer_info)); | 338 printer_name, printer_info)); |
336 } else { | 339 } else { |
337 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed( | 340 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed( |
338 printer_name)); | 341 printer_name)); |
339 } | 342 } |
340 ReleaseProcessIfNeeded(); | 343 ReleaseProcessIfNeeded(); |
341 } | 344 } |
342 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | 345 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
343 | 346 |
344 } // namespace printing | 347 } // namespace printing |
OLD | NEW |