Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1353)

Side by Side Diff: chrome/browser/printing/print_job_worker.h

Issue 740983002: Implement window.print() on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WIP - removing enums and new methods Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "chrome/browser/printing/printer_query.h"
12 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
13 #include "printing/page_number.h" 14 #include "printing/page_number.h"
14 #include "printing/print_job_constants.h" 15 #include "printing/print_job_constants.h"
15 #include "printing/printing_context.h" 16 #include "printing/printing_context.h"
16 17
17 namespace base { 18 namespace base {
18 class DictionaryValue; 19 class DictionaryValue;
19 } 20 }
20 21
21 namespace printing { 22 namespace printing {
(...skipping 10 matching lines...) Expand all
32 // PrintJob always outlives its worker instance. 33 // PrintJob always outlives its worker instance.
33 class PrintJobWorker { 34 class PrintJobWorker {
34 public: 35 public:
35 PrintJobWorker(int render_process_id, 36 PrintJobWorker(int render_process_id,
36 int render_view_id, 37 int render_view_id,
37 PrintJobWorkerOwner* owner); 38 PrintJobWorkerOwner* owner);
38 virtual ~PrintJobWorker(); 39 virtual ~PrintJobWorker();
39 40
40 void SetNewOwner(PrintJobWorkerOwner* new_owner); 41 void SetNewOwner(PrintJobWorkerOwner* new_owner);
41 42
42 // Initializes the print settings. If |ask_user_for_settings| is true, a 43 // 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. 44 // Print... dialog box will be shown by the browser to ask the user his
45 // preference. If it is SYSTEM_SPECIFIC, showing that dialog box will be
46 // delegated to the system. It's used for script printing on android
47 // (see https://codereview.chromium.org/740983002/)
48 // (TODO: doc)
44 void GetSettings( 49 void GetSettings(
45 bool ask_user_for_settings, 50 PrinterQuery::GetSettingsAskParam ask_settings_type,
46 int document_page_count, 51 int document_page_count,
47 bool has_selection, 52 bool has_selection,
48 MarginType margin_type); 53 MarginType margin_type,
54 bool is_scripted);
49 55
50 // Set the new print settings. 56 // Set the new print settings.
51 void SetSettings(scoped_ptr<base::DictionaryValue> new_settings); 57 void SetSettings(scoped_ptr<base::DictionaryValue> new_settings);
52 58
53 // Starts the printing loop. Every pages are printed as soon as the data is 59 // 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. 60 // available. Makes sure the new_document is the right one.
55 void StartPrinting(PrintedDocument* new_document); 61 void StartPrinting(PrintedDocument* new_document);
56 62
57 // Updates the printed document. 63 // Updates the printed document.
58 void OnDocumentChanged(PrintedDocument* new_document); 64 void OnDocumentChanged(PrintedDocument* new_document);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 107
102 // Discards the current document, the current page and cancels the printing 108 // Discards the current document, the current page and cancels the printing
103 // context. 109 // context.
104 void OnFailure(); 110 void OnFailure();
105 111
106 // Asks the user for print settings. Must be called on the UI thread. 112 // Asks the user for print settings. Must be called on the UI thread.
107 // Required on Mac and Linux. Windows can display UI from non-main threads, 113 // Required on Mac and Linux. Windows can display UI from non-main threads,
108 // but sticks with this for consistency. 114 // but sticks with this for consistency.
109 void GetSettingsWithUI( 115 void GetSettingsWithUI(
110 int document_page_count, 116 int document_page_count,
111 bool has_selection); 117 bool has_selection,
118 bool is_scripted);
112 119
113 // The callback used by PrintingContext::GetSettingsWithUI() to notify this 120 // The callback used by PrintingContext::GetSettingsWithUI() to notify this
114 // object that the print settings are set. This is needed in order to bounce 121 // object that the print settings are set. This is needed in order to bounce
115 // back into the IO thread for GetSettingsDone(). 122 // back into the IO thread for GetSettingsDone().
116 void GetSettingsWithUIDone(PrintingContext::Result result); 123 void GetSettingsWithUIDone(PrintingContext::Result result);
117 124
118 // Called on the UI thread to update the print settings. 125 // Called on the UI thread to update the print settings.
119 void UpdatePrintSettings(scoped_ptr<base::DictionaryValue> new_settings); 126 void UpdatePrintSettings(scoped_ptr<base::DictionaryValue> new_settings);
120 127
121 // Reports settings back to owner_. 128 // Reports settings back to owner_.
(...skipping 28 matching lines...) Expand all
150 157
151 // Used to generate a WeakPtr for callbacks. 158 // Used to generate a WeakPtr for callbacks.
152 base::WeakPtrFactory<PrintJobWorker> weak_factory_; 159 base::WeakPtrFactory<PrintJobWorker> weak_factory_;
153 160
154 DISALLOW_COPY_AND_ASSIGN(PrintJobWorker); 161 DISALLOW_COPY_AND_ASSIGN(PrintJobWorker);
155 }; 162 };
156 163
157 } // namespace printing 164 } // namespace printing
158 165
159 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H_ 166 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698