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_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 }; | 94 }; |
95 | 95 |
96 enum PrintPreviewErrorBuckets { | 96 enum PrintPreviewErrorBuckets { |
97 PREVIEW_ERROR_NONE, // Always first. | 97 PREVIEW_ERROR_NONE, // Always first. |
98 PREVIEW_ERROR_BAD_SETTING, | 98 PREVIEW_ERROR_BAD_SETTING, |
99 PREVIEW_ERROR_METAFILE_COPY_FAILED, | 99 PREVIEW_ERROR_METAFILE_COPY_FAILED, |
100 PREVIEW_ERROR_METAFILE_INIT_FAILED, | 100 PREVIEW_ERROR_METAFILE_INIT_FAILED, |
101 PREVIEW_ERROR_ZERO_PAGES, | 101 PREVIEW_ERROR_ZERO_PAGES, |
102 PREVIEW_ERROR_MAC_DRAFT_METAFILE_INIT_FAILED, | 102 PREVIEW_ERROR_MAC_DRAFT_METAFILE_INIT_FAILED, |
103 PREVIEW_ERROR_PAGE_RENDERED_WITHOUT_METAFILE, | 103 PREVIEW_ERROR_PAGE_RENDERED_WITHOUT_METAFILE, |
104 PREVIEW_ERROR_UPDATING_PRINT_SETTINGS, | |
105 PREVIEW_ERROR_INVALID_PRINTER_SETTINGS, | 104 PREVIEW_ERROR_INVALID_PRINTER_SETTINGS, |
106 PREVIEW_ERROR_LAST_ENUM // Always last. | 105 PREVIEW_ERROR_LAST_ENUM // Always last. |
107 }; | 106 }; |
108 | 107 |
109 enum PrintPreviewRequestType { | 108 enum PrintPreviewRequestType { |
110 PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME, | 109 PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME, |
111 PRINT_PREVIEW_USER_INITIATED_SELECTION, | 110 PRINT_PREVIEW_USER_INITIATED_SELECTION, |
112 PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE, | 111 PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE, |
113 PRINT_PREVIEW_SCRIPTED // triggered by window.print(). | 112 PRINT_PREVIEW_SCRIPTED // triggered by window.print(). |
114 }; | 113 }; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 // Returns true if cancelling, false if continuing. | 314 // Returns true if cancelling, false if continuing. |
316 bool CheckForCancel(); | 315 bool CheckForCancel(); |
317 | 316 |
318 // Notifies the browser a print preview page has been rendered. | 317 // Notifies the browser a print preview page has been rendered. |
319 // |page_number| is 0-based. | 318 // |page_number| is 0-based. |
320 // For a valid |page_number| with modifiable content, | 319 // For a valid |page_number| with modifiable content, |
321 // |metafile| is the rendered page. Otherwise |metafile| is NULL. | 320 // |metafile| is the rendered page. Otherwise |metafile| is NULL. |
322 // Returns true if print preview should continue, false on failure. | 321 // Returns true if print preview should continue, false on failure. |
323 bool PreviewPageRendered(int page_number, Metafile* metafile); | 322 bool PreviewPageRendered(int page_number, Metafile* metafile); |
324 | 323 |
| 324 const PrintMsg_PrintPages_Params* print_pages_params() const { |
| 325 return print_pages_params_.get(); |
| 326 } |
| 327 void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings); |
| 328 |
325 // WebView used only to print the selection. | 329 // WebView used only to print the selection. |
326 scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_; | 330 scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_; |
327 bool reset_prep_frame_view_; | 331 bool reset_prep_frame_view_; |
328 | 332 |
329 scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_; | 333 scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_; |
330 bool is_preview_enabled_; | 334 bool is_preview_enabled_; |
331 bool is_scripted_print_throttling_disabled_; | 335 bool is_scripted_print_throttling_disabled_; |
332 bool is_print_ready_metafile_sent_; | 336 bool is_print_ready_metafile_sent_; |
333 bool ignore_css_margins_; | 337 bool ignore_css_margins_; |
334 | 338 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 // hangs because RequestPrintPreview is called before DidStopLoading() is | 471 // hangs because RequestPrintPreview is called before DidStopLoading() is |
468 // called. This is a store for the RequestPrintPreview() call and its | 472 // called. This is a store for the RequestPrintPreview() call and its |
469 // parameters so that it can be invoked after DidStopLoading. | 473 // parameters so that it can be invoked after DidStopLoading. |
470 base::Closure on_stop_loading_closure_; | 474 base::Closure on_stop_loading_closure_; |
471 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 475 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
472 }; | 476 }; |
473 | 477 |
474 } // namespace printing | 478 } // namespace printing |
475 | 479 |
476 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 480 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |