OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Get the size of the compiled metafile. | 63 // Get the size of the compiled metafile. |
64 ViewHostMsg_DidPrintPage_Params page_params; | 64 ViewHostMsg_DidPrintPage_Params page_params; |
65 page_params.data_size = 0; | 65 page_params.data_size = 0; |
66 page_params.page_number = params.page_number; | 66 page_params.page_number = params.page_number; |
67 page_params.document_cookie = params.params.document_cookie; | 67 page_params.document_cookie = params.params.document_cookie; |
68 page_params.actual_shrink = scale_factor; | 68 page_params.actual_shrink = scale_factor; |
69 base::SharedMemory shared_buf; | 69 base::SharedMemory shared_buf; |
70 | 70 |
71 page_params.page_size = gfx::Size( | 71 page_params.page_size = gfx::Size( |
72 static_cast<int>(content_width_in_points | 72 static_cast<int>(content_width_in_points + |
73 + margin_left_in_points + margin_right_in_points), | 73 margin_left_in_points + margin_right_in_points), |
74 static_cast<int>(content_height_in_points | 74 static_cast<int>(content_height_in_points + |
75 + margin_top_in_points + margin_bottom_in_points)); | 75 margin_top_in_points + margin_bottom_in_points)); |
76 page_params.content_area = gfx::Rect( | 76 page_params.content_area = gfx::Rect( |
77 static_cast<int>(margin_left_in_points), | 77 static_cast<int>(margin_left_in_points), |
78 static_cast<int>(margin_top_in_points), | 78 static_cast<int>(margin_top_in_points), |
79 static_cast<int>(content_width_in_points), | 79 static_cast<int>(content_width_in_points), |
80 static_cast<int>(content_height_in_points)); | 80 static_cast<int>(content_height_in_points)); |
81 | 81 |
82 // Ask the browser to create the shared memory for us. | 82 // Ask the browser to create the shared memory for us. |
83 uint32 buf_size = metafile.GetDataSize(); | 83 uint32 buf_size = metafile.GetDataSize(); |
84 base::SharedMemoryHandle shared_mem_handle; | 84 base::SharedMemoryHandle shared_mem_handle; |
85 if (Send(new ViewHostMsg_AllocatePDFTransport(routing_id(), buf_size, | 85 if (Send(new ViewHostMsg_AllocatePDFTransport(routing_id(), buf_size, |
(...skipping 11 matching lines...) Expand all Loading... |
97 } else { | 97 } else { |
98 NOTREACHED() << "Browser failed to allocate shared memory"; | 98 NOTREACHED() << "Browser failed to allocate shared memory"; |
99 } | 99 } |
100 } else { | 100 } else { |
101 NOTREACHED() << "Browser allocation request message failed"; | 101 NOTREACHED() << "Browser allocation request message failed"; |
102 } | 102 } |
103 | 103 |
104 Send(new ViewHostMsg_DidPrintPage(routing_id(), page_params)); | 104 Send(new ViewHostMsg_DidPrintPage(routing_id(), page_params)); |
105 } | 105 } |
106 | 106 |
OLD | NEW |