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/browser/printing/printing_message_filter.h" | 5 #include "chrome/browser/printing/printing_message_filter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 static base::LazyInstance<PrintingSequencePathMap> | 40 static base::LazyInstance<PrintingSequencePathMap> |
41 g_printing_file_descriptor_map(base::LINKER_INITIALIZED); | 41 g_printing_file_descriptor_map(base::LINKER_INITIALIZED); |
42 #endif | 42 #endif |
43 | 43 |
44 void RenderParamsFromPrintSettings(const printing::PrintSettings& settings, | 44 void RenderParamsFromPrintSettings(const printing::PrintSettings& settings, |
45 PrintMsg_Print_Params* params) { | 45 PrintMsg_Print_Params* params) { |
46 params->page_size = settings.page_setup_device_units().physical_size(); | 46 params->page_size = settings.page_setup_device_units().physical_size(); |
47 params->printable_size.SetSize( | 47 params->printable_size.SetSize( |
48 settings.page_setup_device_units().content_area().width(), | 48 settings.page_setup_device_units().content_area().width(), |
49 settings.page_setup_device_units().content_area().height()); | 49 settings.page_setup_device_units().content_area().height()); |
50 params->margin_top = settings.page_setup_device_units().content_area().x(); | 50 params->margin_top = settings.page_setup_device_units().content_area().y(); |
vandebo (ex-Chrome)
2011/10/08 01:27:24
This is a long outstanding bug, that apparently ha
| |
51 params->margin_left = settings.page_setup_device_units().content_area().y(); | 51 params->margin_left = settings.page_setup_device_units().content_area().x(); |
52 params->dpi = settings.dpi(); | 52 params->dpi = settings.dpi(); |
53 // Currently hardcoded at 1.25. See PrintSettings' constructor. | 53 // Currently hardcoded at 1.25. See PrintSettings' constructor. |
54 params->min_shrink = settings.min_shrink; | 54 params->min_shrink = settings.min_shrink; |
55 // Currently hardcoded at 2.0. See PrintSettings' constructor. | 55 // Currently hardcoded at 2.0. See PrintSettings' constructor. |
56 params->max_shrink = settings.max_shrink; | 56 params->max_shrink = settings.max_shrink; |
57 // Currently hardcoded at 72dpi. See PrintSettings' constructor. | 57 // Currently hardcoded at 72dpi. See PrintSettings' constructor. |
58 params->desired_dpi = settings.desired_dpi; | 58 params->desired_dpi = settings.desired_dpi; |
59 // Always use an invalid cookie. | 59 // Always use an invalid cookie. |
60 params->document_cookie = 0; | 60 params->document_cookie = 0; |
61 params->selection_only = settings.selection_only; | 61 params->selection_only = settings.selection_only; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 this, | 199 this, |
200 &PrintingMessageFilter::OnGetDefaultPrintSettingsReply, | 200 &PrintingMessageFilter::OnGetDefaultPrintSettingsReply, |
201 printer_query, | 201 printer_query, |
202 reply_msg); | 202 reply_msg); |
203 // Loads default settings. This is asynchronous, only the IPC message sender | 203 // Loads default settings. This is asynchronous, only the IPC message sender |
204 // will hang until the settings are retrieved. | 204 // will hang until the settings are retrieved. |
205 printer_query->GetSettings(printing::PrinterQuery::DEFAULTS, | 205 printer_query->GetSettings(printing::PrinterQuery::DEFAULTS, |
206 NULL, | 206 NULL, |
207 0, | 207 0, |
208 false, | 208 false, |
209 true, | 209 printing::DEFAULT_MARGINS, |
210 task); | 210 task); |
211 } | 211 } |
212 | 212 |
213 void PrintingMessageFilter::OnGetDefaultPrintSettingsReply( | 213 void PrintingMessageFilter::OnGetDefaultPrintSettingsReply( |
214 scoped_refptr<printing::PrinterQuery> printer_query, | 214 scoped_refptr<printing::PrinterQuery> printer_query, |
215 IPC::Message* reply_msg) { | 215 IPC::Message* reply_msg) { |
216 PrintMsg_Print_Params params; | 216 PrintMsg_Print_Params params; |
217 if (!printer_query.get() || | 217 if (!printer_query.get() || |
218 printer_query->last_status() != printing::PrintingContext::OK) { | 218 printer_query->last_status() != printing::PrintingContext::OK) { |
219 params.Reset(); | 219 params.Reset(); |
(...skipping 30 matching lines...) Expand all Loading... | |
250 this, | 250 this, |
251 &PrintingMessageFilter::OnScriptedPrintReply, | 251 &PrintingMessageFilter::OnScriptedPrintReply, |
252 printer_query, | 252 printer_query, |
253 params.routing_id, | 253 params.routing_id, |
254 reply_msg); | 254 reply_msg); |
255 | 255 |
256 printer_query->GetSettings(printing::PrinterQuery::ASK_USER, | 256 printer_query->GetSettings(printing::PrinterQuery::ASK_USER, |
257 host_view, | 257 host_view, |
258 params.expected_pages_count, | 258 params.expected_pages_count, |
259 params.has_selection, | 259 params.has_selection, |
260 params.use_overlays, | 260 params.margin_type, |
261 task); | 261 task); |
262 } | 262 } |
263 | 263 |
264 void PrintingMessageFilter::OnScriptedPrintReply( | 264 void PrintingMessageFilter::OnScriptedPrintReply( |
265 scoped_refptr<printing::PrinterQuery> printer_query, | 265 scoped_refptr<printing::PrinterQuery> printer_query, |
266 int routing_id, | 266 int routing_id, |
267 IPC::Message* reply_msg) { | 267 IPC::Message* reply_msg) { |
268 PrintMsg_PrintPages_Params params; | 268 PrintMsg_PrintPages_Params params; |
269 if (printer_query->last_status() != printing::PrintingContext::OK || | 269 if (printer_query->last_status() != printing::PrintingContext::OK || |
270 !printer_query->settings().dpi()) { | 270 !printer_query->settings().dpi()) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 void PrintingMessageFilter::OnCheckForCancel(const std::string& preview_ui_addr, | 332 void PrintingMessageFilter::OnCheckForCancel(const std::string& preview_ui_addr, |
333 int preview_request_id, | 333 int preview_request_id, |
334 bool* cancel) { | 334 bool* cancel) { |
335 PrintPreviewUI::GetCurrentPrintPreviewStatus(preview_ui_addr, | 335 PrintPreviewUI::GetCurrentPrintPreviewStatus(preview_ui_addr, |
336 preview_request_id, | 336 preview_request_id, |
337 cancel); | 337 cancel); |
338 } | 338 } |
OLD | NEW |