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

Side by Side Diff: printing/printing_context_win.cc

Issue 1124433006: Allow page range selection in system dialog called from preview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « printing/printing_context_win.h ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // 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 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_win.h" 5 #include "printing/printing_context_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 break; 133 break;
134 } 134 }
135 } 135 }
136 return gfx::Size( 136 return gfx::Size(
137 paper_size.width() * settings_.device_units_per_inch(), 137 paper_size.width() * settings_.device_units_per_inch(),
138 paper_size.height() * settings_.device_units_per_inch()); 138 paper_size.height() * settings_.device_units_per_inch());
139 } 139 }
140 140
141 PrintingContext::Result PrintingContextWin::UpdatePrinterSettings( 141 PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
142 bool external_preview, 142 bool external_preview,
143 bool show_system_dialog) { 143 bool show_system_dialog,
144 int page_count) {
144 DCHECK(!in_print_job_); 145 DCHECK(!in_print_job_);
145 DCHECK(!external_preview) << "Not implemented"; 146 DCHECK(!external_preview) << "Not implemented";
146 147
147 ScopedPrinterHandle printer; 148 ScopedPrinterHandle printer;
148 if (!printer.OpenPrinter(settings_.device_name().c_str())) 149 if (!printer.OpenPrinter(settings_.device_name().c_str()))
149 return OnError(); 150 return OnError();
150 151
151 // Make printer changes local to Chrome. 152 // Make printer changes local to Chrome.
152 // See MSDN documentation regarding DocumentProperties. 153 // See MSDN documentation regarding DocumentProperties.
153 scoped_ptr<DEVMODE, base::FreeDeleter> scoped_dev_mode = 154 scoped_ptr<DEVMODE, base::FreeDeleter> scoped_dev_mode =
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 dev_mode->dmFields |= DM_PAPERWIDTH; 200 dev_mode->dmFields |= DM_PAPERWIDTH;
200 dev_mode->dmPaperWidth = width; 201 dev_mode->dmPaperWidth = width;
201 dev_mode->dmFields |= DM_PAPERLENGTH; 202 dev_mode->dmFields |= DM_PAPERLENGTH;
202 dev_mode->dmPaperLength = height; 203 dev_mode->dmPaperLength = height;
203 } 204 }
204 } 205 }
205 206
206 // Update data using DocumentProperties. 207 // Update data using DocumentProperties.
207 if (show_system_dialog) { 208 if (show_system_dialog) {
208 PrintingContext::Result result = PrintingContext::FAILED; 209 PrintingContext::Result result = PrintingContext::FAILED;
209 AskUserForSettings(0, false, false, base::Bind(&AssingResult, &result)); 210 AskUserForSettings(page_count, false, false,
211 base::Bind(&AssingResult, &result));
210 return result; 212 return result;
211 } else { 213 } else {
212 scoped_dev_mode = CreateDevMode(printer.Get(), scoped_dev_mode.get()); 214 scoped_dev_mode = CreateDevMode(printer.Get(), scoped_dev_mode.get());
213 } 215 }
214 // Set printer then refresh printer settings. 216 // Set printer then refresh printer settings.
215 return InitializeSettings(settings_.device_name(), scoped_dev_mode.get()); 217 return InitializeSettings(settings_.device_name(), scoped_dev_mode.get());
216 } 218 }
217 219
218 PrintingContext::Result PrintingContextWin::InitWithSettings( 220 PrintingContext::Result PrintingContextWin::InitWithSettings(
219 const PrintSettings& settings) { 221 const PrintSettings& settings) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 393
392 if (canceled) { 394 if (canceled) {
393 result.reset(); 395 result.reset();
394 abort_printing_ = true; 396 abort_printing_ = true;
395 } 397 }
396 398
397 return result.Pass(); 399 return result.Pass();
398 } 400 }
399 401
400 } // namespace printing 402 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printing_context_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698