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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 Send(new PrintHostMsg_DidPrintPage(routing_id(), page_params)); | 68 Send(new PrintHostMsg_DidPrintPage(routing_id(), page_params)); |
69 } | 69 } |
70 | 70 |
71 #if defined(ENABLE_PRINT_PREVIEW) | 71 #if defined(ENABLE_PRINT_PREVIEW) |
72 bool PrintWebViewHelper::RenderPreviewPage( | 72 bool PrintWebViewHelper::RenderPreviewPage( |
73 int page_number, | 73 int page_number, |
74 const PrintMsg_Print_Params& print_params) { | 74 const PrintMsg_Print_Params& print_params) { |
75 PrintMsg_Print_Params printParams = print_params; | 75 PrintMsg_Print_Params printParams = print_params; |
76 scoped_ptr<PdfMetafileSkia> draft_metafile; | 76 std::unique_ptr<PdfMetafileSkia> draft_metafile; |
77 PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile(); | 77 PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile(); |
78 | 78 |
79 bool render_to_draft = print_preview_context_.IsModifiable() && | 79 bool render_to_draft = print_preview_context_.IsModifiable() && |
80 is_print_ready_metafile_sent_; | 80 is_print_ready_metafile_sent_; |
81 | 81 |
82 if (render_to_draft) { | 82 if (render_to_draft) { |
83 draft_metafile.reset(new PdfMetafileSkia()); | 83 draft_metafile.reset(new PdfMetafileSkia()); |
84 CHECK(draft_metafile->Init()); | 84 CHECK(draft_metafile->Init()); |
85 initial_render_metafile = draft_metafile.get(); | 85 initial_render_metafile = draft_metafile.get(); |
86 } | 86 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 #endif // defined(ENABLE_PRINT_PREVIEW) | 149 #endif // defined(ENABLE_PRINT_PREVIEW) |
150 RenderPageContent(frame, page_number, canvas_area, content_area, | 150 RenderPageContent(frame, page_number, canvas_area, content_area, |
151 scale_factor, static_cast<blink::WebCanvas*>(canvas)); | 151 scale_factor, static_cast<blink::WebCanvas*>(canvas)); |
152 } | 152 } |
153 | 153 |
154 // Done printing. Close the device context to retrieve the compiled metafile. | 154 // Done printing. Close the device context to retrieve the compiled metafile. |
155 metafile->FinishPage(); | 155 metafile->FinishPage(); |
156 } | 156 } |
157 | 157 |
158 } // namespace printing | 158 } // namespace printing |
OLD | NEW |