OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_WORKER_H__ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H__ |
6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H__ | 6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H__ |
7 | 7 |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "base/thread.h" | 9 #include "base/thread.h" |
10 #include "gfx/native_widget_types.h" | 10 #include "gfx/native_widget_types.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 class PrintJobWorker : public base::Thread { | 27 class PrintJobWorker : public base::Thread { |
28 public: | 28 public: |
29 explicit PrintJobWorker(PrintJobWorkerOwner* owner); | 29 explicit PrintJobWorker(PrintJobWorkerOwner* owner); |
30 ~PrintJobWorker(); | 30 ~PrintJobWorker(); |
31 | 31 |
32 void SetNewOwner(PrintJobWorkerOwner* new_owner); | 32 void SetNewOwner(PrintJobWorkerOwner* new_owner); |
33 | 33 |
34 // Initializes the print settings. If |ask_user_for_settings| is true, a | 34 // Initializes the print settings. If |ask_user_for_settings| is true, a |
35 // Print... dialog box will be shown to ask the user his preference. | 35 // Print... dialog box will be shown to ask the user his preference. |
36 void GetSettings(bool ask_user_for_settings, | 36 void GetSettings(bool ask_user_for_settings, |
37 gfx::NativeWindow parent_window, | 37 gfx::NativeView parent_view, |
38 int document_page_count, | 38 int document_page_count, |
39 bool has_selection, | 39 bool has_selection, |
40 bool use_overlays); | 40 bool use_overlays); |
41 | 41 |
42 // Starts the printing loop. Every pages are printed as soon as the data is | 42 // Starts the printing loop. Every pages are printed as soon as the data is |
43 // available. Makes sure the new_document is the right one. | 43 // available. Makes sure the new_document is the right one. |
44 void StartPrinting(PrintedDocument* new_document); | 44 void StartPrinting(PrintedDocument* new_document); |
45 | 45 |
46 // Updates the printed document. | 46 // Updates the printed document. |
47 void OnDocumentChanged(PrintedDocument* new_document); | 47 void OnDocumentChanged(PrintedDocument* new_document); |
(...skipping 28 matching lines...) Expand all Loading... |
76 // Closes the job since spooling is done. | 76 // Closes the job since spooling is done. |
77 void OnDocumentDone(); | 77 void OnDocumentDone(); |
78 | 78 |
79 // Discards the current document, the current page and cancels the printing | 79 // Discards the current document, the current page and cancels the printing |
80 // context. | 80 // context. |
81 void OnFailure(); | 81 void OnFailure(); |
82 | 82 |
83 #if defined(OS_MACOSX) | 83 #if defined(OS_MACOSX) |
84 // Asks the user for print settings. Must be called on the UI thread. | 84 // Asks the user for print settings. Must be called on the UI thread. |
85 // Mac-only since Windows can display UI from non-main threads. | 85 // Mac-only since Windows can display UI from non-main threads. |
86 void GetSettingsWithUI(gfx::NativeWindow parent_window, | 86 void GetSettingsWithUI(gfx::NativeView parent_view, |
87 int document_page_count, | 87 int document_page_count, |
88 bool has_selection); | 88 bool has_selection); |
89 #endif | 89 #endif |
90 | 90 |
91 // Reports settings back to owner_. | 91 // Reports settings back to owner_. |
92 void GetSettingsDone(PrintingContext::Result result); | 92 void GetSettingsDone(PrintingContext::Result result); |
93 | 93 |
94 // Information about the printer setting. | 94 // Information about the printer setting. |
95 PrintingContext printing_context_; | 95 PrintingContext printing_context_; |
96 | 96 |
(...skipping 14 matching lines...) Expand all Loading... |
111 | 111 |
112 template <> | 112 template <> |
113 struct RunnableMethodTraits<printing::PrintJobWorker> { | 113 struct RunnableMethodTraits<printing::PrintJobWorker> { |
114 void RetainCallee(printing::PrintJobWorker* obj); | 114 void RetainCallee(printing::PrintJobWorker* obj); |
115 void ReleaseCallee(printing::PrintJobWorker* obj); | 115 void ReleaseCallee(printing::PrintJobWorker* obj); |
116 private: | 116 private: |
117 scoped_refptr<printing::PrintJobWorkerOwner> owner_; | 117 scoped_refptr<printing::PrintJobWorkerOwner> owner_; |
118 }; | 118 }; |
119 | 119 |
120 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H__ | 120 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H__ |
OLD | NEW |