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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 blink::WebLocalFrame* frame_; | 59 blink::WebLocalFrame* frame_; |
60 }; | 60 }; |
61 | 61 |
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 |
70 class Delegate { | |
71 public: | |
72 virtual ~Delegate() {} | |
73 virtual bool CancelPrerender(content::RenderView* render_view, | |
74 int routing_id) = 0; | |
75 }; | |
76 | |
77 | |
78 explicit PrintWebViewHelper(content::RenderView* render_view, | |
Lei Zhang
2015/01/06 04:11:32
explicit no longer needed
dgn
2015/01/06 16:35:31
Done.
| |
79 const bool out_of_process_pdf_enabled, | |
Vitaly Buka (NO REVIEWS)
2015/01/06 03:46:16
"const bool" -> "bool"
dgn
2015/01/06 16:35:31
Done.
| |
80 const bool print_preview_disabled, | |
81 Delegate* delegate); | |
70 ~PrintWebViewHelper() override; | 82 ~PrintWebViewHelper() override; |
71 | 83 |
72 // Disable print preview and switch to system dialog printing even if full | 84 // Disable print preview and switch to system dialog printing even if full |
73 // printing is build-in. This method is used by CEF. | 85 // printing is build-in. This method is used by CEF. |
74 static void DisablePreview(); | 86 static void DisablePreview(); |
75 | 87 |
76 bool IsPrintingEnabled(); | 88 bool IsPrintingEnabled(); |
77 | 89 |
78 void PrintNode(const blink::WebNode& node); | 90 void PrintNode(const blink::WebNode& node); |
79 | 91 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 // Used for scripted initiated printing blocking. | 332 // Used for scripted initiated printing blocking. |
321 bool is_scripted_printing_blocked_; | 333 bool is_scripted_printing_blocked_; |
322 | 334 |
323 // Let the browser process know of a printing failure. Only set to false when | 335 // Let the browser process know of a printing failure. Only set to false when |
324 // the failure came from the browser in the first place. | 336 // the failure came from the browser in the first place. |
325 bool notify_browser_of_print_failure_; | 337 bool notify_browser_of_print_failure_; |
326 | 338 |
327 // True, when printing from print preview. | 339 // True, when printing from print preview. |
328 bool print_for_preview_; | 340 bool print_for_preview_; |
329 | 341 |
342 // Whether the content to print could be nested in an iframe. | |
343 const bool out_of_process_pdf_enabled_; | |
344 | |
345 Delegate* delegate_; | |
Lei Zhang
2015/01/06 04:11:32
This can be a Delegate* const
| |
346 | |
330 // Keeps track of the state of print preview between messages. | 347 // Keeps track of the state of print preview between messages. |
331 // TODO(vitalybuka): Create PrintPreviewContext when needed and delete after | 348 // TODO(vitalybuka): Create PrintPreviewContext when needed and delete after |
332 // use. Now it's interaction with various messages is confusing. | 349 // use. Now it's interaction with various messages is confusing. |
333 class PrintPreviewContext { | 350 class PrintPreviewContext { |
334 public: | 351 public: |
335 PrintPreviewContext(); | 352 PrintPreviewContext(); |
336 ~PrintPreviewContext(); | 353 ~PrintPreviewContext(); |
337 | 354 |
338 // Initializes the print preview context. Need to be called to set | 355 // Initializes the print preview context. Need to be called to set |
339 // the |web_frame| / |web_node| to generate the print preview for. | 356 // the |web_frame| / |web_node| to generate the print preview for. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
466 base::Closure on_stop_loading_closure_; | 483 base::Closure on_stop_loading_closure_; |
467 | 484 |
468 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 485 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
469 | 486 |
470 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 487 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
471 }; | 488 }; |
472 | 489 |
473 } // namespace printing | 490 } // namespace printing |
474 | 491 |
475 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 492 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |