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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 const PrintMsg_PrintPages_Params& params = *print_pages_params_; | 52 const PrintMsg_PrintPages_Params& params = *print_pages_params_; |
53 std::vector<int> printed_pages = GetPrintedPages(params, page_count); | 53 std::vector<int> printed_pages = GetPrintedPages(params, page_count); |
54 if (printed_pages.empty()) | 54 if (printed_pages.empty()) |
55 return false; | 55 return false; |
56 | 56 |
57 PrintMsg_PrintPage_Params page_params; | 57 PrintMsg_PrintPage_Params page_params; |
58 page_params.params = params.params; | 58 page_params.params = params.params; |
59 for (int page_number : printed_pages) { | 59 for (int page_number : printed_pages) { |
60 page_params.page_number = page_number; | 60 page_params.page_number = page_number; |
61 PrintPageInternal(page_params, frame, &metafile, nullptr, nullptr); | 61 PrintPageInternal(page_params, frame, &metafile, nullptr, nullptr, nullptr); |
62 } | 62 } |
63 | 63 |
64 // blink::printEnd() for PDF should be called before metafile is closed. | 64 // blink::printEnd() for PDF should be called before metafile is closed. |
65 FinishFramePrinting(); | 65 FinishFramePrinting(); |
66 | 66 |
67 metafile.FinishDocument(); | 67 metafile.FinishDocument(); |
68 | 68 |
69 #if defined(OS_ANDROID) | 69 #if defined(OS_ANDROID) |
70 int sequence_number = -1; | 70 int sequence_number = -1; |
71 base::FileDescriptor fd; | 71 base::FileDescriptor fd; |
(...skipping 25 matching lines...) Expand all Loading... |
97 Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params)); | 97 Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params)); |
98 // Send the rest of the pages with an invalid metafile handle. | 98 // Send the rest of the pages with an invalid metafile handle. |
99 printed_page_params.metafile_data_handle.fd = -1; | 99 printed_page_params.metafile_data_handle.fd = -1; |
100 } | 100 } |
101 return true; | 101 return true; |
102 #endif // defined(OS_ANDROID) | 102 #endif // defined(OS_ANDROID) |
103 } | 103 } |
104 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) | 104 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) |
105 | 105 |
106 } // namespace printing | 106 } // namespace printing |
OLD | NEW |