Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: printing/printing_context_win.cc

Issue 3417025: Printing: Remove the debug-only |page_number_| from PrintingContext, which has (Closed)
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « printing/printing_context_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 private: 115 private:
116 PrintingContext& owner_; 116 PrintingContext& owner_;
117 HWND owner_hwnd_; 117 HWND owner_hwnd_;
118 IPrintDialogServices* services_; 118 IPrintDialogServices* services_;
119 119
120 DISALLOW_COPY_AND_ASSIGN(CallbackHandler); 120 DISALLOW_COPY_AND_ASSIGN(CallbackHandler);
121 }; 121 };
122 122
123 PrintingContext::PrintingContext() 123 PrintingContext::PrintingContext()
124 : context_(NULL), 124 : context_(NULL),
125 #ifndef NDEBUG
126 page_number_(-1),
127 #endif
128 dialog_box_(NULL), 125 dialog_box_(NULL),
129 dialog_box_dismissed_(false), 126 dialog_box_dismissed_(false),
130 in_print_job_(false), 127 in_print_job_(false),
131 abort_printing_(false), 128 abort_printing_(false),
132 print_dialog_func_(&PrintDlgEx) { 129 print_dialog_func_(&PrintDlgEx) {
133 } 130 }
134 131
135 PrintingContext::~PrintingContext() { 132 PrintingContext::~PrintingContext() {
136 ResetSettings(); 133 ResetSettings();
137 } 134 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 return status; 230 return status;
234 } 231 }
235 232
236 void PrintingContext::ResetSettings() { 233 void PrintingContext::ResetSettings() {
237 if (context_ != NULL) { 234 if (context_ != NULL) {
238 DeleteDC(context_); 235 DeleteDC(context_);
239 context_ = NULL; 236 context_ = NULL;
240 } 237 }
241 settings_.Clear(); 238 settings_.Clear();
242 in_print_job_ = false; 239 in_print_job_ = false;
243
244 #ifndef NDEBUG
245 page_number_ = -1;
246 #endif
247 } 240 }
248 241
249 PrintingContext::Result PrintingContext::NewDocument( 242 PrintingContext::Result PrintingContext::NewDocument(
250 const string16& document_name) { 243 const string16& document_name) {
251 DCHECK(!in_print_job_); 244 DCHECK(!in_print_job_);
252 if (!context_) 245 if (!context_)
253 return OnError(); 246 return OnError();
254 247
255 // Set the flag used by the AbortPrintJob dialog procedure. 248 // Set the flag used by the AbortPrintJob dialog procedure.
256 abort_printing_ = false; 249 abort_printing_ = false;
(...skipping 28 matching lines...) Expand all
285 // No message loop running in unit tests. 278 // No message loop running in unit tests.
286 DCHECK(!MessageLoop::current() ? true : 279 DCHECK(!MessageLoop::current() ? true :
287 !MessageLoop::current()->NestableTasksAllowed()); 280 !MessageLoop::current()->NestableTasksAllowed());
288 281
289 // Begin a print job by calling the StartDoc function. 282 // Begin a print job by calling the StartDoc function.
290 // NOTE: StartDoc() starts a message loop. That causes a lot of problems with 283 // NOTE: StartDoc() starts a message loop. That causes a lot of problems with
291 // IPC. Make sure recursive task processing is disabled. 284 // IPC. Make sure recursive task processing is disabled.
292 if (StartDoc(context_, &di) <= 0) 285 if (StartDoc(context_, &di) <= 0)
293 return OnError(); 286 return OnError();
294 287
295 #ifndef NDEBUG
296 page_number_ = 0;
297 #endif
298 return OK; 288 return OK;
299 } 289 }
300 290
301 PrintingContext::Result PrintingContext::NewPage() { 291 PrintingContext::Result PrintingContext::NewPage() {
302 if (abort_printing_) 292 if (abort_printing_)
303 return CANCEL; 293 return CANCEL;
304 294
305 DCHECK(context_); 295 DCHECK(context_);
306 DCHECK(in_print_job_); 296 DCHECK(in_print_job_);
307 297
308 // Inform the driver that the application is about to begin sending data. 298 // Inform the driver that the application is about to begin sending data.
309 if (StartPage(context_) <= 0) 299 if (StartPage(context_) <= 0)
310 return OnError(); 300 return OnError();
311 301
312 #ifndef NDEBUG
313 ++page_number_;
314 #endif
315
316 return OK; 302 return OK;
317 } 303 }
318 304
319 PrintingContext::Result PrintingContext::PageDone() { 305 PrintingContext::Result PrintingContext::PageDone() {
320 if (abort_printing_) 306 if (abort_printing_)
321 return CANCEL; 307 return CANCEL;
322 DCHECK(in_print_job_); 308 DCHECK(in_print_job_);
323 309
324 if (EndPage(context_) <= 0) 310 if (EndPage(context_) <= 0)
325 return OnError(); 311 return OnError();
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 if (buf_size) { 599 if (buf_size) {
614 buffer->reset(new uint8[buf_size]); 600 buffer->reset(new uint8[buf_size]);
615 memset(buffer->get(), 0, buf_size); 601 memset(buffer->get(), 0, buf_size);
616 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { 602 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) {
617 buffer->reset(); 603 buffer->reset();
618 } 604 }
619 } 605 }
620 } 606 }
621 607
622 } // namespace printing 608 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printing_context_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698