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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // Create a empty PrintJob. When initializing with this constructor, | 42 // Create a empty PrintJob. When initializing with this constructor, |
43 // post-constructor initialization must be done with Initialize(). | 43 // post-constructor initialization must be done with Initialize(). |
44 PrintJob(); | 44 PrintJob(); |
45 | 45 |
46 // Grabs the ownership of the PrintJobWorker from another job, which is | 46 // Grabs the ownership of the PrintJobWorker from another job, which is |
47 // usually a PrinterQuery. Set the expected page count of the print job. | 47 // usually a PrinterQuery. Set the expected page count of the print job. |
48 void Initialize(PrintJobWorkerOwner* job, PrintedPagesSource* source, | 48 void Initialize(PrintJobWorkerOwner* job, PrintedPagesSource* source, |
49 int page_count); | 49 int page_count); |
50 | 50 |
51 // content::NotificationObserver implementation. | 51 // content::NotificationObserver implementation. |
52 virtual void Observe(int type, | 52 void Observe(int type, |
53 const content::NotificationSource& source, | 53 const content::NotificationSource& source, |
54 const content::NotificationDetails& details) override; | 54 const content::NotificationDetails& details) override; |
55 | 55 |
56 // PrintJobWorkerOwner implementation. | 56 // PrintJobWorkerOwner implementation. |
57 virtual void GetSettingsDone(const PrintSettings& new_settings, | 57 void GetSettingsDone(const PrintSettings& new_settings, |
58 PrintingContext::Result result) override; | 58 PrintingContext::Result result) override; |
59 virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner) override; | 59 PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner) override; |
60 virtual const PrintSettings& settings() const override; | 60 const PrintSettings& settings() const override; |
61 virtual int cookie() const override; | 61 int cookie() const override; |
62 | 62 |
63 // Starts the actual printing. Signals the worker that it should begin to | 63 // Starts the actual printing. Signals the worker that it should begin to |
64 // spool as soon as data is available. | 64 // spool as soon as data is available. |
65 void StartPrinting(); | 65 void StartPrinting(); |
66 | 66 |
67 // Asks for the worker thread to finish its queued tasks and disconnects the | 67 // Asks for the worker thread to finish its queued tasks and disconnects the |
68 // delegate object. The PrintJobManager will remove its reference. This may | 68 // delegate object. The PrintJobManager will remove its reference. This may |
69 // have the side-effect of destroying the object if the caller doesn't have a | 69 // have the side-effect of destroying the object if the caller doesn't have a |
70 // handle to the object. Use PrintJob::is_stopped() to check whether the | 70 // handle to the object. Use PrintJob::is_stopped() to check whether the |
71 // worker thread has actually stopped. | 71 // worker thread has actually stopped. |
(...skipping 19 matching lines...) Expand all Loading... |
91 PrintedDocument* document() const; | 91 PrintedDocument* document() const; |
92 | 92 |
93 #if defined(OS_WIN) | 93 #if defined(OS_WIN) |
94 void StartPdfToEmfConversion( | 94 void StartPdfToEmfConversion( |
95 const scoped_refptr<base::RefCountedMemory>& bytes, | 95 const scoped_refptr<base::RefCountedMemory>& bytes, |
96 const gfx::Size& page_size, | 96 const gfx::Size& page_size, |
97 const gfx::Rect& content_area); | 97 const gfx::Rect& content_area); |
98 #endif // OS_WIN | 98 #endif // OS_WIN |
99 | 99 |
100 protected: | 100 protected: |
101 virtual ~PrintJob(); | 101 ~PrintJob() override; |
102 | 102 |
103 private: | 103 private: |
104 // Updates document_ to a new instance. | 104 // Updates document_ to a new instance. |
105 void UpdatePrintedDocument(PrintedDocument* new_document); | 105 void UpdatePrintedDocument(PrintedDocument* new_document); |
106 | 106 |
107 // Processes a NOTIFY_PRINT_JOB_EVENT notification. | 107 // Processes a NOTIFY_PRINT_JOB_EVENT notification. |
108 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); | 108 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); |
109 | 109 |
110 // Releases the worker thread by calling Stop(), then broadcasts a JOB_DONE | 110 // Releases the worker thread by calling Stop(), then broadcasts a JOB_DONE |
111 // notification. | 111 // notification. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 scoped_refptr<PrintedDocument> document_; | 217 scoped_refptr<PrintedDocument> document_; |
218 scoped_refptr<PrintedPage> page_; | 218 scoped_refptr<PrintedPage> page_; |
219 const Type type_; | 219 const Type type_; |
220 | 220 |
221 DISALLOW_COPY_AND_ASSIGN(JobEventDetails); | 221 DISALLOW_COPY_AND_ASSIGN(JobEventDetails); |
222 }; | 222 }; |
223 | 223 |
224 } // namespace printing | 224 } // namespace printing |
225 | 225 |
226 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_ | 226 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_ |
OLD | NEW |