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

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

Issue 549423002: PrintingHandler in utility process is required for Windows even without full printing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test_patches
Patch Set: Created 6 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') | no next file » | 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 "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_native_library.h" 10 #include "base/scoped_native_library.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 g_pdf_lib.Get().Init(); 256 g_pdf_lib.Get().Init();
257 } 257 }
258 258
259 bool PrintingHandler::OnMessageReceived(const IPC::Message& message) { 259 bool PrintingHandler::OnMessageReceived(const IPC::Message& message) {
260 bool handled = true; 260 bool handled = true;
261 IPC_BEGIN_MESSAGE_MAP(PrintingHandler, message) 261 IPC_BEGIN_MESSAGE_MAP(PrintingHandler, message)
262 #if defined(OS_WIN) 262 #if defined(OS_WIN)
263 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles, 263 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
264 OnRenderPDFPagesToMetafile) 264 OnRenderPDFPagesToMetafile)
265 #endif // OS_WIN 265 #endif // OS_WIN
266 #if defined(ENABLE_FULL_PRINTING)
266 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToPWGRaster, 267 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToPWGRaster,
267 OnRenderPDFPagesToPWGRaster) 268 OnRenderPDFPagesToPWGRaster)
268 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults, 269 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults,
269 OnGetPrinterCapsAndDefaults) 270 OnGetPrinterCapsAndDefaults)
270 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults, 271 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults,
271 OnGetPrinterSemanticCapsAndDefaults) 272 OnGetPrinterSemanticCapsAndDefaults)
273 #endif // ENABLE_FULL_PRINTING
272 IPC_MESSAGE_UNHANDLED(handled = false) 274 IPC_MESSAGE_UNHANDLED(handled = false)
273 IPC_END_MESSAGE_MAP() 275 IPC_END_MESSAGE_MAP()
274 return handled; 276 return handled;
275 } 277 }
276 278
277 #if defined(OS_WIN) 279 #if defined(OS_WIN)
278 void PrintingHandler::OnRenderPDFPagesToMetafile( 280 void PrintingHandler::OnRenderPDFPagesToMetafile(
279 IPC::PlatformFileForTransit pdf_transit, 281 IPC::PlatformFileForTransit pdf_transit,
280 const base::FilePath& metafile_path, 282 const base::FilePath& metafile_path,
281 const printing::PdfRenderSettings& settings, 283 const printing::PdfRenderSettings& settings,
(...skipping 15 matching lines...) Expand all
297 // start sooner. 299 // start sooner.
298 Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_Succeeded( 300 Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_Succeeded(
299 page_ranges, scale_factor)); 301 page_ranges, scale_factor));
300 } else { 302 } else {
301 Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Failed()); 303 Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Failed());
302 } 304 }
303 ReleaseProcessIfNeeded(); 305 ReleaseProcessIfNeeded();
304 } 306 }
305 #endif // OS_WIN 307 #endif // OS_WIN
306 308
309 #if defined(ENABLE_FULL_PRINTING)
307 void PrintingHandler::OnRenderPDFPagesToPWGRaster( 310 void PrintingHandler::OnRenderPDFPagesToPWGRaster(
308 IPC::PlatformFileForTransit pdf_transit, 311 IPC::PlatformFileForTransit pdf_transit,
309 const printing::PdfRenderSettings& settings, 312 const printing::PdfRenderSettings& settings,
310 const printing::PwgRasterSettings& bitmap_settings, 313 const printing::PwgRasterSettings& bitmap_settings,
311 IPC::PlatformFileForTransit bitmap_transit) { 314 IPC::PlatformFileForTransit bitmap_transit) {
312 base::File pdf = IPC::PlatformFileForTransitToFile(pdf_transit); 315 base::File pdf = IPC::PlatformFileForTransitToFile(pdf_transit);
313 base::File bitmap = IPC::PlatformFileForTransitToFile(bitmap_transit); 316 base::File bitmap = IPC::PlatformFileForTransitToFile(bitmap_transit);
314 if (RenderPDFPagesToPWGRaster(pdf.Pass(), settings, bitmap_settings, 317 if (RenderPDFPagesToPWGRaster(pdf.Pass(), settings, bitmap_settings,
315 bitmap.Pass())) { 318 bitmap.Pass())) {
316 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded()); 319 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded());
317 } else { 320 } else {
318 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed()); 321 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed());
319 } 322 }
320 ReleaseProcessIfNeeded(); 323 ReleaseProcessIfNeeded();
321 } 324 }
325 #endif // ENABLE_FULL_PRINTING
322 326
323 #if defined(OS_WIN) 327 #if defined(OS_WIN)
324 bool PrintingHandler::RenderPDFToWinMetafile( 328 bool PrintingHandler::RenderPDFToWinMetafile(
325 base::File pdf_file, 329 base::File pdf_file,
326 const base::FilePath& metafile_path, 330 const base::FilePath& metafile_path,
327 const printing::PdfRenderSettings& settings, 331 const printing::PdfRenderSettings& settings,
328 std::vector<printing::PageRange>* page_ranges, 332 std::vector<printing::PageRange>* page_ranges,
329 int* highest_rendered_page_number, 333 int* highest_rendered_page_number,
330 double* scale_factor) { 334 double* scale_factor) {
331 DCHECK(page_ranges); 335 DCHECK(page_ranges);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 ret = true; 402 ret = true;
399 } 403 }
400 metafile.FinishPage(); 404 metafile.FinishPage();
401 metafile.FinishDocument(); 405 metafile.FinishDocument();
402 } 406 }
403 } 407 }
404 return ret; 408 return ret;
405 } 409 }
406 #endif // OS_WIN 410 #endif // OS_WIN
407 411
412 #if defined(ENABLE_FULL_PRINTING)
408 bool PrintingHandler::RenderPDFPagesToPWGRaster( 413 bool PrintingHandler::RenderPDFPagesToPWGRaster(
409 base::File pdf_file, 414 base::File pdf_file,
410 const printing::PdfRenderSettings& settings, 415 const printing::PdfRenderSettings& settings,
411 const printing::PwgRasterSettings& bitmap_settings, 416 const printing::PwgRasterSettings& bitmap_settings,
412 base::File bitmap_file) { 417 base::File bitmap_file) {
413 bool autoupdate = true; 418 bool autoupdate = true;
414 if (!g_pdf_lib.Get().IsValid()) 419 if (!g_pdf_lib.Get().IsValid())
415 return false; 420 return false;
416 421
417 base::File::Info info; 422 base::File::Info info;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 if (print_backend->GetPrinterSemanticCapsAndDefaults(printer_name, 532 if (print_backend->GetPrinterSemanticCapsAndDefaults(printer_name,
528 &printer_info)) { 533 &printer_info)) {
529 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Succeeded( 534 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Succeeded(
530 printer_name, printer_info)); 535 printer_name, printer_info));
531 } else { 536 } else {
532 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed( 537 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed(
533 printer_name)); 538 printer_name));
534 } 539 }
535 ReleaseProcessIfNeeded(); 540 ReleaseProcessIfNeeded();
536 } 541 }
542 #endif // ENABLE_FULL_PRINTING
OLDNEW
« no previous file with comments | « chrome/utility/printing_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698