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_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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.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 21 matching lines...) Loading... | |
32 // PrintJob always outlives its worker instance. | 32 // PrintJob always outlives its worker instance. |
33 class PrintJobWorker { | 33 class PrintJobWorker { |
34 public: | 34 public: |
35 PrintJobWorker(int render_process_id, | 35 PrintJobWorker(int render_process_id, |
36 int render_view_id, | 36 int render_view_id, |
37 PrintJobWorkerOwner* owner); | 37 PrintJobWorkerOwner* owner); |
38 virtual ~PrintJobWorker(); | 38 virtual ~PrintJobWorker(); |
39 | 39 |
40 void SetNewOwner(PrintJobWorkerOwner* new_owner); | 40 void SetNewOwner(PrintJobWorkerOwner* new_owner); |
41 | 41 |
42 // Initializes the print settings. If |ask_user_for_settings| is true, a | 42 // Initializes the print settings. If |ask_settings_type| is ASK_USER, a |
43 // Print... dialog box will be shown to ask the user his preference. | 43 // Print... dialog box will be shown by the browser to ask the user his |
44 // preference. If it is SYSTEM_SPECIFIC, showing that dialog box will be | |
mlamouri (slow - plz ping)
2014/11/27 20:26:02
I do not understand why this is needed.
dgn
2014/11/28 11:51:15
Updated the comment. I tried to address that in mo
| |
45 // delegated to the system. | |
44 void GetSettings( | 46 void GetSettings( |
45 bool ask_user_for_settings, | 47 GetSettingsAskParam ask_settings_type, |
46 int document_page_count, | 48 int document_page_count, |
47 bool has_selection, | 49 bool has_selection, |
48 MarginType margin_type); | 50 MarginType margin_type); |
49 | 51 |
50 // Set the new print settings. | 52 // Set the new print settings. |
51 void SetSettings(scoped_ptr<base::DictionaryValue> new_settings); | 53 void SetSettings(scoped_ptr<base::DictionaryValue> new_settings); |
52 | 54 |
53 // Starts the printing loop. Every pages are printed as soon as the data is | 55 // Starts the printing loop. Every pages are printed as soon as the data is |
54 // available. Makes sure the new_document is the right one. | 56 // available. Makes sure the new_document is the right one. |
55 void StartPrinting(PrintedDocument* new_document); | 57 void StartPrinting(PrintedDocument* new_document); |
(...skipping 52 matching lines...) Loading... | |
108 // but sticks with this for consistency. | 110 // but sticks with this for consistency. |
109 void GetSettingsWithUI( | 111 void GetSettingsWithUI( |
110 int document_page_count, | 112 int document_page_count, |
111 bool has_selection); | 113 bool has_selection); |
112 | 114 |
113 // The callback used by PrintingContext::GetSettingsWithUI() to notify this | 115 // The callback used by PrintingContext::GetSettingsWithUI() to notify this |
114 // object that the print settings are set. This is needed in order to bounce | 116 // object that the print settings are set. This is needed in order to bounce |
115 // back into the IO thread for GetSettingsDone(). | 117 // back into the IO thread for GetSettingsDone(). |
116 void GetSettingsWithUIDone(PrintingContext::Result result); | 118 void GetSettingsWithUIDone(PrintingContext::Result result); |
117 | 119 |
120 // Called on the UI thread to ask the system to show a print dialog. | |
121 void ShowSystemDialog(); | |
122 | |
118 // Called on the UI thread to update the print settings. | 123 // Called on the UI thread to update the print settings. |
119 void UpdatePrintSettings(scoped_ptr<base::DictionaryValue> new_settings); | 124 void UpdatePrintSettings(scoped_ptr<base::DictionaryValue> new_settings); |
120 | 125 |
121 // Reports settings back to owner_. | 126 // Reports settings back to owner_. |
122 void GetSettingsDone(PrintingContext::Result result); | 127 void GetSettingsDone(PrintingContext::Result result); |
123 | 128 |
124 // Use the default settings. When using GTK+ or Mac, this can still end up | 129 // Use the default settings. When using GTK+ or Mac, this can still end up |
125 // displaying a dialog. So this needs to happen from the UI thread on these | 130 // displaying a dialog. So this needs to happen from the UI thread on these |
126 // systems. | 131 // systems. |
127 void UseDefaultSettings(); | 132 void UseDefaultSettings(); |
(...skipping 22 matching lines...) Loading... | |
150 | 155 |
151 // Used to generate a WeakPtr for callbacks. | 156 // Used to generate a WeakPtr for callbacks. |
152 base::WeakPtrFactory<PrintJobWorker> weak_factory_; | 157 base::WeakPtrFactory<PrintJobWorker> weak_factory_; |
153 | 158 |
154 DISALLOW_COPY_AND_ASSIGN(PrintJobWorker); | 159 DISALLOW_COPY_AND_ASSIGN(PrintJobWorker); |
155 }; | 160 }; |
156 | 161 |
157 } // namespace printing | 162 } // namespace printing |
158 | 163 |
159 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H_ | 164 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H_ |
OLD | NEW |