diff options
author | n.bansal@samsung.com <n.bansal@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 08:29:21 +0000 |
---|---|---|
committer | n.bansal@samsung.com <n.bansal@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 08:29:21 +0000 |
commit | 87d1a3920b5dcb2d79c150a290d24389d837f999 (patch) | |
tree | 01ce08b38a28098274829d5a160acbef6a3b31d1 /chrome/renderer/printing | |
parent | 785e6a4588a9223280764bef6474ac0bcf87c4da (diff) | |
download | chromium_src-87d1a3920b5dcb2d79c150a290d24389d837f999.zip chromium_src-87d1a3920b5dcb2d79c150a290d24389d837f999.tar.gz chromium_src-87d1a3920b5dcb2d79c150a290d24389d837f999.tar.bz2 |
Add support to send print preset options in one message
This patch introduces structure that should be filled with all
print preset options that we need to get from PDF and set in print
preview.
Before this patch one message was being sent to browser to set PrintScaling
property but going forward, more properties will be supported and so
it is better to send only one message with all properties set in one structure.
BUG=169120
Review URL: https://codereview.chromium.org/388783003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285159 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/printing')
-rw-r--r-- | chrome/renderer/printing/print_web_view_helper.cc | 19 | ||||
-rw-r--r-- | chrome/renderer/printing/print_web_view_helper.h | 5 |
2 files changed, 19 insertions, 5 deletions
diff --git a/chrome/renderer/printing/print_web_view_helper.cc b/chrome/renderer/printing/print_web_view_helper.cc index 76db584..777eb69 100644 --- a/chrome/renderer/printing/print_web_view_helper.cc +++ b/chrome/renderer/printing/print_web_view_helper.cc @@ -1025,13 +1025,13 @@ void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) { return; } - // If we are previewing a pdf and the print scaling is disabled, send a + // Set the options from document if we are previewing a pdf and send a // message to browser. if (print_pages_params_->params.is_first_request && - !print_preview_context_.IsModifiable() && - print_preview_context_.source_frame()->isPrintScalingDisabledForPlugin( - print_preview_context_.source_node())) { - Send(new PrintHostMsg_PrintPreviewScalingDisabled(routing_id())); + !print_preview_context_.IsModifiable()) { + PrintHostMsg_SetOptionsFromDocument_Params params; + SetOptionsFromDocument(params); + Send(new PrintHostMsg_SetOptionsFromDocument(routing_id(), params)); } is_print_ready_metafile_sent_ = false; @@ -1466,6 +1466,15 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, return true; } +void PrintWebViewHelper::SetOptionsFromDocument( + PrintHostMsg_SetOptionsFromDocument_Params& params) { + blink::WebLocalFrame* source_frame = print_preview_context_.source_frame(); + const blink::WebNode& source_node = print_preview_context_.source_node(); + + params.is_scaling_disabled = + source_frame->isPrintScalingDisabledForPlugin(source_node); +} + bool PrintWebViewHelper::UpdatePrintSettings( blink::WebLocalFrame* frame, const blink::WebNode& node, diff --git a/chrome/renderer/printing/print_web_view_helper.h b/chrome/renderer/printing/print_web_view_helper.h index d16e683..71ff88c 100644 --- a/chrome/renderer/printing/print_web_view_helper.h +++ b/chrome/renderer/printing/print_web_view_helper.h @@ -23,6 +23,7 @@ struct PrintMsg_Print_Params; struct PrintMsg_PrintPage_Params; struct PrintMsg_PrintPages_Params; +struct PrintHostMsg_SetOptionsFromDocument_Params; namespace base { class DictionaryValue; @@ -178,6 +179,10 @@ class PrintWebViewHelper const blink::WebNode& node, int* number_of_pages); + // Set options for print preset from source PDF document. + void SetOptionsFromDocument( + PrintHostMsg_SetOptionsFromDocument_Params& params); + // Update the current print settings with new |passed_job_settings|. // |passed_job_settings| dictionary contains print job details such as printer // name, number of copies, page range, etc. |