[email protected] | 8ff1d42 | 2009-07-07 21:31:39 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "printing/printing_context.h" |
| 6 | |
| 7 | #include "base/logging.h" |
| 8 | |
| 9 | namespace printing { |
| 10 | |
| 11 | PrintingContext::PrintingContext() |
| 12 | : |
| 13 | #ifndef NDEBUG |
| 14 | page_number_(-1), |
| 15 | #endif |
| 16 | dialog_box_dismissed_(false), |
| 17 | in_print_job_(false), |
| 18 | abort_printing_(false) { |
| 19 | } |
| 20 | |
| 21 | PrintingContext::~PrintingContext() { |
| 22 | ResetSettings(); |
| 23 | } |
| 24 | |
| 25 | |
| 26 | PrintingContext::Result PrintingContext::UseDefaultSettings() { |
| 27 | DCHECK(!in_print_job_); |
| 28 | |
| 29 | NOTIMPLEMENTED(); |
| 30 | |
| 31 | return FAILED; |
| 32 | } |
| 33 | |
| 34 | PrintingContext::Result PrintingContext::InitWithSettings( |
| 35 | const PrintSettings& settings) { |
| 36 | DCHECK(!in_print_job_); |
| 37 | settings_ = settings; |
| 38 | |
| 39 | NOTIMPLEMENTED(); |
| 40 | |
| 41 | return FAILED; |
| 42 | } |
| 43 | |
| 44 | void PrintingContext::ResetSettings() { |
| 45 | #ifndef NDEBUG |
| 46 | page_number_ = -1; |
| 47 | #endif |
| 48 | dialog_box_dismissed_ = false; |
| 49 | abort_printing_ = false; |
| 50 | in_print_job_ = false; |
| 51 | } |
| 52 | |
| 53 | PrintingContext::Result PrintingContext::NewDocument( |
| 54 | const std::wstring& document_name) { |
| 55 | DCHECK(!in_print_job_); |
| 56 | |
| 57 | NOTIMPLEMENTED(); |
| 58 | |
| 59 | #ifndef NDEBUG |
| 60 | page_number_ = 0; |
| 61 | #endif |
| 62 | |
| 63 | return FAILED; |
| 64 | } |
| 65 | |
| 66 | PrintingContext::Result PrintingContext::NewPage() { |
| 67 | if (abort_printing_) |
| 68 | return CANCEL; |
| 69 | DCHECK(in_print_job_); |
| 70 | |
| 71 | NOTIMPLEMENTED(); |
| 72 | |
| 73 | #ifndef NDEBUG |
| 74 | ++page_number_; |
| 75 | #endif |
| 76 | |
| 77 | return FAILED; |
| 78 | } |
| 79 | |
| 80 | PrintingContext::Result PrintingContext::PageDone() { |
| 81 | if (abort_printing_) |
| 82 | return CANCEL; |
| 83 | DCHECK(in_print_job_); |
| 84 | |
| 85 | NOTIMPLEMENTED(); |
| 86 | |
| 87 | return FAILED; |
| 88 | } |
| 89 | |
| 90 | PrintingContext::Result PrintingContext::DocumentDone() { |
| 91 | if (abort_printing_) |
| 92 | return CANCEL; |
| 93 | DCHECK(in_print_job_); |
| 94 | |
| 95 | NOTIMPLEMENTED(); |
| 96 | |
| 97 | ResetSettings(); |
| 98 | return FAILED; |
| 99 | } |
| 100 | |
| 101 | void PrintingContext::Cancel() { |
| 102 | abort_printing_ = true; |
| 103 | in_print_job_ = false; |
| 104 | |
| 105 | NOTIMPLEMENTED(); |
| 106 | } |
| 107 | |
| 108 | void PrintingContext::DismissDialog() { |
| 109 | NOTIMPLEMENTED(); |
| 110 | } |
| 111 | |
| 112 | PrintingContext::Result PrintingContext::OnError() { |
| 113 | ResetSettings(); |
| 114 | return abort_printing_ ? CANCEL : FAILED; |
| 115 | } |
| 116 | |
| 117 | } // namespace printing |