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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 HWND window = NULL; | 363 HWND window = NULL; |
364 if (view && view->GetHost()) | 364 if (view && view->GetHost()) |
365 window = view->GetHost()->GetAcceleratedWidget(); | 365 window = view->GetHost()->GetAcceleratedWidget(); |
366 if (!window) { | 366 if (!window) { |
367 // TODO(maruel): crbug.com/1214347 Get the right browser window instead. | 367 // TODO(maruel): crbug.com/1214347 Get the right browser window instead. |
368 return GetDesktopWindow(); | 368 return GetDesktopWindow(); |
369 } | 369 } |
370 return window; | 370 return window; |
371 } | 371 } |
372 | 372 |
373 scoped_ptr<DEVMODE, base::FreeDeleter> PrintingContextWin::ShowPrintDialog( | |
374 HANDLE printer, | |
375 gfx::NativeView parent_view, | |
376 DEVMODE* dev_mode) { | |
377 // Note that this cannot use ui::BaseShellDialog as the print dialog is | |
378 // system modal: opening it from a background thread can cause Windows to | |
379 // get the wrong Z-order which will make the print dialog appear behind the | |
380 // browser frame (but still being modal) so neither the browser frame nor | |
381 // the print dialog will get any input. See http://crbug.com/342697 | |
382 // http://crbug.com/180997 for details. | |
383 base::MessageLoop::ScopedNestableTaskAllower allow( | |
384 base::MessageLoop::current()); | |
385 | |
386 bool canceled = false; | |
387 scoped_ptr<DEVMODE, base::FreeDeleter> result = | |
388 PromptDevMode(printer, | |
389 settings_.device_name(), | |
390 dev_mode, | |
391 GetRootWindow(parent_view), | |
392 &canceled); | |
393 | |
394 if (canceled) { | |
395 result.reset(); | |
396 abort_printing_ = true; | |
397 } | |
398 | |
399 return result.Pass(); | |
400 } | |
401 | |
402 } // namespace printing | 373 } // namespace printing |
OLD | NEW |