diff options
Diffstat (limited to 'printing/printing_context.cc')
-rw-r--r-- | printing/printing_context.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/printing/printing_context.cc b/printing/printing_context.cc index b94e7a8..cc39e6c 100644 --- a/printing/printing_context.cc +++ b/printing/printing_context.cc @@ -7,7 +7,6 @@ #include "base/logging.h" #include "base/values.h" #include "printing/page_setup.h" -#include "printing/page_size_margins.h" #include "printing/print_settings_initializer.h" namespace printing { @@ -63,15 +62,27 @@ PrintingContext::Result PrintingContext::UpdatePrintSettings( settings_.margin_type = static_cast<MarginType>(margin_type); if (margin_type == CUSTOM_MARGINS) { - printing::PageSizeMargins page_size_margins; - getCustomMarginsFromJobSettings(job_settings, &page_size_margins); - + double top_margin_in_points = 0; + double bottom_margin_in_points = 0; + double left_margin_in_points = 0; + double right_margin_in_points = 0; + DictionaryValue* custom_margins; + if (!job_settings.GetDictionary(kSettingMarginsCustom, &custom_margins) || + !custom_margins->GetDouble(kSettingMarginTop, &top_margin_in_points) || + !custom_margins->GetDouble(kSettingMarginBottom, + &bottom_margin_in_points) || + !custom_margins->GetDouble(kSettingMarginLeft, + &left_margin_in_points) || + !custom_margins->GetDouble(kSettingMarginRight, + &right_margin_in_points)) { + NOTREACHED(); + } PageMargins margins_in_points; margins_in_points.Clear(); - margins_in_points.top = page_size_margins.margin_top; - margins_in_points.bottom = page_size_margins.margin_bottom; - margins_in_points.left = page_size_margins.margin_left; - margins_in_points.right = page_size_margins.margin_right; + margins_in_points.top = top_margin_in_points; + margins_in_points.bottom = bottom_margin_in_points; + margins_in_points.left = left_margin_in_points; + margins_in_points.right = right_margin_in_points; settings_.SetCustomMargins(margins_in_points); } |