| 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 "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 "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| 11 #include "components/printing/common/print_messages.h" | 11 #include "components/printing/common/print_messages.h" |
| 12 #include "printing/features/features.h" |
| 12 #include "printing/metafile_skia_wrapper.h" | 13 #include "printing/metafile_skia_wrapper.h" |
| 13 | 14 |
| 14 namespace printing { | 15 namespace printing { |
| 15 | 16 |
| 16 #if defined(ENABLE_BASIC_PRINTING) | 17 #if BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 17 bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame, | 18 bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame, |
| 18 int page_count) { | 19 int page_count) { |
| 19 const PrintMsg_PrintPages_Params& params = *print_pages_params_; | 20 const PrintMsg_PrintPages_Params& params = *print_pages_params_; |
| 20 std::vector<int> printed_pages = GetPrintedPages(params, page_count); | 21 std::vector<int> printed_pages = GetPrintedPages(params, page_count); |
| 21 if (printed_pages.empty()) | 22 if (printed_pages.empty()) |
| 22 return false; | 23 return false; |
| 23 | 24 |
| 24 std::vector<gfx::Size> page_size_in_dpi(printed_pages.size()); | 25 std::vector<gfx::Size> page_size_in_dpi(printed_pages.size()); |
| 25 std::vector<gfx::Rect> content_area_in_dpi(printed_pages.size()); | 26 std::vector<gfx::Rect> content_area_in_dpi(printed_pages.size()); |
| 26 | 27 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 printed_page_params.page_size = page_size_in_dpi[i]; | 60 printed_page_params.page_size = page_size_in_dpi[i]; |
| 60 printed_page_params.content_area = content_area_in_dpi[i]; | 61 printed_page_params.content_area = content_area_in_dpi[i]; |
| 61 Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params)); | 62 Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params)); |
| 62 // Send the rest of the pages with an invalid metafile handle. | 63 // Send the rest of the pages with an invalid metafile handle. |
| 63 // TODO(erikchen): Fix semantics. See https://crbug.com/640840 | 64 // TODO(erikchen): Fix semantics. See https://crbug.com/640840 |
| 64 if (printed_page_params.metafile_data_handle.IsValid()) | 65 if (printed_page_params.metafile_data_handle.IsValid()) |
| 65 printed_page_params.metafile_data_handle = base::SharedMemoryHandle(); | 66 printed_page_params.metafile_data_handle = base::SharedMemoryHandle(); |
| 66 } | 67 } |
| 67 return true; | 68 return true; |
| 68 } | 69 } |
| 69 #endif // defined(ENABLE_BASIC_PRINTING) | 70 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 70 | 71 |
| 71 } // namespace printing | 72 } // namespace printing |
| OLD | NEW |