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 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 gfx::Rect canvas_area = | 117 gfx::Rect canvas_area = |
118 params.display_header_footer ? gfx::Rect(*page_size) : content_area; | 118 params.display_header_footer ? gfx::Rect(*page_size) : content_area; |
119 | 119 |
120 { | 120 { |
121 skia::PlatformCanvas* canvas = metafile->GetVectorCanvasForNewPage( | 121 skia::PlatformCanvas* canvas = metafile->GetVectorCanvasForNewPage( |
122 *page_size, canvas_area, scale_factor); | 122 *page_size, canvas_area, scale_factor); |
123 if (!canvas) | 123 if (!canvas) |
124 return; | 124 return; |
125 | 125 |
126 MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); | 126 MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); |
127 skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_); | |
128 skia::SetIsPreviewMetafile(*canvas, is_preview); | 127 skia::SetIsPreviewMetafile(*canvas, is_preview); |
129 #if defined(ENABLE_PRINT_PREVIEW) | 128 #if defined(ENABLE_PRINT_PREVIEW) |
130 if (params.display_header_footer) { | 129 if (params.display_header_footer) { |
131 PrintHeaderAndFooter(static_cast<blink::WebCanvas*>(canvas), | 130 PrintHeaderAndFooter(static_cast<blink::WebCanvas*>(canvas), |
132 page_number + 1, | 131 page_number + 1, |
133 print_preview_context_.total_page_count(), *frame, | 132 print_preview_context_.total_page_count(), *frame, |
134 scale_factor, page_layout_in_points, params); | 133 scale_factor, page_layout_in_points, params); |
135 } | 134 } |
136 #endif // defined(ENABLE_PRINT_PREVIEW) | 135 #endif // defined(ENABLE_PRINT_PREVIEW) |
137 RenderPageContent(frame, page_number, canvas_area, content_area, | 136 RenderPageContent(frame, page_number, canvas_area, content_area, |
138 scale_factor, static_cast<blink::WebCanvas*>(canvas)); | 137 scale_factor, static_cast<blink::WebCanvas*>(canvas)); |
139 } | 138 } |
140 | 139 |
141 // Done printing. Close the device context to retrieve the compiled metafile. | 140 // Done printing. Close the device context to retrieve the compiled metafile. |
142 metafile->FinishPage(); | 141 metafile->FinishPage(); |
143 } | 142 } |
144 | 143 |
145 } // namespace printing | 144 } // namespace printing |
OLD | NEW |