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

Side by Side Diff: printing/printing_context_no_system_dialog.cc

Issue 47823002: De-duplicate job_settings parsing code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Noam's comments Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/printing_context_no_system_dialog.h ('k') | printing/printing_context_win.h » ('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_no_system_dialog.h" 5 #include "printing/printing_context_no_system_dialog.h"
6 6
7 #include <unicode/ulocdata.h> 7 #include <unicode/ulocdata.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 physical_size_device_units.SetSize(width, height); 68 physical_size_device_units.SetSize(width, height);
69 69
70 // Assume full page is printable for now. 70 // Assume full page is printable for now.
71 printable_area_device_units.SetRect(0, 0, width, height); 71 printable_area_device_units.SetRect(0, 0, width, height);
72 72
73 settings_.set_dpi(dpi); 73 settings_.set_dpi(dpi);
74 settings_.SetPrinterPrintableArea(physical_size_device_units, 74 settings_.SetPrinterPrintableArea(physical_size_device_units,
75 printable_area_device_units, 75 printable_area_device_units,
76 dpi); 76 dpi, true);
77 77
78 return OK; 78 return OK;
79 } 79 }
80 80
81 PrintingContext::Result PrintingContextNoSystemDialog::UpdatePrinterSettings( 81 PrintingContext::Result PrintingContextNoSystemDialog::UpdatePrinterSettings(
82 const base::DictionaryValue& job_settings, const PageRanges& ranges) { 82 bool target_is_pdf,
83 bool landscape = false; 83 bool external_preview) {
84
85 if (!job_settings.GetBoolean(kSettingLandscape, &landscape))
86 return OnError();
87
88 if (settings_.dpi() == 0)
89 UseDefaultSettings();
90
91 settings_.SetOrientation(landscape);
92 settings_.ranges = ranges;
93
94 return OK; 84 return OK;
95 } 85 }
96 86
97 PrintingContext::Result PrintingContextNoSystemDialog::InitWithSettings( 87 PrintingContext::Result PrintingContextNoSystemDialog::InitWithSettings(
98 const PrintSettings& settings) { 88 const PrintSettings& settings) {
99 DCHECK(!in_print_job_); 89 DCHECK(!in_print_job_);
100 90
101 settings_ = settings; 91 settings_ = settings;
102 92
103 return OK; 93 return OK;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Intentional No-op. 139 // Intentional No-op.
150 } 140 }
151 141
152 gfx::NativeDrawingContext PrintingContextNoSystemDialog::context() const { 142 gfx::NativeDrawingContext PrintingContextNoSystemDialog::context() const {
153 // Intentional No-op. 143 // Intentional No-op.
154 return NULL; 144 return NULL;
155 } 145 }
156 146
157 } // namespace printing 147 } // namespace printing
158 148
OLDNEW
« no previous file with comments | « printing/printing_context_no_system_dialog.h ('k') | printing/printing_context_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698