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 <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <gtk/gtkprintunixdialog.h> | 8 #include <gtk/gtkprintunixdialog.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 | 11 |
12 namespace printing { | 12 namespace printing { |
13 | 13 |
14 PrintingContext::PrintingContext() | 14 PrintingContext::PrintingContext() |
15 : | 15 : |
16 #ifndef NDEBUG | |
17 page_number_(-1), | |
18 #endif | |
19 dialog_box_dismissed_(false), | 16 dialog_box_dismissed_(false), |
20 in_print_job_(false), | 17 in_print_job_(false), |
21 abort_printing_(false) { | 18 abort_printing_(false) { |
22 } | 19 } |
23 | 20 |
24 PrintingContext::~PrintingContext() { | 21 PrintingContext::~PrintingContext() { |
25 ResetSettings(); | 22 ResetSettings(); |
26 } | 23 } |
27 | 24 |
28 void PrintingContext::AskUserForSettings( | 25 void PrintingContext::AskUserForSettings( |
(...skipping 30 matching lines...) Expand all Loading... |
59 const PrintSettings& settings) { | 56 const PrintSettings& settings) { |
60 DCHECK(!in_print_job_); | 57 DCHECK(!in_print_job_); |
61 settings_ = settings; | 58 settings_ = settings; |
62 | 59 |
63 NOTIMPLEMENTED(); | 60 NOTIMPLEMENTED(); |
64 | 61 |
65 return FAILED; | 62 return FAILED; |
66 } | 63 } |
67 | 64 |
68 void PrintingContext::ResetSettings() { | 65 void PrintingContext::ResetSettings() { |
69 #ifndef NDEBUG | |
70 page_number_ = -1; | |
71 #endif | |
72 dialog_box_dismissed_ = false; | 66 dialog_box_dismissed_ = false; |
73 abort_printing_ = false; | 67 abort_printing_ = false; |
74 in_print_job_ = false; | 68 in_print_job_ = false; |
75 } | 69 } |
76 | 70 |
77 PrintingContext::Result PrintingContext::NewDocument( | 71 PrintingContext::Result PrintingContext::NewDocument( |
78 const string16& document_name) { | 72 const string16& document_name) { |
79 DCHECK(!in_print_job_); | 73 DCHECK(!in_print_job_); |
80 | 74 |
81 NOTIMPLEMENTED(); | 75 NOTIMPLEMENTED(); |
82 | 76 |
83 #ifndef NDEBUG | |
84 page_number_ = 0; | |
85 #endif | |
86 | |
87 return FAILED; | 77 return FAILED; |
88 } | 78 } |
89 | 79 |
90 PrintingContext::Result PrintingContext::NewPage() { | 80 PrintingContext::Result PrintingContext::NewPage() { |
91 if (abort_printing_) | 81 if (abort_printing_) |
92 return CANCEL; | 82 return CANCEL; |
93 DCHECK(in_print_job_); | 83 DCHECK(in_print_job_); |
94 | 84 |
95 NOTIMPLEMENTED(); | 85 NOTIMPLEMENTED(); |
96 | 86 |
97 #ifndef NDEBUG | |
98 ++page_number_; | |
99 #endif | |
100 | |
101 return FAILED; | 87 return FAILED; |
102 } | 88 } |
103 | 89 |
104 PrintingContext::Result PrintingContext::PageDone() { | 90 PrintingContext::Result PrintingContext::PageDone() { |
105 if (abort_printing_) | 91 if (abort_printing_) |
106 return CANCEL; | 92 return CANCEL; |
107 DCHECK(in_print_job_); | 93 DCHECK(in_print_job_); |
108 | 94 |
109 NOTIMPLEMENTED(); | 95 NOTIMPLEMENTED(); |
110 | 96 |
(...skipping 21 matching lines...) Expand all Loading... |
132 void PrintingContext::DismissDialog() { | 118 void PrintingContext::DismissDialog() { |
133 NOTIMPLEMENTED(); | 119 NOTIMPLEMENTED(); |
134 } | 120 } |
135 | 121 |
136 PrintingContext::Result PrintingContext::OnError() { | 122 PrintingContext::Result PrintingContext::OnError() { |
137 ResetSettings(); | 123 ResetSettings(); |
138 return abort_printing_ ? CANCEL : FAILED; | 124 return abort_printing_ ? CANCEL : FAILED; |
139 } | 125 } |
140 | 126 |
141 } // namespace printing | 127 } // namespace printing |
OLD | NEW |