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

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

Issue 255543006: Printing on Windows via PDF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fixes Created 6 years, 7 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_VIEW_MANAGER_BASE_H_ 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ 6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/prefs/pref_member.h" 9 #include "base/prefs/pref_member.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
13 #include "content/public/browser/web_contents_observer.h" 13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/browser/web_contents_user_data.h" 14 #include "content/public/browser/web_contents_user_data.h"
15 #include "printing/metafile_impl.h"
Vitaly Buka (NO REVIEWS) 2014/05/14 03:51:18 I guess you needed this only for defines. Now it's
scottmg 2014/05/15 18:01:30 Done.
15 #include "printing/printed_pages_source.h" 16 #include "printing/printed_pages_source.h"
16 17
17 struct PrintHostMsg_DidPrintPage_Params; 18 struct PrintHostMsg_DidPrintPage_Params;
18 19
19 namespace content { 20 namespace content {
20 class RenderViewHost; 21 class RenderViewHost;
21 } 22 }
22 23
23 namespace printing { 24 namespace printing {
24 25
25 class JobEventDetails; 26 class JobEventDetails;
27 class PdfToEmfConverter;
26 class PrintJob; 28 class PrintJob;
27 class PrintJobWorkerOwner; 29 class PrintJobWorkerOwner;
28 class PrintQueriesQueue; 30 class PrintQueriesQueue;
29 31
30 // Base class for managing the print commands for a WebContents. 32 // Base class for managing the print commands for a WebContents.
31 class PrintViewManagerBase : public content::NotificationObserver, 33 class PrintViewManagerBase : public content::NotificationObserver,
32 public PrintedPagesSource, 34 public PrintedPagesSource,
33 public content::WebContentsObserver { 35 public content::WebContentsObserver {
34 public: 36 public:
35 virtual ~PrintViewManagerBase(); 37 virtual ~PrintViewManagerBase();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 bool RunInnerMessageLoop(); 125 bool RunInnerMessageLoop();
124 126
125 // In the case of Scripted Printing, where the renderer is controlling the 127 // In the case of Scripted Printing, where the renderer is controlling the
126 // control flow, print_job_ is initialized whenever possible. No-op is 128 // control flow, print_job_ is initialized whenever possible. No-op is
127 // print_job_ is initialized. 129 // print_job_ is initialized.
128 bool OpportunisticallyCreatePrintJob(int cookie); 130 bool OpportunisticallyCreatePrintJob(int cookie);
129 131
130 // Release the PrinterQuery associated with our |cookie_|. 132 // Release the PrinterQuery associated with our |cookie_|.
131 void ReleasePrinterQuery(); 133 void ReleasePrinterQuery();
132 134
135 #if defined(WIN_PDF_METAFILE_FOR_PRINTING)
136 // Called on completion of converting the pdf to emf.
137 void OnPdfToEmfConverted(const PrintHostMsg_DidPrintPage_Params& params,
138 double scale_factor,
139 const std::vector<base::FilePath>& emf_file);
140 #endif
141
133 content::NotificationRegistrar registrar_; 142 content::NotificationRegistrar registrar_;
134 143
135 // Manages the low-level talk to the printer. 144 // Manages the low-level talk to the printer.
136 scoped_refptr<PrintJob> print_job_; 145 scoped_refptr<PrintJob> print_job_;
137 146
138 // Number of pages to print in the print job. 147 // Number of pages to print in the print job.
139 int number_pages_; 148 int number_pages_;
140 149
141 // Indication of success of the print job. 150 // Indication of success of the print job.
142 bool printing_succeeded_; 151 bool printing_succeeded_;
143 152
144 // Running an inner message loop inside RenderAllMissingPagesNow(). This means 153 // Running an inner message loop inside RenderAllMissingPagesNow(). This means
145 // we are _blocking_ until all the necessary pages have been rendered or the 154 // we are _blocking_ until all the necessary pages have been rendered or the
146 // print settings are being loaded. 155 // print settings are being loaded.
147 bool inside_inner_message_loop_; 156 bool inside_inner_message_loop_;
148 157
149 #if defined(OS_POSIX) && !defined(OS_MACOSX) 158 #if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \
159 defined(WIN_PDF_METAFILE_FOR_PRINTING)
150 // Set to true when OnDidPrintPage() should be expecting the first page. 160 // Set to true when OnDidPrintPage() should be expecting the first page.
151 bool expecting_first_page_; 161 bool expecting_first_page_;
152 #endif 162 #endif
153 163
164 #if defined(WIN_PDF_METAFILE_FOR_PRINTING)
165 scoped_ptr<PdfToEmfConverter> pdf_to_emf_converter_;
166 #endif
167
154 // The document cookie of the current PrinterQuery. 168 // The document cookie of the current PrinterQuery.
155 int cookie_; 169 int cookie_;
156 170
157 // Whether printing is enabled. 171 // Whether printing is enabled.
158 BooleanPrefMember printing_enabled_; 172 BooleanPrefMember printing_enabled_;
159 173
160 scoped_refptr<printing::PrintQueriesQueue> queue_; 174 scoped_refptr<printing::PrintQueriesQueue> queue_;
161 175
162 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase); 176 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase);
163 }; 177 };
164 178
165 } // namespace printing 179 } // namespace printing
166 180
167 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ 181 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/printing/pdf_to_emf_converter.cc ('k') | chrome/browser/printing/print_view_manager_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698