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

Side by Side Diff: printing/printing_context_win.cc

Issue 11411286: Decouple IsMetroProcess() calls, introducing IsSingleWindowMetroMode(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: keep base/win/metro.h in omnibox_view_win.cc for IsTSFAwareRequired() Created 8 years 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
« no previous file with comments | « printing/printing.gyp ('k') | win8/util/win8_util.h » ('j') | 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 <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
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.
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
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « printing/printing.gyp ('k') | win8/util/win8_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698