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

Side by Side Diff: chrome/browser/printing/print_job.h

Issue 2633573002: Add Postscript Printing (Closed)
Patch Set: Rebase Created 3 years, 11 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
OLDNEW
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 <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 #if defined(OS_WIN) 93 #if defined(OS_WIN)
94 // Let the PrintJob know the 0-based |page_number| of a given printed page. 94 // Let the PrintJob know the 0-based |page_number| of a given printed page.
95 void AppendPrintedPage(int page_number); 95 void AppendPrintedPage(int page_number);
96 96
97 void StartPdfToEmfConversion( 97 void StartPdfToEmfConversion(
98 const scoped_refptr<base::RefCountedMemory>& bytes, 98 const scoped_refptr<base::RefCountedMemory>& bytes,
99 const gfx::Size& page_size, 99 const gfx::Size& page_size,
100 const gfx::Rect& content_area, 100 const gfx::Rect& content_area,
101 bool print_text_with_gdi); 101 bool print_text_with_gdi);
102
103 void StartPdfToPostScriptConversion(
104 const scoped_refptr<base::RefCountedMemory>& bytes,
105 const gfx::Rect& content_area,
106 const gfx::Point& physical_offset,
107 bool ps_level2);
102 #endif // defined(OS_WIN) 108 #endif // defined(OS_WIN)
103 109
104 protected: 110 protected:
105 ~PrintJob() override; 111 ~PrintJob() override;
106 112
107 private: 113 private:
108 // Updates |document_| to a new instance. 114 // Updates |document_| to a new instance.
109 void UpdatePrintedDocument(PrintedDocument* new_document); 115 void UpdatePrintedDocument(PrintedDocument* new_document);
110 116
111 // Processes a NOTIFY_PRINT_JOB_EVENT notification. 117 // Processes a NOTIFY_PRINT_JOB_EVENT notification.
112 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); 118 void OnNotifyPrintJobEvent(const JobEventDetails& event_details);
113 119
114 // Releases the worker thread by calling Stop(), then broadcasts a JOB_DONE 120 // Releases the worker thread by calling Stop(), then broadcasts a JOB_DONE
115 // notification. 121 // notification.
116 void OnDocumentDone(); 122 void OnDocumentDone();
117 123
118 // Terminates the worker thread in a very controlled way, to work around any 124 // Terminates the worker thread in a very controlled way, to work around any
119 // eventual deadlock. 125 // eventual deadlock.
120 void ControlledWorkerShutdown(); 126 void ControlledWorkerShutdown();
121 127
122 // Called at shutdown when running a nested message loop. 128 // Called at shutdown when running a nested message loop.
123 void Quit(); 129 void Quit();
124 130
125 void HoldUntilStopIsCalled(); 131 void HoldUntilStopIsCalled();
126 132
127 #if defined(OS_WIN) 133 #if defined(OS_WIN)
128 void OnPdfConversionStarted(int page_count); 134 void OnPdfConversionStarted(int page_count);
129 void OnPdfPageConverted(int page_number, 135 void OnPdfPageConverted(int page_number,
130 float scale_factor, 136 float scale_factor,
131 std::unique_ptr<MetafilePlayer> emf); 137 std::unique_ptr<MetafilePlayer> metafile);
132 #endif // defined(OS_WIN) 138 #endif // defined(OS_WIN)
133 139
134 content::NotificationRegistrar registrar_; 140 content::NotificationRegistrar registrar_;
135 141
136 // Source that generates the PrintedPage's (i.e. a WebContents). It will be 142 // Source that generates the PrintedPage's (i.e. a WebContents). It will be
137 // set back to NULL if the source is deleted before this object. 143 // set back to NULL if the source is deleted before this object.
138 PrintedPagesSource* source_; 144 PrintedPagesSource* source_;
139 145
140 // All the UI is done in a worker thread because many Win32 print functions 146 // All the UI is done in a worker thread because many Win32 print functions
141 // are blocking and enters a message loop without your consent. There is one 147 // are blocking and enters a message loop without your consent. There is one
142 // worker thread per print job. 148 // worker thread per print job.
143 std::unique_ptr<PrintJobWorker> worker_; 149 std::unique_ptr<PrintJobWorker> worker_;
144 150
145 // Cache of the print context settings for access in the UI thread. 151 // Cache of the print context settings for access in the UI thread.
146 PrintSettings settings_; 152 PrintSettings settings_;
147 153
148 // The printed document. 154 // The printed document.
149 scoped_refptr<PrintedDocument> document_; 155 scoped_refptr<PrintedDocument> document_;
150 156
151 // Is the worker thread printing. 157 // Is the worker thread printing.
152 bool is_job_pending_; 158 bool is_job_pending_;
153 159
154 // Is Canceling? If so, try to not cause recursion if on FAILED notification, 160 // Is Canceling? If so, try to not cause recursion if on FAILED notification,
155 // the notified calls Cancel() again. 161 // the notified calls Cancel() again.
156 bool is_canceling_; 162 bool is_canceling_;
157 163
158 #if defined(OS_WIN) 164 #if defined(OS_WIN)
165 bool is_postscript_;
Vitaly Buka (NO REVIEWS) 2017/01/27 00:38:49 I don't see where this is initialized I'd put ini
rbpotter 2017/01/27 16:37:21 Acknowledged.
159 class PdfConversionState; 166 class PdfConversionState;
160 std::unique_ptr<PdfConversionState> pdf_conversion_state_; 167 std::unique_ptr<PdfConversionState> pdf_conversion_state_;
161 std::vector<int> pdf_page_mapping_; 168 std::vector<int> pdf_page_mapping_;
162 #endif // defined(OS_WIN) 169 #endif // defined(OS_WIN)
163 170
164 // Used at shutdown so that we can quit a nested message loop. 171 // Used at shutdown so that we can quit a nested message loop.
165 base::WeakPtrFactory<PrintJob> quit_factory_; 172 base::WeakPtrFactory<PrintJob> quit_factory_;
166 173
167 DISALLOW_COPY_AND_ASSIGN(PrintJob); 174 DISALLOW_COPY_AND_ASSIGN(PrintJob);
168 }; 175 };
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 scoped_refptr<PrintedDocument> document_; 229 scoped_refptr<PrintedDocument> document_;
223 scoped_refptr<PrintedPage> page_; 230 scoped_refptr<PrintedPage> page_;
224 const Type type_; 231 const Type type_;
225 232
226 DISALLOW_COPY_AND_ASSIGN(JobEventDetails); 233 DISALLOW_COPY_AND_ASSIGN(JobEventDetails);
227 }; 234 };
228 235
229 } // namespace printing 236 } // namespace printing
230 237
231 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_ 238 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698