OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 WebKit::WebFrame* frame, | 174 WebKit::WebFrame* frame, |
175 const WebKit::WebNode& node, | 175 const WebKit::WebNode& node, |
176 scoped_ptr<PrepareFrameAndViewForPrint>* prepare); | 176 scoped_ptr<PrepareFrameAndViewForPrint>* prepare); |
177 | 177 |
178 // Update the current print settings with new |job_settings|. |job_settings| | 178 // Update the current print settings with new |job_settings|. |job_settings| |
179 // dictionary contains print job details such as printer name, number of | 179 // dictionary contains print job details such as printer name, number of |
180 // copies, page range, etc. | 180 // copies, page range, etc. |
181 bool UpdatePrintSettings(WebKit::WebFrame* frame, | 181 bool UpdatePrintSettings(WebKit::WebFrame* frame, |
182 const WebKit::WebNode& node, | 182 const WebKit::WebNode& node, |
183 const base::DictionaryValue& passed_job_settings, | 183 const base::DictionaryValue& passed_job_settings, |
184 bool generating_preview); | 184 bool print_for_preview); |
185 | 185 |
186 // Get final print settings from the user. | 186 // Get final print settings from the user. |
187 // Return false if the user cancels or on error. | 187 // Return false if the user cancels or on error. |
188 bool GetPrintSettingsFromUser(WebKit::WebFrame* frame, | 188 bool GetPrintSettingsFromUser(WebKit::WebFrame* frame, |
| 189 const WebKit::WebNode& node, |
189 int expected_pages_count, | 190 int expected_pages_count, |
190 bool use_browser_overlays); | 191 bool use_browser_overlays); |
191 | 192 |
192 // Page Printing / Rendering ------------------------------------------------ | 193 // Page Printing / Rendering ------------------------------------------------ |
193 | 194 |
194 // Prints all the pages listed in |params|. | 195 // Prints all the pages listed in |params|. |
195 // It will implicitly revert the document to display CSS media type. | 196 // It will implicitly revert the document to display CSS media type. |
196 bool PrintPages(const PrintMsg_PrintPages_Params& params, | 197 bool PrintPages(const PrintMsg_PrintPages_Params& params, |
197 WebKit::WebFrame* frame, | 198 WebKit::WebFrame* frame, |
198 const WebKit::WebNode& node, | 199 const WebKit::WebNode& node, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 // Notifies the browser a print preview page has been rendered. | 296 // Notifies the browser a print preview page has been rendered. |
296 // |page_number| is 0-based. | 297 // |page_number| is 0-based. |
297 // For a valid |page_number| with modifiable content, | 298 // For a valid |page_number| with modifiable content, |
298 // |metafile| is the rendered page. Otherwise |metafile| is NULL. | 299 // |metafile| is the rendered page. Otherwise |metafile| is NULL. |
299 // Returns true if print preview should continue, false on failure. | 300 // Returns true if print preview should continue, false on failure. |
300 bool PreviewPageRendered(int page_number, printing::Metafile* metafile); | 301 bool PreviewPageRendered(int page_number, printing::Metafile* metafile); |
301 | 302 |
302 WebKit::WebView* print_web_view_; | 303 WebKit::WebView* print_web_view_; |
303 | 304 |
304 scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_; | 305 scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_; |
305 bool is_preview_; | 306 bool is_preview_enabled_; |
306 bool is_print_ready_metafile_sent_; | 307 bool is_print_ready_metafile_sent_; |
307 | 308 |
308 // Used for scripted initiated printing blocking. | 309 // Used for scripted initiated printing blocking. |
309 base::Time last_cancelled_script_print_; | 310 base::Time last_cancelled_script_print_; |
310 int user_cancelled_scripted_print_count_; | 311 int user_cancelled_scripted_print_count_; |
311 | 312 |
312 // Let the browser process know of a printing failure. Only set to false when | 313 // Let the browser process know of a printing failure. Only set to false when |
313 // the failure came from the browser in the first place. | 314 // the failure came from the browser in the first place. |
314 bool notify_browser_of_print_failure_; | 315 bool notify_browser_of_print_failure_; |
315 | 316 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 void FinalizePrintReadyDocument(); | 362 void FinalizePrintReadyDocument(); |
362 | 363 |
363 // Cleanup after print preview finishes. | 364 // Cleanup after print preview finishes. |
364 void Finished(); | 365 void Finished(); |
365 | 366 |
366 // Cleanup after print preview fails. | 367 // Cleanup after print preview fails. |
367 void Failed(bool report_error); | 368 void Failed(bool report_error); |
368 | 369 |
369 // Helper functions | 370 // Helper functions |
370 int GetNextPageNumber(); | 371 int GetNextPageNumber(); |
371 bool IsReadyToRender() const; | 372 bool IsRendering() const; |
372 bool IsModifiable() const; | 373 bool IsModifiable() const; |
373 bool IsLastPageOfPrintReadyMetafile() const; | 374 bool IsLastPageOfPrintReadyMetafile() const; |
374 bool IsFinalPageRendered() const; | 375 bool IsFinalPageRendered() const; |
375 | 376 |
376 // Setters | 377 // Setters |
377 void set_generate_draft_pages(bool generate_draft_pages); | 378 void set_generate_draft_pages(bool generate_draft_pages); |
378 void set_error(enum PrintPreviewErrorBuckets error); | 379 void set_error(enum PrintPreviewErrorBuckets error); |
379 | 380 |
380 // Getters | 381 // Getters |
381 WebKit::WebFrame* frame() const; | 382 WebKit::WebFrame* frame() const; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 429 |
429 State state_; | 430 State state_; |
430 }; | 431 }; |
431 | 432 |
432 PrintPreviewContext print_preview_context_; | 433 PrintPreviewContext print_preview_context_; |
433 | 434 |
434 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 435 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
435 }; | 436 }; |
436 | 437 |
437 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 438 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |