Pass dpiVertical and dpiHorizontal to print settings
This commit is contained in:
parent
8b55e6e2f5
commit
d233fc044a
6 changed files with 13 additions and 9 deletions
|
@ -119,6 +119,8 @@ void PrintSettingsToJobSettings(const PrintSettings& settings,
|
||||||
job_settings->SetBoolean("rasterizePDF", false);
|
job_settings->SetBoolean("rasterizePDF", false);
|
||||||
|
|
||||||
job_settings->SetInteger("dpi", settings.dpi());
|
job_settings->SetInteger("dpi", settings.dpi());
|
||||||
|
job_settings->SetInteger("dpiHorizontal", 72);
|
||||||
|
job_settings->SetInteger("dpiVertical", 72);
|
||||||
|
|
||||||
job_settings->SetBoolean(kSettingPrintToPDF, false);
|
job_settings->SetBoolean(kSettingPrintToPDF, false);
|
||||||
job_settings->SetBoolean(kSettingCloudPrintDialog, false);
|
job_settings->SetBoolean(kSettingCloudPrintDialog, false);
|
||||||
|
|
|
@ -26,8 +26,7 @@ PrintMsg_Print_Params::PrintMsg_Print_Params()
|
||||||
display_header_footer(false),
|
display_header_footer(false),
|
||||||
title(),
|
title(),
|
||||||
url(),
|
url(),
|
||||||
should_print_backgrounds(false),
|
should_print_backgrounds(false) {
|
||||||
device_name() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintMsg_Print_Params::~PrintMsg_Print_Params() {}
|
PrintMsg_Print_Params::~PrintMsg_Print_Params() {}
|
||||||
|
@ -52,7 +51,6 @@ void PrintMsg_Print_Params::Reset() {
|
||||||
title = base::string16();
|
title = base::string16();
|
||||||
url = base::string16();
|
url = base::string16();
|
||||||
should_print_backgrounds = false;
|
should_print_backgrounds = false;
|
||||||
device_name.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintMsg_PrintPages_Params::PrintMsg_PrintPages_Params()
|
PrintMsg_PrintPages_Params::PrintMsg_PrintPages_Params()
|
||||||
|
|
|
@ -54,7 +54,6 @@ struct PrintMsg_Print_Params {
|
||||||
base::string16 title;
|
base::string16 title;
|
||||||
base::string16 url;
|
base::string16 url;
|
||||||
bool should_print_backgrounds;
|
bool should_print_backgrounds;
|
||||||
base::string16 device_name;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PrintMsg_PrintPages_Params {
|
struct PrintMsg_PrintPages_Params {
|
||||||
|
|
|
@ -705,8 +705,12 @@ void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UpdatePrintSettings(print_preview_context_.source_frame(),
|
if (!UpdatePrintSettings(print_preview_context_.source_frame(),
|
||||||
print_preview_context_.source_node(), settings)) {
|
print_preview_context_.source_node(), settings)) {
|
||||||
DidFinishPrinting(FAIL_PREVIEW);
|
if (print_preview_context_.last_error() != PREVIEW_ERROR_BAD_SETTING) {
|
||||||
|
DidFinishPrinting(INVALID_SETTINGS);
|
||||||
|
} else {
|
||||||
|
DidFinishPrinting(FAIL_PREVIEW);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
is_print_ready_metafile_sent_ = false;
|
is_print_ready_metafile_sent_ = false;
|
||||||
|
@ -796,7 +800,6 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() {
|
||||||
// Ask the browser to create the shared memory for us.
|
// Ask the browser to create the shared memory for us.
|
||||||
if (!CopyMetafileDataToSharedMem(*metafile,
|
if (!CopyMetafileDataToSharedMem(*metafile,
|
||||||
&(preview_params.metafile_data_handle))) {
|
&(preview_params.metafile_data_handle))) {
|
||||||
LOG(ERROR) << "CopyMetafileDataToSharedMem failed";
|
|
||||||
print_preview_context_.set_error(PREVIEW_ERROR_METAFILE_COPY_FAILED);
|
print_preview_context_.set_error(PREVIEW_ERROR_METAFILE_COPY_FAILED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -870,7 +873,6 @@ void PrintWebViewHelper::Print(blink::WebLocalFrame* frame,
|
||||||
|
|
||||||
// Render Pages for printing.
|
// Render Pages for printing.
|
||||||
if (!RenderPagesForPrint(frame_ref.GetFrame(), node)) {
|
if (!RenderPagesForPrint(frame_ref.GetFrame(), node)) {
|
||||||
LOG(ERROR) << "RenderPagesForPrint failed";
|
|
||||||
DidFinishPrinting(FAIL_PRINT);
|
DidFinishPrinting(FAIL_PRINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -892,7 +894,7 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FAIL_PREVIEW:
|
case FAIL_PREVIEW:
|
||||||
LOG(ERROR) << "PREVIEW FAILED.";
|
case INVALID_SETTINGS:
|
||||||
if (print_pages_params_) {
|
if (print_pages_params_) {
|
||||||
Send(new PrintHostMsg_PrintPreviewFailed(routing_id(),
|
Send(new PrintHostMsg_PrintPreviewFailed(routing_id(),
|
||||||
print_pages_params_->params.document_cookie,
|
print_pages_params_->params.document_cookie,
|
||||||
|
|
|
@ -78,6 +78,7 @@ class PrintWebViewHelper
|
||||||
FAIL_PRINT_INIT,
|
FAIL_PRINT_INIT,
|
||||||
FAIL_PRINT,
|
FAIL_PRINT,
|
||||||
FAIL_PREVIEW,
|
FAIL_PREVIEW,
|
||||||
|
INVALID_SETTINGS,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PrintPreviewErrorBuckets {
|
enum PrintPreviewErrorBuckets {
|
||||||
|
|
|
@ -73,6 +73,8 @@ const defaultPrintingSetting = {
|
||||||
generateDraftData: true,
|
generateDraftData: true,
|
||||||
fitToPageEnabled: false,
|
fitToPageEnabled: false,
|
||||||
scaleFactor: 1,
|
scaleFactor: 1,
|
||||||
|
dpiHorizontal: 72,
|
||||||
|
dpiVertical: 72,
|
||||||
rasterizePDF: false,
|
rasterizePDF: false,
|
||||||
duplex: 0,
|
duplex: 0,
|
||||||
copies: 1,
|
copies: 1,
|
||||||
|
|
Loading…
Reference in a new issue