| 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" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 PrintingContext::Result result = PrintingContext::FAILED; | 209 PrintingContext::Result result = PrintingContext::FAILED; |
| 210 AskUserForSettings(page_count, false, false, | 210 AskUserForSettings(page_count, false, false, |
| 211 base::Bind(&AssignResult, &result)); | 211 base::Bind(&AssignResult, &result)); |
| 212 return result; | 212 return result; |
| 213 } | 213 } |
| 214 // Set printer then refresh printer settings. | 214 // Set printer then refresh printer settings. |
| 215 scoped_dev_mode = CreateDevMode(printer.Get(), scoped_dev_mode.get()); | 215 scoped_dev_mode = CreateDevMode(printer.Get(), scoped_dev_mode.get()); |
| 216 return InitializeSettings(settings_.device_name(), scoped_dev_mode.get()); | 216 return InitializeSettings(settings_.device_name(), scoped_dev_mode.get()); |
| 217 } | 217 } |
| 218 | 218 |
| 219 PrintingContext::Result PrintingContextWin::InitWithSettings( | 219 PrintingContext::Result PrintingContextWin::InitWithSettingsForTest( |
| 220 const PrintSettings& settings) { | 220 const PrintSettings& settings) { |
| 221 DCHECK(!in_print_job_); | 221 DCHECK(!in_print_job_); |
| 222 | 222 |
| 223 settings_ = settings; | 223 settings_ = settings; |
| 224 | 224 |
| 225 // TODO(maruel): settings_.ToDEVMODE() | 225 // TODO(maruel): settings_.ToDEVMODE() |
| 226 ScopedPrinterHandle printer; | 226 ScopedPrinterHandle printer; |
| 227 if (!printer.OpenPrinter(settings_.device_name().c_str())) | 227 if (!printer.OpenPrinter(settings_.device_name().c_str())) |
| 228 return FAILED; | 228 return FAILED; |
| 229 | 229 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 if (view && view->GetHost()) | 363 if (view && view->GetHost()) |
| 364 window = view->GetHost()->GetAcceleratedWidget(); | 364 window = view->GetHost()->GetAcceleratedWidget(); |
| 365 if (!window) { | 365 if (!window) { |
| 366 // TODO(maruel): b/1214347 Get the right browser window instead. | 366 // TODO(maruel): b/1214347 Get the right browser window instead. |
| 367 return GetDesktopWindow(); | 367 return GetDesktopWindow(); |
| 368 } | 368 } |
| 369 return window; | 369 return window; |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace printing | 372 } // namespace printing |
| OLD | NEW |