| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 WebKit::WebFrame* frame, | 49 WebKit::WebFrame* frame, |
| 50 WebKit::WebNode* node); | 50 WebKit::WebNode* node); |
| 51 ~PrepareFrameAndViewForPrint(); | 51 ~PrepareFrameAndViewForPrint(); |
| 52 | 52 |
| 53 void UpdatePrintParams(const PrintMsg_Print_Params& print_params); | 53 void UpdatePrintParams(const PrintMsg_Print_Params& print_params); |
| 54 | 54 |
| 55 int GetExpectedPageCount() const { | 55 int GetExpectedPageCount() const { |
| 56 return expected_pages_count_; | 56 return expected_pages_count_; |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool ShouldUseBrowserOverlays() const { | 59 bool ShouldUseBrowserOverlays() const; |
| 60 return use_browser_overlays_; | |
| 61 } | |
| 62 | 60 |
| 63 const gfx::Size& GetPrintCanvasSize() const { | 61 const gfx::Size& GetPrintCanvasSize() const { |
| 64 return print_canvas_size_; | 62 return print_canvas_size_; |
| 65 } | 63 } |
| 66 | 64 |
| 67 void FinishPrinting(); | 65 void FinishPrinting(); |
| 68 | 66 |
| 69 private: | 67 private: |
| 70 void StartPrinting(const gfx::Size& print_params); | 68 void StartPrinting(const gfx::Size& print_params, int dpi); |
| 71 | 69 |
| 72 WebKit::WebFrame* frame_; | 70 WebKit::WebFrame* frame_; |
| 73 WebKit::WebNode node_to_print_; | |
| 74 WebKit::WebView* web_view_; | 71 WebKit::WebView* web_view_; |
| 75 gfx::Size print_canvas_size_; | 72 gfx::Size print_canvas_size_; |
| 76 gfx::Size prev_view_size_; | 73 gfx::Size prev_view_size_; |
| 77 gfx::Size prev_scroll_offset_; | 74 gfx::Size prev_scroll_offset_; |
| 78 int dpi_; | |
| 79 int expected_pages_count_; | 75 int expected_pages_count_; |
| 80 bool use_browser_overlays_; | |
| 81 bool finished_; | 76 bool finished_; |
| 82 | 77 |
| 83 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); | 78 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); |
| 84 }; | 79 }; |
| 85 | 80 |
| 86 // PrintWebViewHelper handles most of the printing grunt work for RenderView. | 81 // PrintWebViewHelper handles most of the printing grunt work for RenderView. |
| 87 // We plan on making print asynchronous and that will require copying the DOM | 82 // We plan on making print asynchronous and that will require copying the DOM |
| 88 // of the document and creating a new WebView with the contents. | 83 // of the document and creating a new WebView with the contents. |
| 89 class PrintWebViewHelper : public RenderViewObserver, | 84 class PrintWebViewHelper : public RenderViewObserver, |
| 90 public RenderViewObserverTracker<PrintWebViewHelper>, | 85 public RenderViewObserverTracker<PrintWebViewHelper>, |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 427 |
| 433 State state_; | 428 State state_; |
| 434 }; | 429 }; |
| 435 | 430 |
| 436 PrintPreviewContext print_preview_context_; | 431 PrintPreviewContext print_preview_context_; |
| 437 | 432 |
| 438 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 433 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 439 }; | 434 }; |
| 440 | 435 |
| 441 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 436 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |