| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/renderer/print_web_view_helper.h" | 5 #include "chrome/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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 printParams.printable_size.width(), | 67 printParams.printable_size.width(), |
| 68 printParams.printable_size.height()); | 68 printParams.printable_size.height()); |
| 69 | 69 |
| 70 printing::Metafile* initial_render_metafile = | 70 printing::Metafile* initial_render_metafile = |
| 71 print_preview_context_.metafile(); | 71 print_preview_context_.metafile(); |
| 72 scoped_ptr<printing::PreviewMetafile> draft_metafile; | 72 scoped_ptr<printing::PreviewMetafile> draft_metafile; |
| 73 #if !defined(USE_SKIA) | 73 #if !defined(USE_SKIA) |
| 74 if (print_preview_context_.IsModifiable()) { | 74 if (print_preview_context_.IsModifiable()) { |
| 75 draft_metafile.reset(new printing::PreviewMetafile); | 75 draft_metafile.reset(new printing::PreviewMetafile); |
| 76 if (!draft_metafile->Init()) { | 76 if (!draft_metafile->Init()) { |
| 77 LOG(ERROR) << "Draft PreviewMetafile Init failed"; |
| 77 return false; | 78 return false; |
| 78 } | 79 } |
| 79 initial_render_metafile = draft_metafile.get(); | 80 initial_render_metafile = draft_metafile.get(); |
| 80 } | 81 } |
| 81 #endif | 82 #endif |
| 82 | 83 |
| 83 base::TimeTicks begin_time = base::TimeTicks::Now(); | 84 base::TimeTicks begin_time = base::TimeTicks::Now(); |
| 84 RenderPage(printParams.page_size, content_area, scale_factor, page_number, | 85 RenderPage(printParams.page_size, content_area, scale_factor, page_number, |
| 85 print_preview_context_.frame(), initial_render_metafile); | 86 print_preview_context_.frame(), initial_render_metafile); |
| 86 print_preview_context_.RenderedPreviewPage( | 87 print_preview_context_.RenderedPreviewPage( |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 print_preview_context_.total_page_count(), | 177 print_preview_context_.total_page_count(), |
| 177 scale_factor, page_layout_in_points, | 178 scale_factor, page_layout_in_points, |
| 178 *header_footer_info_); | 179 *header_footer_info_); |
| 179 } | 180 } |
| 180 #endif // defined(USE_SKIA) | 181 #endif // defined(USE_SKIA) |
| 181 } | 182 } |
| 182 | 183 |
| 183 // Done printing. Close the device context to retrieve the compiled metafile. | 184 // Done printing. Close the device context to retrieve the compiled metafile. |
| 184 metafile->FinishPage(); | 185 metafile->FinishPage(); |
| 185 } | 186 } |
| OLD | NEW |