| 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 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/memory/free_deleter.h" | 11 #include "base/memory/free_deleter.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "printing/backend/print_backend.h" | 15 #include "printing/backend/print_backend.h" |
| 16 #include "printing/backend/win_helper.h" | 16 #include "printing/backend/win_helper.h" |
| 17 #include "printing/features/features.h" |
| 17 #include "printing/print_settings_initializer_win.h" | 18 #include "printing/print_settings_initializer_win.h" |
| 18 #include "printing/printed_document.h" | 19 #include "printing/printed_document.h" |
| 19 #include "printing/printing_context_system_dialog_win.h" | 20 #include "printing/printing_context_system_dialog_win.h" |
| 20 #include "printing/printing_utils.h" | 21 #include "printing/printing_utils.h" |
| 21 #include "printing/units.h" | 22 #include "printing/units.h" |
| 22 #include "skia/ext/skia_utils_win.h" | 23 #include "skia/ext/skia_utils_win.h" |
| 23 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 24 #include "ui/aura/window_tree_host.h" | 25 #include "ui/aura/window_tree_host.h" |
| 25 | 26 |
| 26 namespace printing { | 27 namespace printing { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 void AssignResult(PrintingContext::Result* out, PrintingContext::Result in) { | 31 void AssignResult(PrintingContext::Result* out, PrintingContext::Result in) { |
| 31 *out = in; | 32 *out = in; |
| 32 } | 33 } |
| 33 | 34 |
| 34 } // namespace | 35 } // namespace |
| 35 | 36 |
| 36 // static | 37 // static |
| 37 std::unique_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) { | 38 std::unique_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) { |
| 38 #if defined(ENABLE_BASIC_PRINTING) | 39 #if BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 39 return base::WrapUnique(new PrintingContextSystemDialogWin(delegate)); | 40 return base::WrapUnique(new PrintingContextSystemDialogWin(delegate)); |
| 40 #else | 41 #else |
| 41 return base::WrapUnique(new PrintingContextWin(delegate)); | 42 return base::WrapUnique(new PrintingContextWin(delegate)); |
| 42 #endif | 43 #endif |
| 43 } | 44 } |
| 44 | 45 |
| 45 PrintingContextWin::PrintingContextWin(Delegate* delegate) | 46 PrintingContextWin::PrintingContextWin(Delegate* delegate) |
| 46 : PrintingContext(delegate), context_(nullptr) {} | 47 : PrintingContext(delegate), context_(nullptr) {} |
| 47 | 48 |
| 48 PrintingContextWin::~PrintingContextWin() { | 49 PrintingContextWin::~PrintingContextWin() { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 if (view && view->GetHost()) | 364 if (view && view->GetHost()) |
| 364 window = view->GetHost()->GetAcceleratedWidget(); | 365 window = view->GetHost()->GetAcceleratedWidget(); |
| 365 if (!window) { | 366 if (!window) { |
| 366 // TODO(maruel): b/1214347 Get the right browser window instead. | 367 // TODO(maruel): b/1214347 Get the right browser window instead. |
| 367 return GetDesktopWindow(); | 368 return GetDesktopWindow(); |
| 368 } | 369 } |
| 369 return window; | 370 return window; |
| 370 } | 371 } |
| 371 | 372 |
| 372 } // namespace printing | 373 } // namespace printing |
| OLD | NEW |