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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 // PrintWebViewHelper handles most of the printing grunt work for RenderView. | 62 // PrintWebViewHelper handles most of the printing grunt work for RenderView. |
63 // We plan on making print asynchronous and that will require copying the DOM | 63 // We plan on making print asynchronous and that will require copying the DOM |
64 // of the document and creating a new WebView with the contents. | 64 // of the document and creating a new WebView with the contents. |
65 class PrintWebViewHelper | 65 class PrintWebViewHelper |
66 : public content::RenderViewObserver, | 66 : public content::RenderViewObserver, |
67 public content::RenderViewObserverTracker<PrintWebViewHelper> { | 67 public content::RenderViewObserverTracker<PrintWebViewHelper> { |
68 public: | 68 public: |
69 explicit PrintWebViewHelper(content::RenderView* render_view); | 69 explicit PrintWebViewHelper(content::RenderView* render_view); |
70 virtual ~PrintWebViewHelper(); | 70 virtual ~PrintWebViewHelper(); |
71 | 71 |
72 // Disable print preview and switch to system dialog printing even if full | |
Lei Zhang
2014/09/24 17:53:43
Not sure if you want to keep this around for CEF?
Vitaly Buka (NO REVIEWS)
2014/09/24 18:07:03
Done.
it duplicates kDisablePrintPreview, but we
| |
73 // printing is build-in. This method is used by CEF. | |
74 static void DisablePreview(); | |
75 | |
76 bool IsPrintingEnabled(); | 72 bool IsPrintingEnabled(); |
77 | 73 |
78 void PrintNode(const blink::WebNode& node); | 74 void PrintNode(const blink::WebNode& node); |
79 | 75 |
80 private: | 76 private: |
81 friend class PrintWebViewHelperTestBase; | 77 friend class PrintWebViewHelperTestBase; |
82 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, | 78 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, |
83 BlockScriptInitiatedPrinting); | 79 BlockScriptInitiatedPrinting); |
84 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); | 80 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); |
85 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, | 81 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 // Returns true if print preview should continue, false on failure. | 298 // Returns true if print preview should continue, false on failure. |
303 bool PreviewPageRendered(int page_number, PdfMetafileSkia* metafile); | 299 bool PreviewPageRendered(int page_number, PdfMetafileSkia* metafile); |
304 | 300 |
305 void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings); | 301 void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings); |
306 | 302 |
307 // WebView used only to print the selection. | 303 // WebView used only to print the selection. |
308 scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_; | 304 scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_; |
309 bool reset_prep_frame_view_; | 305 bool reset_prep_frame_view_; |
310 | 306 |
311 scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_; | 307 scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_; |
308 bool is_preview_enabled_; | |
312 bool is_print_ready_metafile_sent_; | 309 bool is_print_ready_metafile_sent_; |
313 bool ignore_css_margins_; | 310 bool ignore_css_margins_; |
314 | 311 |
315 // Used for scripted initiated printing blocking. | 312 // Used for scripted initiated printing blocking. |
316 bool is_scripted_printing_blocked_; | 313 bool is_scripted_printing_blocked_; |
317 | 314 |
318 // Let the browser process know of a printing failure. Only set to false when | 315 // Let the browser process know of a printing failure. Only set to false when |
319 // the failure came from the browser in the first place. | 316 // the failure came from the browser in the first place. |
320 bool notify_browser_of_print_failure_; | 317 bool notify_browser_of_print_failure_; |
321 | 318 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 base::Closure on_stop_loading_closure_; | 458 base::Closure on_stop_loading_closure_; |
462 | 459 |
463 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 460 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
464 | 461 |
465 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 462 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
466 }; | 463 }; |
467 | 464 |
468 } // namespace printing | 465 } // namespace printing |
469 | 466 |
470 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 467 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |