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

Side by Side Diff: printing/printing_context.cc

Issue 8334007: Cleanup: Remove unneeded namespaces. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/printed_document_win.cc ('k') | printing/printing_context_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "printing/printing_context.h" 5 #include "printing/printing_context.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "printing/page_setup.h" 9 #include "printing/page_setup.h"
10 #include "printing/print_settings_initializer.h" 10 #include "printing/print_settings_initializer.h"
(...skipping 28 matching lines...) Expand all
39 PrintingContext::Result PrintingContext::OnError() { 39 PrintingContext::Result PrintingContext::OnError() {
40 ResetSettings(); 40 ResetSettings();
41 return abort_printing_ ? CANCEL : FAILED; 41 return abort_printing_ ? CANCEL : FAILED;
42 } 42 }
43 43
44 PrintingContext::Result PrintingContext::UpdatePrintSettings( 44 PrintingContext::Result PrintingContext::UpdatePrintSettings(
45 const base::DictionaryValue& job_settings, 45 const base::DictionaryValue& job_settings,
46 const PageRanges& ranges) { 46 const PageRanges& ranges) {
47 ResetSettings(); 47 ResetSettings();
48 48
49 if (!job_settings.GetBoolean(printing::kSettingHeaderFooterEnabled, 49 if (!job_settings.GetBoolean(kSettingHeaderFooterEnabled,
50 &settings_.display_header_footer)) { 50 &settings_.display_header_footer)) {
51 NOTREACHED(); 51 NOTREACHED();
52 } 52 }
53 53
54 int margin_type = DEFAULT_MARGINS; 54 int margin_type = DEFAULT_MARGINS;
55 if (!job_settings.GetInteger(printing::kSettingMarginsType, &margin_type) || 55 if (!job_settings.GetInteger(kSettingMarginsType, &margin_type) ||
56 (margin_type != DEFAULT_MARGINS && 56 (margin_type != DEFAULT_MARGINS &&
57 margin_type != NO_MARGINS && 57 margin_type != NO_MARGINS &&
58 margin_type != CUSTOM_MARGINS && 58 margin_type != CUSTOM_MARGINS &&
59 margin_type != PRINTABLE_AREA_MARGINS)) { 59 margin_type != PRINTABLE_AREA_MARGINS)) {
60 NOTREACHED(); 60 NOTREACHED();
61 } 61 }
62 settings_.margin_type = static_cast<MarginType>(margin_type); 62 settings_.margin_type = static_cast<MarginType>(margin_type);
63 63
64 if (margin_type == CUSTOM_MARGINS) { 64 if (margin_type == CUSTOM_MARGINS) {
65 double top_margin_in_points = 0; 65 double top_margin_in_points = 0;
66 double bottom_margin_in_points = 0; 66 double bottom_margin_in_points = 0;
67 double left_margin_in_points = 0; 67 double left_margin_in_points = 0;
68 double right_margin_in_points = 0; 68 double right_margin_in_points = 0;
69 DictionaryValue* custom_margins; 69 DictionaryValue* custom_margins;
70 if (!job_settings.GetDictionary(printing::kSettingMarginsCustom, 70 if (!job_settings.GetDictionary(kSettingMarginsCustom, &custom_margins) ||
71 &custom_margins) || 71 !custom_margins->GetDouble(kSettingMarginTop, &top_margin_in_points) ||
72 !custom_margins->GetDouble(printing::kSettingMarginTop, 72 !custom_margins->GetDouble(kSettingMarginBottom,
73 &top_margin_in_points) ||
74 !custom_margins->GetDouble(printing::kSettingMarginBottom,
75 &bottom_margin_in_points) || 73 &bottom_margin_in_points) ||
76 !custom_margins->GetDouble(printing::kSettingMarginLeft, 74 !custom_margins->GetDouble(kSettingMarginLeft,
77 &left_margin_in_points) || 75 &left_margin_in_points) ||
78 !custom_margins->GetDouble(printing::kSettingMarginRight, 76 !custom_margins->GetDouble(kSettingMarginRight,
79 &right_margin_in_points)) { 77 &right_margin_in_points)) {
80 NOTREACHED(); 78 NOTREACHED();
81 } 79 }
82 PageMargins margins_in_points; 80 PageMargins margins_in_points;
83 margins_in_points.Clear(); 81 margins_in_points.Clear();
84 margins_in_points.top = top_margin_in_points; 82 margins_in_points.top = top_margin_in_points;
85 margins_in_points.bottom = bottom_margin_in_points; 83 margins_in_points.bottom = bottom_margin_in_points;
86 margins_in_points.left = left_margin_in_points; 84 margins_in_points.left = left_margin_in_points;
87 margins_in_points.right = right_margin_in_points; 85 margins_in_points.right = right_margin_in_points;
88 86
89 settings_.SetCustomMargins(margins_in_points); 87 settings_.SetCustomMargins(margins_in_points);
90 } 88 }
91 89
92 PrintingContext::Result result = UpdatePrinterSettings(job_settings, ranges); 90 PrintingContext::Result result = UpdatePrinterSettings(job_settings, ranges);
93 printing::PrintSettingsInitializer::InitHeaderFooterStrings(job_settings, 91 PrintSettingsInitializer::InitHeaderFooterStrings(job_settings, &settings_);
94 &settings_);
95 return result; 92 return result;
96 } 93 }
97 94
98 } // namespace printing 95 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printed_document_win.cc ('k') | printing/printing_context_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698