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/time.h" | 15 #include "base/time.h" |
15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "base/win/metro.h" | 18 #include "base/win/metro.h" |
18 #include "printing/backend/win_helper.h" | 19 #include "printing/backend/win_helper.h" |
19 #include "printing/print_job_constants.h" | 20 #include "printing/print_job_constants.h" |
20 #include "printing/print_settings_initializer_win.h" | 21 #include "printing/print_settings_initializer_win.h" |
21 #include "printing/printed_document.h" | 22 #include "printing/printed_document.h" |
22 #include "printing/units.h" | 23 #include "printing/units.h" |
23 #include "skia/ext/platform_device.h" | 24 #include "skia/ext/platform_device.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 224 |
224 if (base::win::IsMetroProcess()) { | 225 if (base::win::IsMetroProcess()) { |
225 // The system dialog can not be opened while running in Metro. | 226 // The system dialog can not be opened while running in Metro. |
226 // But we can programatically launch the Metro print device charm though. | 227 // But we can programatically launch the Metro print device charm though. |
227 HMODULE metro_module = base::win::GetMetroModule(); | 228 HMODULE metro_module = base::win::GetMetroModule(); |
228 if (metro_module != NULL) { | 229 if (metro_module != NULL) { |
229 typedef void (*MetroShowPrintUI)(); | 230 typedef void (*MetroShowPrintUI)(); |
230 MetroShowPrintUI metro_show_print_ui = | 231 MetroShowPrintUI metro_show_print_ui = |
231 reinterpret_cast<MetroShowPrintUI>( | 232 reinterpret_cast<MetroShowPrintUI>( |
232 ::GetProcAddress(metro_module, "MetroShowPrintUI")); | 233 ::GetProcAddress(metro_module, "MetroShowPrintUI")); |
233 if (metro_show_print_ui) | 234 if (metro_show_print_ui) { |
| 235 // TODO(mad): Remove this once we can send user metrics from the metro |
| 236 // driver. |
| 237 UMA_HISTOGRAM_ENUMERATION("Metro.Print", 1, 2); |
234 metro_show_print_ui(); | 238 metro_show_print_ui(); |
| 239 } |
235 } | 240 } |
236 return callback.Run(CANCEL); | 241 return callback.Run(CANCEL); |
237 } | 242 } |
238 dialog_box_dismissed_ = false; | 243 dialog_box_dismissed_ = false; |
239 | 244 |
240 HWND window; | 245 HWND window; |
241 if (!view || !IsWindow(view)) { | 246 if (!view || !IsWindow(view)) { |
242 // TODO(maruel): bug 1214347 Get the right browser window instead. | 247 // TODO(maruel): bug 1214347 Get the right browser window instead. |
243 window = GetDesktopWindow(); | 248 window = GetDesktopWindow(); |
244 } else { | 249 } else { |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 if (buf_size) { | 818 if (buf_size) { |
814 buffer->reset(new uint8[buf_size]); | 819 buffer->reset(new uint8[buf_size]); |
815 memset(buffer->get(), 0, buf_size); | 820 memset(buffer->get(), 0, buf_size); |
816 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { | 821 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { |
817 buffer->reset(); | 822 buffer->reset(); |
818 } | 823 } |
819 } | 824 } |
820 } | 825 } |
821 | 826 |
822 } // namespace printing | 827 } // namespace printing |
OLD | NEW |