summaryrefslogtreecommitdiffstats
path: root/printing/page_size_margins.cc
diff options
context:
space:
mode:
authordpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 07:56:18 +0000
committerdpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 07:56:18 +0000
commit61c1046892028090afc10fd0e58d992e739c3b31 (patch)
treed83317a5074baaeed44994d0853e2d69b18ff1f1 /printing/page_size_margins.cc
parent73c2f6a71887dcf9ad7948dd74c84beba4ad1c55 (diff)
downloadchromium_src-61c1046892028090afc10fd0e58d992e739c3b31.zip
chromium_src-61c1046892028090afc10fd0e58d992e739c3b31.tar.gz
chromium_src-61c1046892028090afc10fd0e58d992e739c3b31.tar.bz2
Print Preview: Making margin selection sticky (part 2/2, again)
This is a reland of http://codereview.chromium.org/8351048/ with minor changes to fix the compilation errors on the shared builders. BUG=102446 TEST=See bug description. Review URL: http://codereview.chromium.org/8528053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110055 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/page_size_margins.cc')
-rw-r--r--printing/page_size_margins.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/printing/page_size_margins.cc b/printing/page_size_margins.cc
new file mode 100644
index 0000000..8a6b48b
--- /dev/null
+++ b/printing/page_size_margins.cc
@@ -0,0 +1,29 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "printing/page_size_margins.h"
+
+#include "base/logging.h"
+#include "base/values.h"
+#include "printing/print_job_constants.h"
+
+namespace printing {
+
+void GetCustomMarginsFromJobSettings(const base::DictionaryValue& settings,
+ PageSizeMargins* page_size_margins) {
+ DictionaryValue* custom_margins;
+ if (!settings.GetDictionary(kSettingMarginsCustom, &custom_margins) ||
+ !custom_margins->GetDouble(kSettingMarginTop,
+ &page_size_margins->margin_top) ||
+ !custom_margins->GetDouble(kSettingMarginBottom,
+ &page_size_margins->margin_bottom) ||
+ !custom_margins->GetDouble(kSettingMarginLeft,
+ &page_size_margins->margin_left) ||
+ !custom_margins->GetDouble(kSettingMarginRight,
+ &page_size_margins->margin_right)) {
+ NOTREACHED();
+ }
+}
+
+} // namespace printing