Chromium Code Reviews| Index: content/renderer/pepper/pepper_plugin_instance_impl.cc |
| diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
| index c039d254d2bef13c6a7e6c3998a6a8293b7c5b52..8d0fab2fe9bc391dfd3e4f45a1603b10b1213118 100644 |
| --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc |
| +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
| @@ -1767,23 +1767,31 @@ void PepperPluginInstanceImpl::ReportGeometry() { |
| } |
| bool PepperPluginInstanceImpl::GetPreferredPrintOutputFormat( |
| - PP_PrintOutputFormat_Dev* format) { |
| + PP_PrintOutputFormat_Dev* format, |
| + const WebPrintParams& print_params) { |
| // Keep a reference on the stack. See NOTE above. |
| scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| if (!LoadPrintInterface()) |
| return false; |
| uint32_t supported_formats = |
| plugin_print_interface_->QuerySupportedFormats(pp_instance()); |
| - if (supported_formats & PP_PRINTOUTPUTFORMAT_PDF) { |
| + if ((supported_formats & PP_PRINTOUTPUTFORMAT_PDF) && |
| + !print_params.rasterizePDF) { |
| *format = PP_PRINTOUTPUTFORMAT_PDF; |
| return true; |
| } |
| + if (supported_formats & PP_PRINTOUTPUTFORMAT_RASTER) { |
| + *format = PP_PRINTOUTPUTFORMAT_RASTER; |
| + return true; |
| + } |
| return false; |
| } |
| bool PepperPluginInstanceImpl::SupportsPrintInterface() { |
| PP_PrintOutputFormat_Dev format; |
| - return GetPreferredPrintOutputFormat(&format); |
| + WebPrintParams params; |
| + params.rasterizePDF = false; |
|
Lei Zhang
2017/02/25 01:01:16
BTW, this is already initialized to false in the m
|
| + return GetPreferredPrintOutputFormat(&format, params); |
| } |
| bool PepperPluginInstanceImpl::IsPrintScalingDisabled() { |
| @@ -1797,7 +1805,7 @@ int PepperPluginInstanceImpl::PrintBegin(const WebPrintParams& print_params) { |
| // Keep a reference on the stack. See NOTE above. |
| scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| PP_PrintOutputFormat_Dev format; |
| - if (!GetPreferredPrintOutputFormat(&format)) { |
| + if (!GetPreferredPrintOutputFormat(&format, print_params)) { |
| // PrintBegin should not have been called since SupportsPrintInterface |
| // would have returned false; |
| NOTREACHED(); |
| @@ -1859,7 +1867,8 @@ void PepperPluginInstanceImpl::PrintPageHelper( |
| if (!print_output) |
| return; |
| - if (current_print_settings_.format == PP_PRINTOUTPUTFORMAT_PDF) |
| + if (current_print_settings_.format == PP_PRINTOUTPUTFORMAT_PDF || |
| + current_print_settings_.format == PP_PRINTOUTPUTFORMAT_RASTER) |
| PrintPDFOutput(print_output, metafile); |
| // Now we need to release the print output resource. |