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