| 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 "chrome/renderer/printing/print_web_view_helper.h" | 5 #include "chrome/renderer/printing/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 bool PrintWebViewHelper::FinalizePrintReadyDocument() { | 1088 bool PrintWebViewHelper::FinalizePrintReadyDocument() { |
| 1089 DCHECK(!is_print_ready_metafile_sent_); | 1089 DCHECK(!is_print_ready_metafile_sent_); |
| 1090 print_preview_context_.FinalizePrintReadyDocument(); | 1090 print_preview_context_.FinalizePrintReadyDocument(); |
| 1091 | 1091 |
| 1092 // Get the size of the resulting metafile. | 1092 // Get the size of the resulting metafile. |
| 1093 PreviewMetafile* metafile = print_preview_context_.metafile(); | 1093 PreviewMetafile* metafile = print_preview_context_.metafile(); |
| 1094 uint32 buf_size = metafile->GetDataSize(); | 1094 uint32 buf_size = metafile->GetDataSize(); |
| 1095 DCHECK_GT(buf_size, 0u); | 1095 DCHECK_GT(buf_size, 0u); |
| 1096 | 1096 |
| 1097 PrintHostMsg_DidPreviewDocument_Params preview_params; | 1097 PrintHostMsg_DidPreviewDocument_Params preview_params; |
| 1098 preview_params.reuse_existing_data = false; | |
| 1099 preview_params.data_size = buf_size; | 1098 preview_params.data_size = buf_size; |
| 1100 preview_params.document_cookie = print_pages_params_->params.document_cookie; | 1099 preview_params.document_cookie = print_pages_params_->params.document_cookie; |
| 1101 preview_params.expected_pages_count = | 1100 preview_params.expected_pages_count = |
| 1102 print_preview_context_.total_page_count(); | 1101 print_preview_context_.total_page_count(); |
| 1103 preview_params.modifiable = print_preview_context_.IsModifiable(); | 1102 preview_params.modifiable = print_preview_context_.IsModifiable(); |
| 1104 preview_params.preview_request_id = | 1103 preview_params.preview_request_id = |
| 1105 print_pages_params_->params.preview_request_id; | 1104 print_pages_params_->params.preview_request_id; |
| 1106 | 1105 |
| 1107 // Ask the browser to create the shared memory for us. | 1106 // Ask the browser to create the shared memory for us. |
| 1108 if (!CopyMetafileDataToSharedMem(metafile, | 1107 if (!CopyMetafileDataToSharedMem(metafile, |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1964 } | 1963 } |
| 1965 | 1964 |
| 1966 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 1965 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
| 1967 prep_frame_view_.reset(); | 1966 prep_frame_view_.reset(); |
| 1968 metafile_.reset(); | 1967 metafile_.reset(); |
| 1969 pages_to_render_.clear(); | 1968 pages_to_render_.clear(); |
| 1970 error_ = PREVIEW_ERROR_NONE; | 1969 error_ = PREVIEW_ERROR_NONE; |
| 1971 } | 1970 } |
| 1972 | 1971 |
| 1973 } // namespace printing | 1972 } // namespace printing |
| OLD | NEW |