| 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 #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_H_ |
| 6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "chrome/browser/printing/print_job_worker_owner.h" | 13 #include "chrome/browser/printing/print_job_worker_owner.h" |
| 14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 16 #include "printing/printed_document.h" |
| 16 | 17 |
| 17 class Thread; | 18 class Thread; |
| 18 | 19 |
| 19 namespace printing { | 20 namespace printing { |
| 20 | 21 |
| 21 // See definition below. | 22 // See definition below. |
| 22 class JobEventDetails; | 23 class JobEventDetails; |
| 23 | 24 |
| 24 class PrintedDocument; | |
| 25 class PrintedPage; | 25 class PrintedPage; |
| 26 class PrintedPagesSource; | 26 class PrintedPagesSource; |
| 27 class PrintJobWorker; | 27 class PrintJobWorker; |
| 28 class PrinterQuery; | 28 class PrinterQuery; |
| 29 | 29 |
| 30 // Manages the print work for a specific document. Talks to the printer through | 30 // Manages the print work for a specific document. Talks to the printer through |
| 31 // PrintingContext though PrintJob::Worker. Hides access to PrintingContext in a | 31 // PrintingContext though PrintJob::Worker. Hides access to PrintingContext in a |
| 32 // worker thread so the caller never blocks. PrintJob will send notifications on | 32 // worker thread so the caller never blocks. PrintJob will send notifications on |
| 33 // any state change. While printing, the PrintJobManager instance keeps a | 33 // any state change. While printing, the PrintJobManager instance keeps a |
| 34 // reference to the job to be sure it is kept alive. All the code in this class | 34 // reference to the job to be sure it is kept alive. All the code in this class |
| 35 // runs in the UI thread. | 35 // runs in the UI thread. |
| 36 class PrintJob : public PrintJobWorkerOwner, | 36 class PrintJob : public PrintJobWorkerOwner, |
| 37 public content::NotificationObserver, | 37 public content::NotificationObserver, |
| 38 public MessageLoop::DestructionObserver { | 38 public MessageLoop::DestructionObserver { |
| 39 public: | 39 public: |
| 40 // Create a empty PrintJob. When initializing with this constructor, | 40 // Create a empty PrintJob. When initializing with this constructor, |
| 41 // post-constructor initialization must be done with Initialize(). | 41 // post-constructor initialization must be done with Initialize(). |
| 42 PrintJob(); | 42 PrintJob(); |
| 43 | 43 |
| 44 // Grabs the ownership of the PrintJobWorker from another job, which is | 44 // Grabs the ownership of the PrintJobWorker from another job, which is |
| 45 // usually a PrinterQuery. Set the expected page count of the print job. | 45 // usually a PrinterQuery. Set the expected page count of the print job. |
| 46 void Initialize(PrintJobWorkerOwner* job, PrintedPagesSource* source, | 46 void Initialize(PrintJobWorkerOwner* job, PrintedPagesSource* source, |
| 47 PrintedDocument::Delegate* printed_document_delegate, |
| 47 int page_count); | 48 int page_count); |
| 48 | 49 |
| 49 // content::NotificationObserver implementation. | 50 // content::NotificationObserver implementation. |
| 50 virtual void Observe(int type, | 51 virtual void Observe(int type, |
| 51 const content::NotificationSource& source, | 52 const content::NotificationSource& source, |
| 52 const content::NotificationDetails& details) OVERRIDE; | 53 const content::NotificationDetails& details) OVERRIDE; |
| 53 | 54 |
| 54 // PrintJobWorkerOwner implementation. | 55 // PrintJobWorkerOwner implementation. |
| 55 virtual void GetSettingsDone(const PrintSettings& new_settings, | 56 virtual void GetSettingsDone(const PrintSettings& new_settings, |
| 56 PrintingContext::Result result) OVERRIDE; | 57 PrintingContext::Result result) OVERRIDE; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 scoped_refptr<PrintedDocument> document_; | 202 scoped_refptr<PrintedDocument> document_; |
| 202 scoped_refptr<PrintedPage> page_; | 203 scoped_refptr<PrintedPage> page_; |
| 203 const Type type_; | 204 const Type type_; |
| 204 | 205 |
| 205 DISALLOW_COPY_AND_ASSIGN(JobEventDetails); | 206 DISALLOW_COPY_AND_ASSIGN(JobEventDetails); |
| 206 }; | 207 }; |
| 207 | 208 |
| 208 } // namespace printing | 209 } // namespace printing |
| 209 | 210 |
| 210 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_ | 211 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_ |
| OLD | NEW |