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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 int page_count, | 202 int page_count, |
203 const gfx::Size& canvas_size); | 203 const gfx::Size& canvas_size); |
204 void FinishFramePrinting(); | 204 void FinishFramePrinting(); |
205 | 205 |
206 // Prints the page listed in |params|. | 206 // Prints the page listed in |params|. |
207 #if defined(OS_LINUX) || defined(OS_ANDROID) | 207 #if defined(OS_LINUX) || defined(OS_ANDROID) |
208 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, | 208 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, |
209 const gfx::Size& canvas_size, | 209 const gfx::Size& canvas_size, |
210 blink::WebFrame* frame, | 210 blink::WebFrame* frame, |
211 Metafile* metafile); | 211 Metafile* metafile); |
212 #elif defined(WIN_PDF_METAFILE_FOR_PRINTING) | 212 #elif defined(OS_WIN) |
213 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, | 213 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, |
214 const gfx::Size& canvas_size, | 214 const gfx::Size& canvas_size, |
215 blink::WebFrame* frame, | 215 blink::WebFrame* frame, |
216 Metafile* metafile, | 216 Metafile* metafile, |
217 gfx::Size* page_size_in_dpi, | 217 gfx::Size* page_size_in_dpi, |
218 gfx::Rect* content_area_in_dpi); | 218 gfx::Rect* content_area_in_dpi); |
219 #else | 219 #else |
220 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, | 220 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, |
221 const gfx::Size& canvas_size, | 221 const gfx::Size& canvas_size, |
222 blink::WebFrame* frame); | 222 blink::WebFrame* frame); |
223 #endif | 223 #endif |
224 | 224 |
225 // Render the frame for printing. | 225 // Render the frame for printing. |
226 bool RenderPagesForPrint(blink::WebLocalFrame* frame, | 226 bool RenderPagesForPrint(blink::WebLocalFrame* frame, |
227 const blink::WebNode& node); | 227 const blink::WebNode& node); |
228 | 228 |
229 // Platform specific helper function for rendering page(s) to |metafile|. | 229 // Platform specific helper function for rendering page(s) to |metafile|. |
230 #if defined(OS_WIN) && !defined(WIN_PDF_METAFILE_FOR_PRINTING) | 230 #if defined(OS_MACOSX) |
231 void RenderPage(const PrintMsg_Print_Params& params, | 231 void RenderPage(const PrintMsg_Print_Params& params, |
232 int page_number, | 232 int page_number, |
233 blink::WebFrame* frame, | 233 blink::WebFrame* frame, |
234 bool is_preview, | |
235 Metafile* metafile, | |
236 double* scale_factor, | |
237 gfx::Size* page_size_in_dpi, | |
238 gfx::Rect* content_area_in_dpi); | |
239 #elif defined(OS_MACOSX) | |
240 void RenderPage(const PrintMsg_Print_Params& params, | |
241 int page_number, | |
242 blink::WebFrame* frame, | |
243 bool is_preview, | 234 bool is_preview, |
244 Metafile* metafile, | 235 Metafile* metafile, |
245 gfx::Size* page_size, | 236 gfx::Size* page_size, |
246 gfx::Rect* content_rect); | 237 gfx::Rect* content_rect); |
247 #endif // defined(OS_WIN) | 238 #endif // defined(OS_MACOSX) |
248 | 239 |
249 // Renders page contents from |frame| to |content_area| of |canvas|. | 240 // Renders page contents from |frame| to |content_area| of |canvas|. |
250 // |page_number| is zero-based. | 241 // |page_number| is zero-based. |
251 // When method is called, canvas should be setup to draw to |canvas_area| | 242 // When method is called, canvas should be setup to draw to |canvas_area| |
252 // with |scale_factor|. | 243 // with |scale_factor|. |
253 static float RenderPageContent(blink::WebFrame* frame, | 244 static float RenderPageContent(blink::WebFrame* frame, |
254 int page_number, | 245 int page_number, |
255 const gfx::Rect& canvas_area, | 246 const gfx::Rect& canvas_area, |
256 const gfx::Rect& content_area, | 247 const gfx::Rect& content_area, |
257 double scale_factor, | 248 double scale_factor, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 // hangs because RequestPrintPreview is called before DidStopLoading() is | 441 // hangs because RequestPrintPreview is called before DidStopLoading() is |
451 // called. This is a store for the RequestPrintPreview() call and its | 442 // called. This is a store for the RequestPrintPreview() call and its |
452 // parameters so that it can be invoked after DidStopLoading. | 443 // parameters so that it can be invoked after DidStopLoading. |
453 base::Closure on_stop_loading_closure_; | 444 base::Closure on_stop_loading_closure_; |
454 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 445 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
455 }; | 446 }; |
456 | 447 |
457 } // namespace printing | 448 } // namespace printing |
458 | 449 |
459 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 450 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |