blob: a28c6ada3c84ba013b4a57b0402b11e68d0240e4 [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "printing/page_size_margins.h"
6
7#include "base/logging.h"
8#include "base/values.h"
9#include "printing/print_job_constants.h"
10
11namespace printing {
12
13void GetCustomMarginsFromJobSettings(const base::DictionaryValue& settings,
14 PageSizeMargins* page_size_margins) {
Ben Murdocheb525c52013-07-10 11:40:50 +010015 const base::DictionaryValue* custom_margins;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000016 if (!settings.GetDictionary(kSettingMarginsCustom, &custom_margins) ||
17 !custom_margins->GetDouble(kSettingMarginTop,
18 &page_size_margins->margin_top) ||
19 !custom_margins->GetDouble(kSettingMarginBottom,
20 &page_size_margins->margin_bottom) ||
21 !custom_margins->GetDouble(kSettingMarginLeft,
22 &page_size_margins->margin_left) ||
23 !custom_margins->GetDouble(kSettingMarginRight,
24 &page_size_margins->margin_right)) {
25 NOTREACHED();
26 }
27}
28
29} // namespace printing