| 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...) Expand all 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 |
| 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); |
| 56 | 58 |
| 59 // TODO DGN Doc |
| 60 void ShowSystemDialog(); |
| 61 |
| 57 // Updates the printed document. | 62 // Updates the printed document. |
| 58 void OnDocumentChanged(PrintedDocument* new_document); | 63 void OnDocumentChanged(PrintedDocument* new_document); |
| 59 | 64 |
| 60 // Dequeues waiting pages. Called when PrintJob receives a | 65 // Dequeues waiting pages. Called when PrintJob receives a |
| 61 // NOTIFY_PRINTED_DOCUMENT_UPDATED notification. It's time to look again if | 66 // NOTIFY_PRINTED_DOCUMENT_UPDATED notification. It's time to look again if |
| 62 // the next page can be printed. | 67 // the next page can be printed. |
| 63 void OnNewPage(); | 68 void OnNewPage(); |
| 64 | 69 |
| 65 // This is the only function that can be called in a thread. | 70 // This is the only function that can be called in a thread. |
| 66 void Cancel(); | 71 void Cancel(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |