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

Side by Side Diff: chrome/utility/printing_handler.cc

Issue 2713023005: Fix some nits from r447440. (Closed)
Patch Set: rebase, git cl format Created 3 years, 8 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/service/cloud_print/print_system_win.cc ('k') | printing/pdf_render_settings.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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 IPC_MESSAGE_UNHANDLED(handled = false) 82 IPC_MESSAGE_UNHANDLED(handled = false)
83 IPC_END_MESSAGE_MAP() 83 IPC_END_MESSAGE_MAP()
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::SetPDFPostscriptPrintingLevel(0); // Not using postscript.
93 chrome_pdf::SetPDFUseGDIPrinting(pdf_rendering_settings_.mode == 92 chrome_pdf::SetPDFUseGDIPrinting(pdf_rendering_settings_.mode ==
94 PdfRenderSettings::Mode::GDI_TEXT); 93 PdfRenderSettings::Mode::GDI_TEXT);
95 if (pdf_rendering_settings_.mode == 94 int postscript_level;
96 PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2) { 95 switch (pdf_rendering_settings_.mode) {
97 chrome_pdf::SetPDFPostscriptPrintingLevel(2); 96 case PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2:
98 } else if (pdf_rendering_settings_.mode == 97 postscript_level = 2;
99 PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3) { 98 break;
100 chrome_pdf::SetPDFPostscriptPrintingLevel(3); 99 case PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3:
100 postscript_level = 3;
101 break;
102 default:
103 postscript_level = 0; // Not using postscript.
101 } 104 }
105 chrome_pdf::SetPDFPostscriptPrintingLevel(postscript_level);
106
102 base::File pdf_file = IPC::PlatformFileForTransitToFile(pdf_transit); 107 base::File pdf_file = IPC::PlatformFileForTransitToFile(pdf_transit);
103 int page_count = LoadPDF(std::move(pdf_file)); 108 int page_count = LoadPDF(std::move(pdf_file));
104 Send( 109 Send(
105 new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount(page_count)); 110 new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount(page_count));
106 } 111 }
107 112
108 void PrintingHandler::OnRenderPDFPagesToMetafileGetPage( 113 void PrintingHandler::OnRenderPDFPagesToMetafileGetPage(
109 int page_number, 114 int page_number,
110 IPC::PlatformFileForTransit output_file) { 115 IPC::PlatformFileForTransit output_file) {
111 base::File emf_file = IPC::PlatformFileForTransitToFile(output_file); 116 base::File emf_file = IPC::PlatformFileForTransitToFile(output_file);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 printer_name, printer_info)); 335 printer_name, printer_info));
331 } else { 336 } else {
332 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed( 337 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed(
333 printer_name)); 338 printer_name));
334 } 339 }
335 ReleaseProcessIfNeeded(); 340 ReleaseProcessIfNeeded();
336 } 341 }
337 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) 342 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
338 343
339 } // namespace printing 344 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/print_system_win.cc ('k') | printing/pdf_render_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698