| 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 <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 scoped_refptr<PrintedDocument> document_; | 228 scoped_refptr<PrintedDocument> document_; |
| 223 scoped_refptr<PrintedPage> page_; | 229 scoped_refptr<PrintedPage> page_; |
| 224 const Type type_; | 230 const Type type_; |
| 225 | 231 |
| 226 DISALLOW_COPY_AND_ASSIGN(JobEventDetails); | 232 DISALLOW_COPY_AND_ASSIGN(JobEventDetails); |
| 227 }; | 233 }; |
| 228 | 234 |
| 229 } // namespace printing | 235 } // namespace printing |
| 230 | 236 |
| 231 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_ | 237 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_ |
| OLD | NEW |