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 "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 gfx::Size print_canvas_size_; | 55 gfx::Size print_canvas_size_; |
56 gfx::Size prev_view_size_; | 56 gfx::Size prev_view_size_; |
57 gfx::Size prev_scroll_offset_; | 57 gfx::Size prev_scroll_offset_; |
58 int expected_pages_count_; | 58 int expected_pages_count_; |
59 bool use_browser_overlays_; | 59 bool use_browser_overlays_; |
60 bool finished_; | 60 bool finished_; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); | 62 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); |
63 }; | 63 }; |
64 | 64 |
65 | |
66 // PrintWebViewHelper handles most of the printing grunt work for RenderView. | 65 // PrintWebViewHelper handles most of the printing grunt work for RenderView. |
67 // We plan on making print asynchronous and that will require copying the DOM | 66 // We plan on making print asynchronous and that will require copying the DOM |
68 // of the document and creating a new WebView with the contents. | 67 // of the document and creating a new WebView with the contents. |
69 class PrintWebViewHelper : public RenderViewObserver , | 68 class PrintWebViewHelper : public RenderViewObserver, |
70 public RenderViewObserverTracker<PrintWebViewHelper>, | 69 public RenderViewObserverTracker<PrintWebViewHelper>, |
71 public WebKit::WebViewClient, | 70 public WebKit::WebViewClient, |
72 public WebKit::WebFrameClient { | 71 public WebKit::WebFrameClient { |
73 public: | 72 public: |
74 explicit PrintWebViewHelper(RenderView* render_view); | 73 explicit PrintWebViewHelper(RenderView* render_view); |
75 virtual ~PrintWebViewHelper(); | 74 virtual ~PrintWebViewHelper(); |
76 | 75 |
77 protected: | 76 protected: |
78 // WebKit::WebViewClient override: | 77 // WebKit::WebViewClient override: |
79 virtual void didStopLoading(); | 78 virtual void didStopLoading(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void PrintPreview(WebKit::WebFrame* frame, | 124 void PrintPreview(WebKit::WebFrame* frame, |
126 WebKit::WebNode* node, | 125 WebKit::WebNode* node, |
127 const DictionaryValue& settings); | 126 const DictionaryValue& settings); |
128 | 127 |
129 enum PrintingResult { | 128 enum PrintingResult { |
130 OK, | 129 OK, |
131 FAIL_PRINT, | 130 FAIL_PRINT, |
132 FAIL_PREVIEW, | 131 FAIL_PREVIEW, |
133 }; | 132 }; |
134 | 133 |
135 // Notification when printing is done - signal teardown/free resources. | 134 // Notification when printing is done - signal tear-down/free resources. |
136 void DidFinishPrinting(PrintingResult result); | 135 void DidFinishPrinting(PrintingResult result); |
137 | 136 |
138 // Print Settings ----------------------------------------------------------- | 137 // Print Settings ----------------------------------------------------------- |
139 | 138 |
140 // Initialize print page settings with default settings. | 139 // Initialize print page settings with default settings. |
141 bool InitPrintSettings(WebKit::WebFrame* frame, | 140 bool InitPrintSettings(WebKit::WebFrame* frame, |
142 WebKit::WebNode* node); | 141 WebKit::WebNode* node); |
143 | 142 |
144 // Update the current print settings with new |job_settings|. |job_settings| | 143 // Update the current print settings with new |job_settings|. |job_settings| |
145 // dictionary contains print job details such as printer name, number of | 144 // dictionary contains print job details such as printer name, number of |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // the failure came from the browser in the first place. | 279 // the failure came from the browser in the first place. |
281 bool notify_browser_of_print_failure_; | 280 bool notify_browser_of_print_failure_; |
282 | 281 |
283 int preview_page_count_; | 282 int preview_page_count_; |
284 scoped_ptr<PrintMsg_PrintPages_Params> old_print_pages_params_; | 283 scoped_ptr<PrintMsg_PrintPages_Params> old_print_pages_params_; |
285 | 284 |
286 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 285 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
287 }; | 286 }; |
288 | 287 |
289 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 288 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |