Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Unified Diff: printing/printing_context.cc

Issue 8564040: Revert 110035 - Print Preview: Making margin selection sticky (part 2/2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/printing.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/printing_context.cc
===================================================================
--- printing/printing_context.cc (revision 110039)
+++ printing/printing_context.cc (working copy)
@@ -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 @@
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);
}
« no previous file with comments | « printing/printing.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698