| 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_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 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 WebKit::WebFrame* frame_; | 71 WebKit::WebFrame* frame_; |
| 72 WebKit::WebNode node_to_print_; | 72 WebKit::WebNode node_to_print_; |
| 73 WebKit::WebView* web_view_; | 73 WebKit::WebView* web_view_; |
| 74 WebKit::WebPrintParams web_print_params_; | 74 WebKit::WebPrintParams web_print_params_; |
| 75 gfx::Size prev_view_size_; | 75 gfx::Size prev_view_size_; |
| 76 gfx::Size prev_scroll_offset_; | 76 gfx::Size prev_scroll_offset_; |
| 77 int expected_pages_count_; | 77 int expected_pages_count_; |
| 78 bool use_browser_overlays_; | 78 bool use_browser_overlays_; |
| 79 bool finished_; | 79 bool finished_; |
| 80 bool should_print_backgrounds_; |
| 80 | 81 |
| 81 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); | 82 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 // PrintWebViewHelper handles most of the printing grunt work for RenderView. | 85 // PrintWebViewHelper handles most of the printing grunt work for RenderView. |
| 85 // We plan on making print asynchronous and that will require copying the DOM | 86 // We plan on making print asynchronous and that will require copying the DOM |
| 86 // of the document and creating a new WebView with the contents. | 87 // of the document and creating a new WebView with the contents. |
| 87 class PrintWebViewHelper | 88 class PrintWebViewHelper |
| 88 : public content::RenderViewObserver, | 89 : public content::RenderViewObserver, |
| 89 public content::RenderViewObserverTracker<PrintWebViewHelper>, | 90 public content::RenderViewObserverTracker<PrintWebViewHelper>, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 228 |
| 228 // Initialize print page settings with default settings and prepare the frame | 229 // Initialize print page settings with default settings and prepare the frame |
| 229 // for print. A new PrepareFrameAndViewForPrint is created to fulfill the | 230 // for print. A new PrepareFrameAndViewForPrint is created to fulfill the |
| 230 // request and is filled into the |prepare| argument. | 231 // request and is filled into the |prepare| argument. |
| 231 // Used only for native printing workflow. | 232 // Used only for native printing workflow. |
| 232 bool InitPrintSettingsAndPrepareFrame( | 233 bool InitPrintSettingsAndPrepareFrame( |
| 233 WebKit::WebFrame* frame, | 234 WebKit::WebFrame* frame, |
| 234 const WebKit::WebNode& node, | 235 const WebKit::WebNode& node, |
| 235 scoped_ptr<PrepareFrameAndViewForPrint>* prepare); | 236 scoped_ptr<PrepareFrameAndViewForPrint>* prepare); |
| 236 | 237 |
| 237 // Update the current print settings with new |job_settings|. |job_settings| | 238 // Update the current print settings with new |passed_job_settings|. |
| 238 // dictionary contains print job details such as printer name, number of | 239 // |passed_job_settings| dictionary contains print job details such as printer |
| 239 // copies, page range, etc. | 240 // name, number of copies, page range, etc. |
| 240 bool UpdatePrintSettings(WebKit::WebFrame* frame, | 241 bool UpdatePrintSettings(WebKit::WebFrame* frame, |
| 241 const WebKit::WebNode& node, | 242 const WebKit::WebNode& node, |
| 242 const base::DictionaryValue& passed_job_settings); | 243 const base::DictionaryValue& passed_job_settings); |
| 243 | 244 |
| 244 // Get final print settings from the user. | 245 // Get final print settings from the user. |
| 245 // Return false if the user cancels or on error. | 246 // Return false if the user cancels or on error. |
| 246 bool GetPrintSettingsFromUser(WebKit::WebFrame* frame, | 247 bool GetPrintSettingsFromUser(WebKit::WebFrame* frame, |
| 247 const WebKit::WebNode& node, | 248 const WebKit::WebNode& node, |
| 248 int expected_pages_count, | 249 int expected_pages_count, |
| 249 bool use_browser_overlays); | 250 bool use_browser_overlays); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 | 499 |
| 499 State state_; | 500 State state_; |
| 500 }; | 501 }; |
| 501 | 502 |
| 502 bool print_node_in_progress_; | 503 bool print_node_in_progress_; |
| 503 PrintPreviewContext print_preview_context_; | 504 PrintPreviewContext print_preview_context_; |
| 504 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 505 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 505 }; | 506 }; |
| 506 | 507 |
| 507 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 508 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |