| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "gfx/size.h" | 12 #include "gfx/size.h" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebFrameClient.h" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebViewClient.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebViewClient.h" |
| 14 | 15 |
| 15 namespace gfx { | 16 namespace gfx { |
| 16 class Size; | 17 class Size; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace IPC { | 20 namespace IPC { |
| 20 class Message; | 21 class Message; |
| 21 } | 22 } |
| 22 | 23 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 int expected_pages_count_; | 64 int expected_pages_count_; |
| 64 bool use_browser_overlays_; | 65 bool use_browser_overlays_; |
| 65 | 66 |
| 66 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); | 67 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 | 70 |
| 70 // PrintWebViewHelper handles most of the printing grunt work for RenderView. | 71 // PrintWebViewHelper handles most of the printing grunt work for RenderView. |
| 71 // We plan on making print asynchronous and that will require copying the DOM | 72 // We plan on making print asynchronous and that will require copying the DOM |
| 72 // of the document and creating a new WebView with the contents. | 73 // of the document and creating a new WebView with the contents. |
| 73 class PrintWebViewHelper : public WebKit::WebViewClient { | 74 class PrintWebViewHelper : public WebKit::WebViewClient, |
| 75 public WebKit::WebFrameClient { |
| 74 public: | 76 public: |
| 75 explicit PrintWebViewHelper(RenderView* render_view); | 77 explicit PrintWebViewHelper(RenderView* render_view); |
| 76 virtual ~PrintWebViewHelper(); | 78 virtual ~PrintWebViewHelper(); |
| 77 | 79 |
| 78 void Print(WebKit::WebFrame* frame, bool script_initiated); | 80 void Print(WebKit::WebFrame* frame, bool script_initiated); |
| 79 | 81 |
| 80 // Is there a background print in progress? | 82 // Is there a background print in progress? |
| 81 bool IsPrinting() { | 83 bool IsPrinting() { |
| 82 return print_web_view_ != NULL; | 84 return print_web_view_ != NULL; |
| 83 } | 85 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 WebKit::WebView* print_web_view_; | 129 WebKit::WebView* print_web_view_; |
| 128 scoped_ptr<ViewMsg_PrintPages_Params> print_pages_params_; | 130 scoped_ptr<ViewMsg_PrintPages_Params> print_pages_params_; |
| 129 base::Time last_cancelled_script_print_; | 131 base::Time last_cancelled_script_print_; |
| 130 int user_cancelled_scripted_print_count_; | 132 int user_cancelled_scripted_print_count_; |
| 131 | 133 |
| 132 private: | 134 private: |
| 133 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 135 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 134 }; | 136 }; |
| 135 | 137 |
| 136 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 138 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |