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

Side by Side Diff: printing/printing_context_win.cc

Issue 10701155: Send request to show print system dialog to Metro. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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/time.h" 14 #include "base/time.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "base/win/metro.h"
17 #include "printing/backend/win_helper.h" 18 #include "printing/backend/win_helper.h"
18 #include "printing/print_job_constants.h" 19 #include "printing/print_job_constants.h"
19 #include "printing/print_settings_initializer_win.h" 20 #include "printing/print_settings_initializer_win.h"
20 #include "printing/printed_document.h" 21 #include "printing/printed_document.h"
21 #include "printing/units.h" 22 #include "printing/units.h"
22 #include "skia/ext/platform_device.h" 23 #include "skia/ext/platform_device.h"
23 24
24 using base::Time; 25 using base::Time;
25 26
26 namespace { 27 namespace {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 213
213 PrintingContextWin::~PrintingContextWin() { 214 PrintingContextWin::~PrintingContextWin() {
214 ReleaseContext(); 215 ReleaseContext();
215 } 216 }
216 217
217 void PrintingContextWin::AskUserForSettings( 218 void PrintingContextWin::AskUserForSettings(
218 gfx::NativeView view, int max_pages, bool has_selection, 219 gfx::NativeView view, int max_pages, bool has_selection,
219 const PrintSettingsCallback& callback) { 220 const PrintSettingsCallback& callback) {
220 #if !defined(USE_AURA) 221 #if !defined(USE_AURA)
221 DCHECK(!in_print_job_); 222 DCHECK(!in_print_job_);
223
224 if (base::win::IsMetroProcess()) {
225 // The system dialog can not be opened while running in Metro.
226 // But we can programatically launch the Metro print device charm though.
227 HMODULE metro_module = base::win::GetMetroModule();
228 if (metro_module != NULL) {
229 typedef void (*MetroShowPrintUI)();
Albert Bodenhamer 2012/07/12 16:32:10 Nit: Is the prototype for MetroShowPrintUI defined
MAD 2012/07/12 17:16:14 There's work in progress for this... Not quite rea
230 MetroShowPrintUI metro_show_print_ui =
231 reinterpret_cast<MetroShowPrintUI>(
232 ::GetProcAddress(metro_module, "MetroShowPrintUI"));
233 if (metro_show_print_ui)
234 metro_show_print_ui();
235 }
236 return callback.Run(CANCEL);
237 }
222 dialog_box_dismissed_ = false; 238 dialog_box_dismissed_ = false;
223 239
224 HWND window; 240 HWND window;
225 if (!view || !IsWindow(view)) { 241 if (!view || !IsWindow(view)) {
226 // TODO(maruel): bug 1214347 Get the right browser window instead. 242 // TODO(maruel): bug 1214347 Get the right browser window instead.
227 window = GetDesktopWindow(); 243 window = GetDesktopWindow();
228 } else { 244 } else {
229 window = GetAncestor(view, GA_ROOTOWNER); 245 window = GetAncestor(view, GA_ROOTOWNER);
230 } 246 }
231 DCHECK(window); 247 DCHECK(window);
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 if (buf_size) { 813 if (buf_size) {
798 buffer->reset(new uint8[buf_size]); 814 buffer->reset(new uint8[buf_size]);
799 memset(buffer->get(), 0, buf_size); 815 memset(buffer->get(), 0, buf_size);
800 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { 816 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) {
801 buffer->reset(); 817 buffer->reset();
802 } 818 }
803 } 819 }
804 } 820 }
805 821
806 } // namespace printing 822 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698