Chromium Code Reviews| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 | 45 |
| 46 // Initializes the print settings. If |ask_user_for_settings| is true, a | 46 // Initializes the print settings. If |ask_user_for_settings| is true, a |
| 47 // Print... dialog box will be shown to ask the user his preference. | 47 // Print... dialog box will be shown to ask the user his preference. |
| 48 void GetSettings( | 48 void GetSettings( |
| 49 bool ask_user_for_settings, | 49 bool ask_user_for_settings, |
| 50 scoped_ptr<PrintingUIWebContentsObserver> web_contents_observer, | 50 scoped_ptr<PrintingUIWebContentsObserver> web_contents_observer, |
| 51 int document_page_count, | 51 int document_page_count, |
| 52 bool has_selection, | 52 bool has_selection, |
| 53 MarginType margin_type); | 53 MarginType margin_type); |
| 54 | 54 |
| 55 // Set the new print settings. This function takes ownership of | 55 // Set the new print settings. This function takes ownership of |
|
Noam Samuel
2014/08/20 00:04:17
Nit: Second part of comment no longer necessary.
Vitaly Buka (NO REVIEWS)
2014/08/20 02:42:55
Done.
| |
| 56 // |new_settings|. | 56 // |new_settings|. |
| 57 void SetSettings(const base::DictionaryValue* const new_settings); | 57 void SetSettings( |
| 58 scoped_ptr<PrintingUIWebContentsObserver> web_contents_observer, | |
| 59 scoped_ptr<base::DictionaryValue> new_settings); | |
| 58 | 60 |
| 59 // Starts the printing loop. Every pages are printed as soon as the data is | 61 // Starts the printing loop. Every pages are printed as soon as the data is |
| 60 // available. Makes sure the new_document is the right one. | 62 // available. Makes sure the new_document is the right one. |
| 61 void StartPrinting(PrintedDocument* new_document); | 63 void StartPrinting(PrintedDocument* new_document); |
| 62 | 64 |
| 63 // Updates the printed document. | 65 // Updates the printed document. |
| 64 void OnDocumentChanged(PrintedDocument* new_document); | 66 void OnDocumentChanged(PrintedDocument* new_document); |
| 65 | 67 |
| 66 // Dequeues waiting pages. Called when PrintJob receives a | 68 // Dequeues waiting pages. Called when PrintJob receives a |
| 67 // NOTIFY_PRINTED_DOCUMENT_UPDATED notification. It's time to look again if | 69 // NOTIFY_PRINTED_DOCUMENT_UPDATED notification. It's time to look again if |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 int document_page_count, | 119 int document_page_count, |
| 118 bool has_selection); | 120 bool has_selection); |
| 119 | 121 |
| 120 // The callback used by PrintingContext::GetSettingsWithUI() to notify this | 122 // The callback used by PrintingContext::GetSettingsWithUI() to notify this |
| 121 // object that the print settings are set. This is needed in order to bounce | 123 // object that the print settings are set. This is needed in order to bounce |
| 122 // back into the IO thread for GetSettingsDone(). | 124 // back into the IO thread for GetSettingsDone(). |
| 123 void GetSettingsWithUIDone(PrintingContext::Result result); | 125 void GetSettingsWithUIDone(PrintingContext::Result result); |
| 124 | 126 |
| 125 // Called on the UI thread to update the print settings. This function takes | 127 // Called on the UI thread to update the print settings. This function takes |
| 126 // the ownership of |new_settings|. | 128 // the ownership of |new_settings|. |
| 127 void UpdatePrintSettings(const base::DictionaryValue* const new_settings); | 129 void UpdatePrintSettings( |
| 130 scoped_ptr<PrintingUIWebContentsObserver> web_contents_observer, | |
| 131 scoped_ptr<base::DictionaryValue> new_settings); | |
| 128 | 132 |
| 129 // Reports settings back to owner_. | 133 // Reports settings back to owner_. |
| 130 void GetSettingsDone(PrintingContext::Result result); | 134 void GetSettingsDone(PrintingContext::Result result); |
| 131 | 135 |
| 132 // Use the default settings. When using GTK+ or Mac, this can still end up | 136 // Use the default settings. When using GTK+ or Mac, this can still end up |
| 133 // displaying a dialog. So this needs to happen from the UI thread on these | 137 // displaying a dialog. So this needs to happen from the UI thread on these |
| 134 // systems. | 138 // systems. |
| 135 void UseDefaultSettings(); | 139 void UseDefaultSettings(); |
| 136 | 140 |
| 137 // Information about the printer setting. | 141 // Information about the printer setting. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 158 | 162 |
| 159 // Used to generate a WeakPtr for callbacks. | 163 // Used to generate a WeakPtr for callbacks. |
| 160 base::WeakPtrFactory<PrintJobWorker> weak_factory_; | 164 base::WeakPtrFactory<PrintJobWorker> weak_factory_; |
| 161 | 165 |
| 162 DISALLOW_COPY_AND_ASSIGN(PrintJobWorker); | 166 DISALLOW_COPY_AND_ASSIGN(PrintJobWorker); |
| 163 }; | 167 }; |
| 164 | 168 |
| 165 } // namespace printing | 169 } // namespace printing |
| 166 | 170 |
| 167 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H_ | 171 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H_ |
| OLD | NEW |