| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/printing/renderer/print_web_view_helper.h" | 5 #include "components/printing/renderer/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 #endif // defined(OS_ANDROID) | 39 #endif // defined(OS_ANDROID) |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 namespace printing { | 43 namespace printing { |
| 44 | 44 |
| 45 #if defined(ENABLE_BASIC_PRINTING) | 45 #if defined(ENABLE_BASIC_PRINTING) |
| 46 bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, | 46 bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, |
| 47 int page_count) { | 47 int page_count) { |
| 48 PdfMetafileSkia metafile; | 48 PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE); |
| 49 CHECK(metafile.Init()); | 49 CHECK(metafile.Init()); |
| 50 | 50 |
| 51 const PrintMsg_PrintPages_Params& params = *print_pages_params_; | 51 const PrintMsg_PrintPages_Params& params = *print_pages_params_; |
| 52 std::vector<int> printed_pages = GetPrintedPages(params, page_count); | 52 std::vector<int> printed_pages = GetPrintedPages(params, page_count); |
| 53 if (printed_pages.empty()) | 53 if (printed_pages.empty()) |
| 54 return false; | 54 return false; |
| 55 | 55 |
| 56 PrintMsg_PrintPage_Params page_params; | 56 PrintMsg_PrintPage_Params page_params; |
| 57 page_params.params = params.params; | 57 page_params.params = params.params; |
| 58 for (int page_number : printed_pages) { | 58 for (int page_number : printed_pages) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params)); | 96 Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params)); |
| 97 // Send the rest of the pages with an invalid metafile handle. | 97 // Send the rest of the pages with an invalid metafile handle. |
| 98 printed_page_params.metafile_data_handle.fd = -1; | 98 printed_page_params.metafile_data_handle.fd = -1; |
| 99 } | 99 } |
| 100 return true; | 100 return true; |
| 101 #endif // defined(OS_ANDROID) | 101 #endif // defined(OS_ANDROID) |
| 102 } | 102 } |
| 103 #endif // defined(ENABLE_BASIC_PRINTING) | 103 #endif // defined(ENABLE_BASIC_PRINTING) |
| 104 | 104 |
| 105 } // namespace printing | 105 } // namespace printing |
| OLD | NEW |