Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: components/printing/renderer/print_web_view_helper_pdf_win.cc

Issue 2064843002: PdfMetafileSkia: start supporting more document types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-15 (Wednesday) 10:43:48 EDT Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/metafile_skia_wrapper.h" 12 #include "printing/metafile_skia_wrapper.h"
13 13
14 namespace printing { 14 namespace printing {
15 15
16 #if defined(ENABLE_BASIC_PRINTING) 16 #if defined(ENABLE_BASIC_PRINTING)
17 bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, 17 bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
18 int page_count) { 18 int page_count) {
19 const PrintMsg_PrintPages_Params& params = *print_pages_params_; 19 const PrintMsg_PrintPages_Params& params = *print_pages_params_;
20 std::vector<int> printed_pages = GetPrintedPages(params, page_count); 20 std::vector<int> printed_pages = GetPrintedPages(params, page_count);
21 if (printed_pages.empty()) 21 if (printed_pages.empty())
22 return false; 22 return false;
23 23
24 std::vector<gfx::Size> page_size_in_dpi(printed_pages.size()); 24 std::vector<gfx::Size> page_size_in_dpi(printed_pages.size());
25 std::vector<gfx::Rect> content_area_in_dpi(printed_pages.size()); 25 std::vector<gfx::Rect> content_area_in_dpi(printed_pages.size());
26 26
27 PdfMetafileSkia metafile; 27 PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
28 CHECK(metafile.Init()); 28 CHECK(metafile.Init());
29 29
30 PrintMsg_PrintPage_Params page_params; 30 PrintMsg_PrintPage_Params page_params;
31 page_params.params = params.params; 31 page_params.params = params.params;
32 for (size_t i = 0; i < printed_pages.size(); ++i) { 32 for (size_t i = 0; i < printed_pages.size(); ++i) {
33 page_params.page_number = printed_pages[i]; 33 page_params.page_number = printed_pages[i];
34 PrintPageInternal(page_params, 34 PrintPageInternal(page_params,
35 frame, 35 frame,
36 &metafile, 36 &metafile,
37 &page_size_in_dpi[i], 37 &page_size_in_dpi[i],
(...skipping 25 matching lines...) Expand all
63 if (printed_page_params.metafile_data_handle.IsValid()) { 63 if (printed_page_params.metafile_data_handle.IsValid()) {
64 printed_page_params.metafile_data_handle.Close(); 64 printed_page_params.metafile_data_handle.Close();
65 printed_page_params.metafile_data_handle = base::SharedMemoryHandle(); 65 printed_page_params.metafile_data_handle = base::SharedMemoryHandle();
66 } 66 }
67 } 67 }
68 return true; 68 return true;
69 } 69 }
70 #endif // defined(ENABLE_BASIC_PRINTING) 70 #endif // defined(ENABLE_BASIC_PRINTING)
71 71
72 } // namespace printing 72 } // namespace printing
OLDNEW
« no previous file with comments | « components/printing/renderer/print_web_view_helper_mac.mm ('k') | components/printing/test/mock_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698