| 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 | 9 |
| 9 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
| 12 #include "chrome/common/chrome_utility_printing_messages.h" | 13 #include "chrome/common/chrome_utility_printing_messages.h" |
| 13 #include "chrome/utility/cloud_print/bitmap_image.h" | 14 #include "chrome/utility/cloud_print/bitmap_image.h" |
| 14 #include "chrome/utility/cloud_print/pwg_encoder.h" | 15 #include "chrome/utility/cloud_print/pwg_encoder.h" |
| 15 #include "content/public/utility/utility_thread.h" | 16 #include "content/public/utility/utility_thread.h" |
| 16 #include "pdf/pdf.h" | 17 #include "pdf/pdf.h" |
| 17 #include "printing/page_range.h" | 18 #include "printing/page_range.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 #endif // OS_WIN | 99 #endif // OS_WIN |
| 99 | 100 |
| 100 #if defined(ENABLE_PRINT_PREVIEW) | 101 #if defined(ENABLE_PRINT_PREVIEW) |
| 101 void PrintingHandler::OnRenderPDFPagesToPWGRaster( | 102 void PrintingHandler::OnRenderPDFPagesToPWGRaster( |
| 102 IPC::PlatformFileForTransit pdf_transit, | 103 IPC::PlatformFileForTransit pdf_transit, |
| 103 const PdfRenderSettings& settings, | 104 const PdfRenderSettings& settings, |
| 104 const PwgRasterSettings& bitmap_settings, | 105 const PwgRasterSettings& bitmap_settings, |
| 105 IPC::PlatformFileForTransit bitmap_transit) { | 106 IPC::PlatformFileForTransit bitmap_transit) { |
| 106 base::File pdf = IPC::PlatformFileForTransitToFile(pdf_transit); | 107 base::File pdf = IPC::PlatformFileForTransitToFile(pdf_transit); |
| 107 base::File bitmap = IPC::PlatformFileForTransitToFile(bitmap_transit); | 108 base::File bitmap = IPC::PlatformFileForTransitToFile(bitmap_transit); |
| 108 if (RenderPDFPagesToPWGRaster(pdf.Pass(), settings, bitmap_settings, | 109 if (RenderPDFPagesToPWGRaster(std::move(pdf), settings, bitmap_settings, |
| 109 bitmap.Pass())) { | 110 std::move(bitmap))) { |
| 110 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded()); | 111 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded()); |
| 111 } else { | 112 } else { |
| 112 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed()); | 113 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed()); |
| 113 } | 114 } |
| 114 ReleaseProcessIfNeeded(); | 115 ReleaseProcessIfNeeded(); |
| 115 } | 116 } |
| 116 #endif // ENABLE_PRINT_PREVIEW | 117 #endif // ENABLE_PRINT_PREVIEW |
| 117 | 118 |
| 118 #if defined(OS_WIN) | 119 #if defined(OS_WIN) |
| 119 int PrintingHandler::LoadPDF(base::File pdf_file) { | 120 int PrintingHandler::LoadPDF(base::File pdf_file) { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 printer_name, printer_info)); | 304 printer_name, printer_info)); |
| 304 } else { | 305 } else { |
| 305 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed( | 306 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed( |
| 306 printer_name)); | 307 printer_name)); |
| 307 } | 308 } |
| 308 ReleaseProcessIfNeeded(); | 309 ReleaseProcessIfNeeded(); |
| 309 } | 310 } |
| 310 #endif // ENABLE_PRINT_PREVIEW | 311 #endif // ENABLE_PRINT_PREVIEW |
| 311 | 312 |
| 312 } // namespace printing | 313 } // namespace printing |
| OLD | NEW |