OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" |
14 #include "printing/print_settings_initializer_win.h" | 15 #include "printing/print_settings_initializer_win.h" |
15 #include "printing/printed_document.h" | 16 #include "printing/printed_document.h" |
16 #include "skia/ext/platform_device_win.h" | 17 #include "skia/ext/platform_device_win.h" |
17 | 18 |
18 using base::Time; | 19 using base::Time; |
19 | 20 |
20 namespace printing { | 21 namespace printing { |
21 | 22 |
22 class PrintingContextWin::CallbackHandler : public IPrintDialogCallback, | 23 class PrintingContextWin::CallbackHandler : public IPrintDialogCallback, |
23 public IObjectWithSite { | 24 public IObjectWithSite { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 202 |
202 PRINTDLG dialog_options = { sizeof(PRINTDLG) }; | 203 PRINTDLG dialog_options = { sizeof(PRINTDLG) }; |
203 dialog_options.Flags = PD_RETURNDC | PD_RETURNDEFAULT; | 204 dialog_options.Flags = PD_RETURNDC | PD_RETURNDEFAULT; |
204 if (PrintDlg(&dialog_options) == 0) { | 205 if (PrintDlg(&dialog_options) == 0) { |
205 ResetSettings(); | 206 ResetSettings(); |
206 return FAILED; | 207 return FAILED; |
207 } | 208 } |
208 return ParseDialogResult(dialog_options); | 209 return ParseDialogResult(dialog_options); |
209 } | 210 } |
210 | 211 |
| 212 PrintingContext::Result PrintingContextWin::UpdatePrintSettings( |
| 213 const DictionaryValue* job_settings, const PageRanges& ranges) { |
| 214 DCHECK(!in_print_job_); |
| 215 |
| 216 settings_.ranges = ranges; |
| 217 |
| 218 NOTIMPLEMENTED(); |
| 219 |
| 220 return FAILED; |
| 221 } |
| 222 |
211 PrintingContext::Result PrintingContextWin::InitWithSettings( | 223 PrintingContext::Result PrintingContextWin::InitWithSettings( |
212 const PrintSettings& settings) { | 224 const PrintSettings& settings) { |
213 DCHECK(!in_print_job_); | 225 DCHECK(!in_print_job_); |
214 | 226 |
215 settings_ = settings; | 227 settings_ = settings; |
216 | 228 |
217 // TODO(maruel): settings_.ToDEVMODE() | 229 // TODO(maruel): settings_.ToDEVMODE() |
218 HANDLE printer; | 230 HANDLE printer; |
219 if (!OpenPrinter(const_cast<wchar_t*>(settings_.device_name().c_str()), | 231 if (!OpenPrinter(const_cast<wchar_t*>(settings_.device_name().c_str()), |
220 &printer, | 232 &printer, |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 if (buf_size) { | 612 if (buf_size) { |
601 buffer->reset(new uint8[buf_size]); | 613 buffer->reset(new uint8[buf_size]); |
602 memset(buffer->get(), 0, buf_size); | 614 memset(buffer->get(), 0, buf_size); |
603 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { | 615 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { |
604 buffer->reset(); | 616 buffer->reset(); |
605 } | 617 } |
606 } | 618 } |
607 } | 619 } |
608 | 620 |
609 } // namespace printing | 621 } // namespace printing |
OLD | NEW |