| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 preview_page_count_, | 120 preview_page_count_, |
| 121 render_time, | 121 render_time, |
| 122 base::TimeTicks::Now() - begin_time); | 122 base::TimeTicks::Now() - begin_time); |
| 123 | 123 |
| 124 PrintHostMsg_DidPreviewDocument_Params preview_params; | 124 PrintHostMsg_DidPreviewDocument_Params preview_params; |
| 125 preview_params.reuse_existing_data = false; | 125 preview_params.reuse_existing_data = false; |
| 126 preview_params.data_size = metafile.GetDataSize(); | 126 preview_params.data_size = metafile.GetDataSize(); |
| 127 preview_params.document_cookie = params.params.document_cookie; | 127 preview_params.document_cookie = params.params.document_cookie; |
| 128 preview_params.expected_pages_count = preview_page_count_; | 128 preview_params.expected_pages_count = preview_page_count_; |
| 129 preview_params.modifiable = IsModifiable(frame, node); | 129 preview_params.modifiable = IsModifiable(frame, node); |
| 130 preview_params.preview_request_id = params.params.preview_request_id; |
| 130 | 131 |
| 131 // Ask the browser to create the shared memory for us. | 132 // Ask the browser to create the shared memory for us. |
| 132 if (!CopyMetafileDataToSharedMem(&metafile, | 133 if (!CopyMetafileDataToSharedMem(&metafile, |
| 133 &(preview_params.metafile_data_handle))) { | 134 &(preview_params.metafile_data_handle))) { |
| 134 return false; | 135 return false; |
| 135 } | 136 } |
| 136 Send(new PrintHostMsg_PagesReadyForPreview(routing_id(), preview_params)); | 137 Send(new PrintHostMsg_PagesReadyForPreview(routing_id(), preview_params)); |
| 137 return true; | 138 return true; |
| 138 } | 139 } |
| 139 | 140 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 162 base::mac::ScopedNSAutoreleasePool pool; | 163 base::mac::ScopedNSAutoreleasePool pool; |
| 163 CGContextRef cgContext = metafile->context(); | 164 CGContextRef cgContext = metafile->context(); |
| 164 CGContextRef canvasPtr = cgContext; | 165 CGContextRef canvasPtr = cgContext; |
| 165 #endif | 166 #endif |
| 166 frame->printPage(page_number, canvasPtr); | 167 frame->printPage(page_number, canvasPtr); |
| 167 } | 168 } |
| 168 | 169 |
| 169 // Done printing. Close the device context to retrieve the compiled metafile. | 170 // Done printing. Close the device context to retrieve the compiled metafile. |
| 170 metafile->FinishPage(); | 171 metafile->FinishPage(); |
| 171 } | 172 } |
| OLD | NEW |