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

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

Issue 2633573002: Add Postscript Printing (Closed)
Patch Set: Fix Linux compile error 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.
(...skipping 10 matching lines...) Expand all
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 OnPdfToEmfStarted(int page_count); 134 void OnPdfToEmfStarted(int page_count);
129 void OnPdfToEmfPageConverted(int page_number, 135 void OnPdfToEmfPageConverted(int page_number,
130 float scale_factor, 136 float scale_factor,
131 std::unique_ptr<MetafilePlayer> emf); 137 std::unique_ptr<MetafilePlayer> emf);
138
139 void OnPdfToPostScriptStarted(int page_count);
140 void OnPdfToPostScriptPageConverted(
141 int page_number,
142 std::unique_ptr<MetafilePlayer> ps_metafile);
132 #endif // defined(OS_WIN) 143 #endif // defined(OS_WIN)
133 144
134 content::NotificationRegistrar registrar_; 145 content::NotificationRegistrar registrar_;
135 146
136 // Source that generates the PrintedPage's (i.e. a WebContents). It will be 147 // 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. 148 // set back to NULL if the source is deleted before this object.
138 PrintedPagesSource* source_; 149 PrintedPagesSource* source_;
139 150
140 // All the UI is done in a worker thread because many Win32 print functions 151 // 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 152 // are blocking and enters a message loop without your consent. There is one
142 // worker thread per print job. 153 // worker thread per print job.
143 std::unique_ptr<PrintJobWorker> worker_; 154 std::unique_ptr<PrintJobWorker> worker_;
144 155
145 // Cache of the print context settings for access in the UI thread. 156 // Cache of the print context settings for access in the UI thread.
146 PrintSettings settings_; 157 PrintSettings settings_;
147 158
148 // The printed document. 159 // The printed document.
149 scoped_refptr<PrintedDocument> document_; 160 scoped_refptr<PrintedDocument> document_;
150 161
151 // Is the worker thread printing. 162 // Is the worker thread printing.
152 bool is_job_pending_; 163 bool is_job_pending_;
153 164
154 // Is Canceling? If so, try to not cause recursion if on FAILED notification, 165 // Is Canceling? If so, try to not cause recursion if on FAILED notification,
155 // the notified calls Cancel() again. 166 // the notified calls Cancel() again.
156 bool is_canceling_; 167 bool is_canceling_;
157 168
158 #if defined(OS_WIN) 169 #if defined(OS_WIN)
159 class PdfToEmfState; 170 class PdfToEmfState;
160 std::unique_ptr<PdfToEmfState> pdf_to_emf_state_; 171 std::unique_ptr<PdfToEmfState> pdf_to_emf_state_;
172 class PdfToPostScriptState;
173 std::unique_ptr<PdfToPostScriptState> pdf_to_ps_state_;
161 std::vector<int> pdf_page_mapping_; 174 std::vector<int> pdf_page_mapping_;
162 #endif // defined(OS_WIN) 175 #endif // defined(OS_WIN)
163 176
164 // Used at shutdown so that we can quit a nested message loop. 177 // Used at shutdown so that we can quit a nested message loop.
165 base::WeakPtrFactory<PrintJob> quit_factory_; 178 base::WeakPtrFactory<PrintJob> quit_factory_;
166 179
167 DISALLOW_COPY_AND_ASSIGN(PrintJob); 180 DISALLOW_COPY_AND_ASSIGN(PrintJob);
168 }; 181 };
169 182
170 // Details for a NOTIFY_PRINT_JOB_EVENT notification. The members may be NULL. 183 // Details for a NOTIFY_PRINT_JOB_EVENT notification. The members may be NULL.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 scoped_refptr<PrintedDocument> document_; 235 scoped_refptr<PrintedDocument> document_;
223 scoped_refptr<PrintedPage> page_; 236 scoped_refptr<PrintedPage> page_;
224 const Type type_; 237 const Type type_;
225 238
226 DISALLOW_COPY_AND_ASSIGN(JobEventDetails); 239 DISALLOW_COPY_AND_ASSIGN(JobEventDetails);
227 }; 240 };
228 241
229 } // namespace printing 242 } // namespace printing
230 243
231 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_ 244 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698