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

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

Issue 2829973002: add customized printing setting for headless (Closed)
Patch Set: add skia as public_deps instead Created 3 years, 7 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"
(...skipping 12 matching lines...) Expand all
23 return false; 23 return false;
24 24
25 std::vector<gfx::Size> page_size_in_dpi(printed_pages.size()); 25 std::vector<gfx::Size> page_size_in_dpi(printed_pages.size());
26 std::vector<gfx::Rect> content_area_in_dpi(printed_pages.size()); 26 std::vector<gfx::Rect> content_area_in_dpi(printed_pages.size());
27 std::vector<gfx::Rect> printable_area_in_dpi(printed_pages.size()); 27 std::vector<gfx::Rect> printable_area_in_dpi(printed_pages.size());
28 28
29 PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE); 29 PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
30 CHECK(metafile.Init()); 30 CHECK(metafile.Init());
31 31
32 for (size_t i = 0; i < printed_pages.size(); ++i) { 32 for (size_t i = 0; i < printed_pages.size(); ++i) {
33 PrintPageInternal(params.params, printed_pages[i], frame, &metafile, 33 PrintPageInternal(params.params, printed_pages[i], page_count, frame,
34 &page_size_in_dpi[i], &content_area_in_dpi[i], 34 &metafile, &page_size_in_dpi[i], &content_area_in_dpi[i],
35 &printable_area_in_dpi[i]); 35 &printable_area_in_dpi[i]);
36 } 36 }
37 37
38 // blink::printEnd() for PDF should be called before metafile is closed. 38 // blink::printEnd() for PDF should be called before metafile is closed.
39 FinishFramePrinting(); 39 FinishFramePrinting();
40 40
41 metafile.FinishDocument(); 41 metafile.FinishDocument();
42 42
43 PrintHostMsg_DidPrintPage_Params printed_page_params; 43 PrintHostMsg_DidPrintPage_Params printed_page_params;
44 if (!CopyMetafileDataToSharedMem( 44 if (!CopyMetafileDataToSharedMem(
(...skipping 16 matching lines...) Expand all
61 // Send the rest of the pages with an invalid metafile handle. 61 // Send the rest of the pages with an invalid metafile handle.
62 // TODO(erikchen): Fix semantics. See https://crbug.com/640840 62 // TODO(erikchen): Fix semantics. See https://crbug.com/640840
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 = base::SharedMemoryHandle(); 64 printed_page_params.metafile_data_handle = base::SharedMemoryHandle();
65 } 65 }
66 return true; 66 return true;
67 } 67 }
68 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) 68 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
69 69
70 } // namespace printing 70 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698