OLD | NEW |
---|---|
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 <winspool.h> | 7 #include <winspool.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "base/i18n/file_util_icu.h" | 11 #include "base/i18n/file_util_icu.h" |
12 #include "base/i18n/time_formatting.h" | 12 #include "base/i18n/time_formatting.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "base/win/metro.h" | 18 #include "base/win/metro.h" |
19 #include "printing/backend/print_backend.h" | 19 #include "printing/backend/print_backend.h" |
20 #include "printing/backend/win_helper.h" | 20 #include "printing/backend/win_helper.h" |
21 #include "printing/print_job_constants.h" | 21 #include "printing/print_job_constants.h" |
22 #include "printing/print_settings_initializer_win.h" | 22 #include "printing/print_settings_initializer_win.h" |
23 #include "printing/printed_document.h" | 23 #include "printing/printed_document.h" |
24 #include "printing/units.h" | 24 #include "printing/units.h" |
25 #include "skia/ext/platform_device.h" | 25 #include "skia/ext/platform_device.h" |
26 #include "win8/util/win8_util.h" | |
26 | 27 |
27 using base::Time; | 28 using base::Time; |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 // Constants for setting default PDF settings. | 32 // Constants for setting default PDF settings. |
32 const int kPDFDpi = 300; // 300 dpi | 33 const int kPDFDpi = 300; // 300 dpi |
33 // LETTER: 8.5 x 11 inches | 34 // LETTER: 8.5 x 11 inches |
34 const int kPDFLetterWidth = 8.5 * kPDFDpi; | 35 const int kPDFLetterWidth = 8.5 * kPDFDpi; |
35 const int kPDFLetterHeight = 11 * kPDFDpi; | 36 const int kPDFLetterHeight = 11 * kPDFDpi; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 PrintingContextWin::~PrintingContextWin() { | 217 PrintingContextWin::~PrintingContextWin() { |
217 ReleaseContext(); | 218 ReleaseContext(); |
218 } | 219 } |
219 | 220 |
220 void PrintingContextWin::AskUserForSettings( | 221 void PrintingContextWin::AskUserForSettings( |
221 gfx::NativeView view, int max_pages, bool has_selection, | 222 gfx::NativeView view, int max_pages, bool has_selection, |
222 const PrintSettingsCallback& callback) { | 223 const PrintSettingsCallback& callback) { |
223 #if !defined(USE_AURA) | 224 #if !defined(USE_AURA) |
224 DCHECK(!in_print_job_); | 225 DCHECK(!in_print_job_); |
225 | 226 |
226 if (base::win::IsMetroProcess()) { | 227 if (win8::IsSingleWindowMetroMode()) { |
227 // The system dialog can not be opened while running in Metro. | 228 // The system dialog can not be opened while running in Metro. |
cpu_(ooo_6.6-7.5)
2012/12/03 20:56:26
this seems incorrect as in ash we don't want this
gab
2012/12/04 00:19:06
This is already precompiled out for AURA builds (s
| |
228 // But we can programatically launch the Metro print device charm though. | 229 // But we can programatically launch the Metro print device charm though. |
229 HMODULE metro_module = base::win::GetMetroModule(); | 230 HMODULE metro_module = base::win::GetMetroModule(); |
230 if (metro_module != NULL) { | 231 if (metro_module != NULL) { |
231 typedef void (*MetroShowPrintUI)(); | 232 typedef void (*MetroShowPrintUI)(); |
232 MetroShowPrintUI metro_show_print_ui = | 233 MetroShowPrintUI metro_show_print_ui = |
233 reinterpret_cast<MetroShowPrintUI>( | 234 reinterpret_cast<MetroShowPrintUI>( |
234 ::GetProcAddress(metro_module, "MetroShowPrintUI")); | 235 ::GetProcAddress(metro_module, "MetroShowPrintUI")); |
235 if (metro_show_print_ui) { | 236 if (metro_show_print_ui) { |
236 // TODO(mad): Remove this once we can send user metrics from the metro | 237 // TODO(mad): Remove this once we can send user metrics from the metro |
237 // driver. crbug.com/142330 | 238 // driver. crbug.com/142330 |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
820 if (buf_size) { | 821 if (buf_size) { |
821 buffer->reset(new uint8[buf_size]); | 822 buffer->reset(new uint8[buf_size]); |
822 memset(buffer->get(), 0, buf_size); | 823 memset(buffer->get(), 0, buf_size); |
823 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { | 824 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { |
824 buffer->reset(); | 825 buffer->reset(); |
825 } | 826 } |
826 } | 827 } |
827 } | 828 } |
828 | 829 |
829 } // namespace printing | 830 } // namespace printing |
OLD | NEW |