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" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "printing/backend/print_backend.h" | 12 #include "printing/backend/print_backend.h" |
13 #include "printing/backend/win_helper.h" | 13 #include "printing/backend/win_helper.h" |
14 #include "printing/print_settings_initializer_win.h" | 14 #include "printing/print_settings_initializer_win.h" |
15 #include "printing/printed_document.h" | 15 #include "printing/printed_document.h" |
16 #include "printing/printing_context_system_dialog_win.h" | 16 #include "printing/printing_context_system_dialog_win.h" |
17 #include "printing/printing_utils.h" | 17 #include "printing/printing_utils.h" |
18 #include "printing/units.h" | 18 #include "printing/units.h" |
19 #include "skia/ext/platform_device.h" | 19 #include "skia/ext/platform_device.h" |
20 | |
21 #if defined(USE_AURA) | |
22 #include "ui/aura/remote_window_tree_host_win.h" | 20 #include "ui/aura/remote_window_tree_host_win.h" |
23 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
24 #endif | |
25 | 22 |
26 namespace printing { | 23 namespace printing { |
27 | 24 |
28 namespace { | 25 namespace { |
29 | 26 |
30 void AssingResult(PrintingContext::Result* out, PrintingContext::Result in) { | 27 void AssingResult(PrintingContext::Result* out, PrintingContext::Result in) { |
31 *out = in; | 28 *out = in; |
32 } | 29 } |
33 | 30 |
34 } // namespace | 31 } // namespace |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 DCHECK(!in_print_job_); | 352 DCHECK(!in_print_job_); |
356 settings_.set_device_name(device_name); | 353 settings_.set_device_name(device_name); |
357 PrintSettingsInitializerWin::InitPrintSettings( | 354 PrintSettingsInitializerWin::InitPrintSettings( |
358 context_, *dev_mode, &settings_); | 355 context_, *dev_mode, &settings_); |
359 | 356 |
360 return OK; | 357 return OK; |
361 } | 358 } |
362 | 359 |
363 HWND PrintingContextWin::GetRootWindow(gfx::NativeView view) { | 360 HWND PrintingContextWin::GetRootWindow(gfx::NativeView view) { |
364 HWND window = NULL; | 361 HWND window = NULL; |
365 #if defined(USE_AURA) | |
366 if (view) | 362 if (view) |
367 window = view->GetHost()->GetAcceleratedWidget(); | 363 window = view->GetHost()->GetAcceleratedWidget(); |
368 #else | |
369 if (view && IsWindow(view)) { | |
370 window = GetAncestor(view, GA_ROOTOWNER); | |
371 } | |
372 #endif | |
373 if (!window) { | 364 if (!window) { |
374 // TODO(maruel): crbug.com/1214347 Get the right browser window instead. | 365 // TODO(maruel): crbug.com/1214347 Get the right browser window instead. |
375 return GetDesktopWindow(); | 366 return GetDesktopWindow(); |
376 } | 367 } |
377 return window; | 368 return window; |
378 } | 369 } |
379 | 370 |
380 scoped_ptr<DEVMODE, base::FreeDeleter> PrintingContextWin::ShowPrintDialog( | 371 scoped_ptr<DEVMODE, base::FreeDeleter> PrintingContextWin::ShowPrintDialog( |
381 HANDLE printer, | 372 HANDLE printer, |
382 gfx::NativeView parent_view, | 373 gfx::NativeView parent_view, |
(...skipping 17 matching lines...) Expand all Loading... |
400 | 391 |
401 if (canceled) { | 392 if (canceled) { |
402 result.reset(); | 393 result.reset(); |
403 abort_printing_ = true; | 394 abort_printing_ = true; |
404 } | 395 } |
405 | 396 |
406 return result.Pass(); | 397 return result.Pass(); |
407 } | 398 } |
408 | 399 |
409 } // namespace printing | 400 } // namespace printing |
OLD | NEW |