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

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: remove ref to internal_pdf and rebase 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/printed_pages_source.h" 15 #include "printing/printed_pages_source.h"
16 16
17 struct PrintHostMsg_DidPrintPage_Params; 17 struct PrintHostMsg_DidPrintPage_Params;
18 18
19 namespace content { 19 namespace content {
20 class RenderViewHost; 20 class RenderViewHost;
21 } 21 }
22 22
23 namespace printing { 23 namespace printing {
24 24
25 class JobEventDetails; 25 class JobEventDetails;
26 class PdfToEmfConverter;
26 class PrintJob; 27 class PrintJob;
27 class PrintJobWorkerOwner; 28 class PrintJobWorkerOwner;
28 class PrintQueriesQueue; 29 class PrintQueriesQueue;
29 30
30 // Base class for managing the print commands for a WebContents. 31 // Base class for managing the print commands for a WebContents.
31 class PrintViewManagerBase : public content::NotificationObserver, 32 class PrintViewManagerBase : public content::NotificationObserver,
32 public PrintedPagesSource, 33 public PrintedPagesSource,
33 public content::WebContentsObserver { 34 public content::WebContentsObserver {
34 public: 35 public:
35 virtual ~PrintViewManagerBase(); 36 virtual ~PrintViewManagerBase();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 bool RunInnerMessageLoop(); 124 bool RunInnerMessageLoop();
124 125
125 // In the case of Scripted Printing, where the renderer is controlling the 126 // In the case of Scripted Printing, where the renderer is controlling the
126 // control flow, print_job_ is initialized whenever possible. No-op is 127 // control flow, print_job_ is initialized whenever possible. No-op is
127 // print_job_ is initialized. 128 // print_job_ is initialized.
128 bool OpportunisticallyCreatePrintJob(int cookie); 129 bool OpportunisticallyCreatePrintJob(int cookie);
129 130
130 // Release the PrinterQuery associated with our |cookie_|. 131 // Release the PrinterQuery associated with our |cookie_|.
131 void ReleasePrinterQuery(); 132 void ReleasePrinterQuery();
132 133
134 #if defined(WIN_PDF_METAFILE_FOR_PRINTING)
135 // Called on completion of converting the pdf to emf.
136 void OnPdfToEmfConverted(const PrintHostMsg_DidPrintPage_Params& params,
137 double scale_factor,
138 const std::vector<base::FilePath>& emf_file);
139 #endif
140
133 content::NotificationRegistrar registrar_; 141 content::NotificationRegistrar registrar_;
134 142
135 // Manages the low-level talk to the printer. 143 // Manages the low-level talk to the printer.
136 scoped_refptr<PrintJob> print_job_; 144 scoped_refptr<PrintJob> print_job_;
137 145
138 // Number of pages to print in the print job. 146 // Number of pages to print in the print job.
139 int number_pages_; 147 int number_pages_;
140 148
141 // Indication of success of the print job. 149 // Indication of success of the print job.
142 bool printing_succeeded_; 150 bool printing_succeeded_;
143 151
144 // Running an inner message loop inside RenderAllMissingPagesNow(). This means 152 // Running an inner message loop inside RenderAllMissingPagesNow(). This means
145 // we are _blocking_ until all the necessary pages have been rendered or the 153 // we are _blocking_ until all the necessary pages have been rendered or the
146 // print settings are being loaded. 154 // print settings are being loaded.
147 bool inside_inner_message_loop_; 155 bool inside_inner_message_loop_;
148 156
149 #if defined(OS_POSIX) && !defined(OS_MACOSX) 157 #if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \
158 defined(WIN_PDF_METAFILE_FOR_PRINTING)
150 // Set to true when OnDidPrintPage() should be expecting the first page. 159 // Set to true when OnDidPrintPage() should be expecting the first page.
151 bool expecting_first_page_; 160 bool expecting_first_page_;
152 #endif 161 #endif
153 162
163 #if defined(WIN_PDF_METAFILE_FOR_PRINTING)
164 scoped_ptr<PdfToEmfConverter> pdf_to_emf_converter_;
165 #endif
166
154 // The document cookie of the current PrinterQuery. 167 // The document cookie of the current PrinterQuery.
155 int cookie_; 168 int cookie_;
156 169
157 // Whether printing is enabled. 170 // Whether printing is enabled.
158 BooleanPrefMember printing_enabled_; 171 BooleanPrefMember printing_enabled_;
159 172
160 scoped_refptr<printing::PrintQueriesQueue> queue_; 173 scoped_refptr<printing::PrintQueriesQueue> queue_;
161 174
162 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase); 175 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase);
163 }; 176 };
164 177
165 } // namespace printing 178 } // namespace printing
166 179
167 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ 180 #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