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

Side by Side Diff: chrome/browser/printing/win_printing_context.cc

Issue 125082: Add Print Selection support to Chrome. This change is fairly involved since ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/printing/win_printing_context.h" 5 #include "chrome/browser/printing/win_printing_context.h"
6 6
7 #include <winspool.h> 7 #include <winspool.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // StretchDIBits() support is needed for printing. 396 // StretchDIBits() support is needed for printing.
397 if (!(GetDeviceCaps(hdc_, RASTERCAPS) & RC_STRETCHDIB) || 397 if (!(GetDeviceCaps(hdc_, RASTERCAPS) & RC_STRETCHDIB) ||
398 !(GetDeviceCaps(hdc_, RASTERCAPS) & RC_BITMAP64)) { 398 !(GetDeviceCaps(hdc_, RASTERCAPS) & RC_BITMAP64)) {
399 NOTREACHED(); 399 NOTREACHED();
400 ResetSettings(); 400 ResetSettings();
401 return false; 401 return false;
402 } 402 }
403 403
404 DCHECK(!in_print_job_); 404 DCHECK(!in_print_job_);
405 DCHECK(hdc_); 405 DCHECK(hdc_);
406 // Convert the PRINTPAGERANGE array to a PrintSettings::PageRanges vector.
407 PageRanges ranges_vector; 406 PageRanges ranges_vector;
408 ranges_vector.reserve(number_ranges); 407 if (!selection_only) {
409 for (int i = 0; i < number_ranges; ++i) { 408 // Convert the PRINTPAGERANGE array to a PrintSettings::PageRanges vector.
410 PageRange range; 409 ranges_vector.reserve(number_ranges);
411 // Transfert from 1-based to 0-based. 410 for (int i = 0; i < number_ranges; ++i) {
412 range.from = ranges[i].nFromPage - 1; 411 PageRange range;
413 range.to = ranges[i].nToPage - 1; 412 // Transfer from 1-based to 0-based.
414 ranges_vector.push_back(range); 413 range.from = ranges[i].nFromPage - 1;
414 range.to = ranges[i].nToPage - 1;
415 ranges_vector.push_back(range);
416 }
415 } 417 }
416 settings_.Init(hdc_, 418 settings_.Init(hdc_,
417 dev_mode, 419 dev_mode,
418 ranges_vector, 420 ranges_vector,
419 new_device_name, 421 new_device_name,
420 selection_only); 422 selection_only);
421 return true; 423 return true;
422 } 424 }
423 425
424 bool PrintingContext::GetPrinterSettings(HANDLE printer, 426 bool PrintingContext::GetPrinterSettings(HANDLE printer,
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 606
605 if (dialog_options.hDevMode != NULL) 607 if (dialog_options.hDevMode != NULL)
606 GlobalFree(dialog_options.hDevMode); 608 GlobalFree(dialog_options.hDevMode);
607 if (dialog_options.hDevNames != NULL) 609 if (dialog_options.hDevNames != NULL)
608 GlobalFree(dialog_options.hDevNames); 610 GlobalFree(dialog_options.hDevNames);
609 611
610 return hdc_ ? OK : FAILED; 612 return hdc_ ? OK : FAILED;
611 } 613 }
612 614
613 } // namespace printing 615 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/printed_document.cc ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698