OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/mock_printer.h" | 5 #include "chrome/renderer/printing/mock_printer.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/common/print_messages.h" | 12 #include "chrome/common/print_messages.h" |
13 #include "ipc/ipc_message_utils.h" | 13 #include "ipc/ipc_message_utils.h" |
14 #include "printing/metafile_impl.h" | 14 #include "printing/pdf_metafile_skia.h" |
15 #include "printing/units.h" | 15 #include "printing/units.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
19 #include "printing/pdf_metafile_cg_mac.h" | 19 #include "printing/pdf_metafile_cg_mac.h" |
20 #endif | 20 #endif |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 void UpdateMargins(int margins_type, int dpi, PrintMsg_Print_Params* params) { | 24 void UpdateMargins(int margins_type, int dpi, PrintMsg_Print_Params* params) { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 #if defined(OS_WIN) | 209 #if defined(OS_WIN) |
210 base::SharedMemory metafile_data(params.metafile_data_handle, true, | 210 base::SharedMemory metafile_data(params.metafile_data_handle, true, |
211 GetCurrentProcess()); | 211 GetCurrentProcess()); |
212 #elif defined(OS_MACOSX) | 212 #elif defined(OS_MACOSX) |
213 base::SharedMemory metafile_data(params.metafile_data_handle, true); | 213 base::SharedMemory metafile_data(params.metafile_data_handle, true); |
214 #endif | 214 #endif |
215 metafile_data.Map(params.data_size); | 215 metafile_data.Map(params.data_size); |
216 #if defined(OS_MACOSX) | 216 #if defined(OS_MACOSX) |
217 printing::PdfMetafileCg metafile; | 217 printing::PdfMetafileCg metafile; |
218 #else | 218 #else |
219 printing::NativeMetafile metafile; | 219 printing::PdfMetafileSkia metafile; |
220 #endif | 220 #endif |
221 metafile.InitFromData(metafile_data.memory(), params.data_size); | 221 metafile.InitFromData(metafile_data.memory(), params.data_size); |
222 printing::Image image(metafile); | 222 printing::Image image(metafile); |
223 MockPrinterPage* page_data = new MockPrinterPage(metafile_data.memory(), | 223 MockPrinterPage* page_data = new MockPrinterPage(metafile_data.memory(), |
224 params.data_size, | 224 params.data_size, |
225 image); | 225 image); |
226 scoped_refptr<MockPrinterPage> page(page_data); | 226 scoped_refptr<MockPrinterPage> page(page_data); |
227 pages_.push_back(page); | 227 pages_.push_back(page); |
228 #endif | 228 #endif |
229 | 229 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 params->margin_left = margin_left_; | 305 params->margin_left = margin_left_; |
306 params->margin_top = margin_top_; | 306 params->margin_top = margin_top_; |
307 params->is_first_request = is_first_request_; | 307 params->is_first_request = is_first_request_; |
308 params->print_scaling_option = print_scaling_option_; | 308 params->print_scaling_option = print_scaling_option_; |
309 params->print_to_pdf = print_to_pdf_; | 309 params->print_to_pdf = print_to_pdf_; |
310 params->preview_request_id = preview_request_id_; | 310 params->preview_request_id = preview_request_id_; |
311 params->display_header_footer = display_header_footer_; | 311 params->display_header_footer = display_header_footer_; |
312 params->title = title_; | 312 params->title = title_; |
313 params->url = url_; | 313 params->url = url_; |
314 } | 314 } |
OLD | NEW |