OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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.h" | 5 #include "printing/printing_context.h" |
6 | 6 |
7 #include <winspool.h> | 7 #include <winspool.h> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 #ifndef NDEBUG | 295 #ifndef NDEBUG |
296 page_number_ = 0; | 296 page_number_ = 0; |
297 #endif | 297 #endif |
298 return OK; | 298 return OK; |
299 } | 299 } |
300 | 300 |
301 PrintingContext::Result PrintingContext::NewPage() { | 301 PrintingContext::Result PrintingContext::NewPage() { |
302 if (abort_printing_) | 302 if (abort_printing_) |
303 return CANCEL; | 303 return CANCEL; |
| 304 |
| 305 DCHECK(context_); |
304 DCHECK(in_print_job_); | 306 DCHECK(in_print_job_); |
305 | 307 |
306 // Inform the driver that the application is about to begin sending data. | 308 // Inform the driver that the application is about to begin sending data. |
307 if (StartPage(context_) <= 0) | 309 if (StartPage(context_) <= 0) |
308 return OnError(); | 310 return OnError(); |
309 | 311 |
310 #ifndef NDEBUG | 312 #ifndef NDEBUG |
311 ++page_number_; | 313 ++page_number_; |
312 #endif | 314 #endif |
313 | 315 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 if (buf_size) { | 613 if (buf_size) { |
612 buffer->reset(new uint8[buf_size]); | 614 buffer->reset(new uint8[buf_size]); |
613 memset(buffer->get(), 0, buf_size); | 615 memset(buffer->get(), 0, buf_size); |
614 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { | 616 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { |
615 buffer->reset(); | 617 buffer->reset(); |
616 } | 618 } |
617 } | 619 } |
618 } | 620 } |
619 | 621 |
620 } // namespace printing | 622 } // namespace printing |
OLD | NEW |