Index: chrome/renderer/print_web_view_helper.cc |
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc |
index 7114a5dac9d38511fbb993cdef41e084393f8cd4..0f7bafa483799a5032b813605d3484f73978b48f 100644 |
--- a/chrome/renderer/print_web_view_helper.cc |
+++ b/chrome/renderer/print_web_view_helper.cc |
@@ -143,77 +143,6 @@ void CalculatePrintCanvasSize(const PrintMsg_Print_Params& print_params, |
print_params.desired_dpi)); |
} |
-// Get the margins option selected and set custom margins appropriately. |
-void SetCustomMarginsIfSelected(const DictionaryValue& job_settings, |
- PrintMsg_PrintPages_Params* settings) { |
- bool default_margins_selected; |
- if (!job_settings.GetBoolean(printing::kSettingDefaultMarginsSelected, |
- &default_margins_selected)) { |
- NOTREACHED(); |
- default_margins_selected = true; |
- } |
- |
- if (default_margins_selected) |
- return; |
- |
- DictionaryValue* custom_margins; |
- if (!job_settings.GetDictionary(printing::kSettingMargins, |
- &custom_margins)) { |
- NOTREACHED(); |
- return; |
- } |
- |
- double custom_margin_top_in_points = 0; |
- double custom_margin_left_in_points = 0; |
- double custom_margin_right_in_points = 0; |
- double custom_margin_bottom_in_points = 0; |
- if (!custom_margins->GetDouble(printing::kSettingMarginTop, |
- &custom_margin_top_in_points) || |
- !custom_margins->GetDouble(printing::kSettingMarginLeft, |
- &custom_margin_left_in_points) || |
- !custom_margins->GetDouble(printing::kSettingMarginRight, |
- &custom_margin_right_in_points) || |
- !custom_margins->GetDouble(printing::kSettingMarginBottom, |
- &custom_margin_bottom_in_points)) { |
- NOTREACHED(); |
- return; |
- } |
- |
- int dpi = GetDPI(&settings->params); |
- double custom_margin_top_in_dots = ConvertUnitDouble( |
- custom_margin_top_in_points, printing::kPointsPerInch, dpi); |
- double custom_margin_left_in_dots = ConvertUnitDouble( |
- custom_margin_left_in_points, printing::kPointsPerInch, dpi); |
- double custom_margin_right_in_dots = ConvertUnitDouble( |
- custom_margin_right_in_points, printing::kPointsPerInch, dpi); |
- double custom_margin_bottom_in_dots = ConvertUnitDouble( |
- custom_margin_bottom_in_points, printing::kPointsPerInch, dpi); |
- |
- |
- if (custom_margin_left_in_dots < 0 || custom_margin_right_in_dots < 0 || |
- custom_margin_top_in_dots < 0 || custom_margin_bottom_in_dots < 0) { |
- NOTREACHED(); |
- return; |
- } |
- |
- if (settings->params.page_size.width() < custom_margin_left_in_dots + |
- custom_margin_right_in_dots || |
- settings->params.page_size.height() < custom_margin_top_in_dots + |
- custom_margin_bottom_in_dots) { |
- NOTREACHED(); |
- return; |
- } |
- |
- settings->params.margin_top = custom_margin_top_in_dots; |
- settings->params.margin_left = custom_margin_left_in_dots; |
- settings->params.printable_size.set_width( |
- settings->params.page_size.width() - custom_margin_right_in_dots - |
- custom_margin_left_in_dots); |
- settings->params.printable_size.set_height( |
- settings->params.page_size.height() - custom_margin_bottom_in_dots - |
- custom_margin_top_in_dots); |
-} |
- |
// Get the (x, y) coordinate from where printing of the current text should |
// start depending on the horizontal alignment (LEFT, RIGHT, CENTER) and |
// vertical alignment (TOP, BOTTOM). |
@@ -1157,7 +1086,6 @@ bool PrintWebViewHelper::UpdatePrintSettings( |
Send(new PrintHostMsg_DidGetDefaultPageLayout(routing_id(), |
default_page_layout)); |
} |
- SetCustomMarginsIfSelected(job_settings, &settings); |
// Header/Footer: Set |header_footer_info_|. |
if (settings.params.display_header_footer) { |
@@ -1194,7 +1122,7 @@ bool PrintWebViewHelper::GetPrintSettingsFromUser(WebKit::WebFrame* frame, |
params.cookie = print_pages_params_->params.document_cookie; |
params.has_selection = frame->hasSelection(); |
params.expected_pages_count = expected_pages_count; |
- params.use_overlays = use_browser_overlays; |
+ params.margin_type = printing::DEFAULT_MARGINS; |
Send(new PrintHostMsg_DidShowPrintDialog(routing_id())); |