OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/printing/print_job.h" | 5 #include "chrome/browser/printing/print_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // The job should be finished (or at least canceled) when it is destroyed. | 50 // The job should be finished (or at least canceled) when it is destroyed. |
51 DCHECK(!is_job_pending_); | 51 DCHECK(!is_job_pending_); |
52 DCHECK(!is_canceling_); | 52 DCHECK(!is_canceling_); |
53 if (worker_.get()) | 53 if (worker_.get()) |
54 DCHECK(worker_->message_loop() == NULL); | 54 DCHECK(worker_->message_loop() == NULL); |
55 DCHECK_EQ(ui_message_loop_, MessageLoop::current()); | 55 DCHECK_EQ(ui_message_loop_, MessageLoop::current()); |
56 } | 56 } |
57 | 57 |
58 void PrintJob::Initialize(PrintJobWorkerOwner* job, | 58 void PrintJob::Initialize(PrintJobWorkerOwner* job, |
59 PrintedPagesSource* source, | 59 PrintedPagesSource* source, |
| 60 PrintedDocument::Delegate* printed_document_delegate, |
60 int page_count) { | 61 int page_count) { |
61 DCHECK(!source_); | 62 DCHECK(!source_); |
62 DCHECK(!worker_.get()); | 63 DCHECK(!worker_.get()); |
63 DCHECK(!is_job_pending_); | 64 DCHECK(!is_job_pending_); |
64 DCHECK(!is_canceling_); | 65 DCHECK(!is_canceling_); |
65 DCHECK(!document_.get()); | 66 DCHECK(!document_.get()); |
66 source_ = source; | 67 source_ = source; |
67 worker_.reset(job->DetachWorker(this)); | 68 worker_.reset(job->DetachWorker(this)); |
68 settings_ = job->settings(); | 69 settings_ = job->settings(); |
69 | 70 |
70 PrintedDocument* new_doc = | 71 PrintedDocument* new_doc = new PrintedDocument( |
71 new PrintedDocument(settings_, source_, job->cookie()); | 72 settings_, source_, printed_document_delegate, job->cookie()); |
72 new_doc->set_page_count(page_count); | 73 new_doc->set_page_count(page_count); |
73 UpdatePrintedDocument(new_doc); | 74 UpdatePrintedDocument(new_doc); |
74 | 75 |
75 // Don't forget to register to our own messages. | 76 // Don't forget to register to our own messages. |
76 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, | 77 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, |
77 content::Source<PrintJob>(this)); | 78 content::Source<PrintJob>(this)); |
78 } | 79 } |
79 | 80 |
80 void PrintJob::Observe(int type, | 81 void PrintJob::Observe(int type, |
81 const content::NotificationSource& source, | 82 const content::NotificationSource& source, |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 369 |
369 PrintedDocument* JobEventDetails::document() const { | 370 PrintedDocument* JobEventDetails::document() const { |
370 return document_; | 371 return document_; |
371 } | 372 } |
372 | 373 |
373 PrintedPage* JobEventDetails::page() const { | 374 PrintedPage* JobEventDetails::page() const { |
374 return page_; | 375 return page_; |
375 } | 376 } |
376 | 377 |
377 } // namespace printing | 378 } // namespace printing |
OLD | NEW |