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> |
| 8 |
7 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "build/build_config.h" |
8 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
9 #include "chrome/common/chrome_utility_printing_messages.h" | 12 #include "chrome/common/chrome_utility_printing_messages.h" |
10 #include "chrome/utility/cloud_print/bitmap_image.h" | 13 #include "chrome/utility/cloud_print/bitmap_image.h" |
11 #include "chrome/utility/cloud_print/pwg_encoder.h" | 14 #include "chrome/utility/cloud_print/pwg_encoder.h" |
12 #include "content/public/utility/utility_thread.h" | 15 #include "content/public/utility/utility_thread.h" |
13 #include "pdf/pdf.h" | 16 #include "pdf/pdf.h" |
14 #include "printing/page_range.h" | 17 #include "printing/page_range.h" |
15 #include "printing/pdf_render_settings.h" | 18 #include "printing/pdf_render_settings.h" |
16 | 19 |
17 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded()); | 110 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded()); |
108 } else { | 111 } else { |
109 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed()); | 112 Send(new ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed()); |
110 } | 113 } |
111 ReleaseProcessIfNeeded(); | 114 ReleaseProcessIfNeeded(); |
112 } | 115 } |
113 #endif // ENABLE_PRINT_PREVIEW | 116 #endif // ENABLE_PRINT_PREVIEW |
114 | 117 |
115 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
116 int PrintingHandler::LoadPDF(base::File pdf_file) { | 119 int PrintingHandler::LoadPDF(base::File pdf_file) { |
117 int64 length64 = pdf_file.GetLength(); | 120 int64_t length64 = pdf_file.GetLength(); |
118 if (length64 <= 0 || length64 > std::numeric_limits<int>::max()) | 121 if (length64 <= 0 || length64 > std::numeric_limits<int>::max()) |
119 return 0; | 122 return 0; |
120 int length = static_cast<int>(length64); | 123 int length = static_cast<int>(length64); |
121 | 124 |
122 pdf_data_.resize(length); | 125 pdf_data_.resize(length); |
123 if (length != pdf_file.Read(0, pdf_data_.data(), pdf_data_.size())) | 126 if (length != pdf_file.Read(0, pdf_data_.data(), pdf_data_.size())) |
124 return 0; | 127 return 0; |
125 | 128 |
126 int total_page_count = 0; | 129 int total_page_count = 0; |
127 if (!chrome_pdf::GetPDFDocInfo(&pdf_data_.front(), pdf_data_.size(), | 130 if (!chrome_pdf::GetPDFDocInfo(&pdf_data_.front(), pdf_data_.size(), |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 printer_name, printer_info)); | 303 printer_name, printer_info)); |
301 } else { | 304 } else { |
302 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed( | 305 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed( |
303 printer_name)); | 306 printer_name)); |
304 } | 307 } |
305 ReleaseProcessIfNeeded(); | 308 ReleaseProcessIfNeeded(); |
306 } | 309 } |
307 #endif // ENABLE_PRINT_PREVIEW | 310 #endif // ENABLE_PRINT_PREVIEW |
308 | 311 |
309 } // namespace printing | 312 } // namespace printing |
OLD | NEW |