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

Side by Side Diff: printing/print_settings_initializer_win.cc

Issue 7831041: Fix print preview workflow to reflect settings of selected printer. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Update per code review Created 9 years, 3 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/print_settings_initializer_win.h" 5 #include "printing/print_settings_initializer_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "printing/print_settings.h" 9 #include "printing/print_settings.h"
10 10
11 namespace printing { 11 namespace printing {
12 12
13 // static 13 // static
14 void PrintSettingsInitializerWin::InitPrintSettings( 14 void PrintSettingsInitializerWin::InitPrintSettings(
15 HDC hdc, 15 HDC hdc,
16 const DEVMODE& dev_mode, 16 const DEVMODE& dev_mode,
17 const PageRanges& new_ranges, 17 const PageRanges& new_ranges,
18 const std::wstring& new_device_name, 18 const std::wstring& new_device_name,
19 bool print_selection_only, 19 bool print_selection_only,
20 PrintSettings* print_settings) { 20 PrintSettings* print_settings) {
21 DCHECK(hdc); 21 DCHECK(hdc);
22 DCHECK(print_settings); 22 DCHECK(print_settings);
23 23
24 print_settings->set_printer_name(dev_mode.dmDeviceName); 24 print_settings->set_printer_name(dev_mode.dmDeviceName);
25 print_settings->set_device_name(new_device_name); 25 print_settings->set_device_name(new_device_name);
26 print_settings->ranges = new_ranges; 26 print_settings->ranges = const_cast<PageRanges&>(new_ranges);
27 print_settings->set_landscape(dev_mode.dmOrientation == DMORIENT_LANDSCAPE); 27 print_settings->set_landscape(dev_mode.dmOrientation == DMORIENT_LANDSCAPE);
28 print_settings->selection_only = print_selection_only; 28 print_settings->selection_only = print_selection_only;
29 29
30 int dpi = GetDeviceCaps(hdc, LOGPIXELSX); 30 int dpi = GetDeviceCaps(hdc, LOGPIXELSX);
31 print_settings->set_dpi(dpi); 31 print_settings->set_dpi(dpi);
32 const int kAlphaCaps = SB_CONST_ALPHA | SB_PIXEL_ALPHA; 32 const int kAlphaCaps = SB_CONST_ALPHA | SB_PIXEL_ALPHA;
33 print_settings->set_supports_alpha_blend( 33 print_settings->set_supports_alpha_blend(
34 (GetDeviceCaps(hdc, SHADEBLENDCAPS) & kAlphaCaps) == kAlphaCaps); 34 (GetDeviceCaps(hdc, SHADEBLENDCAPS) & kAlphaCaps) == kAlphaCaps);
35 // No printer device is known to advertise different dpi in X and Y axis; even 35 // No printer device is known to advertise different dpi in X and Y axis; even
36 // the fax device using the 200x100 dpi setting. It's ought to break so many 36 // the fax device using the 200x100 dpi setting. It's ought to break so many
(...skipping 11 matching lines...) Expand all
48 GetDeviceCaps(hdc, PHYSICALOFFSETY), 48 GetDeviceCaps(hdc, PHYSICALOFFSETY),
49 GetDeviceCaps(hdc, HORZRES), 49 GetDeviceCaps(hdc, HORZRES),
50 GetDeviceCaps(hdc, VERTRES)); 50 GetDeviceCaps(hdc, VERTRES));
51 51
52 print_settings->SetPrinterPrintableArea(physical_size_device_units, 52 print_settings->SetPrinterPrintableArea(physical_size_device_units,
53 printable_area_device_units, 53 printable_area_device_units,
54 dpi); 54 dpi);
55 } 55 }
56 56
57 } // namespace printing 57 } // namespace printing
OLDNEW
« chrome/renderer/print_web_view_helper.cc ('K') | « chrome/renderer/print_web_view_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698