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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 WebKit::WebFrame* frame, bool is_preview, | 285 WebKit::WebFrame* frame, bool is_preview, |
286 printing::Metafile* metafile, gfx::Size* page_size, | 286 printing::Metafile* metafile, gfx::Size* page_size, |
287 gfx::Rect* content_rect); | 287 gfx::Rect* content_rect); |
288 #elif defined(OS_POSIX) | 288 #elif defined(OS_POSIX) |
289 bool RenderPages(const PrintMsg_PrintPages_Params& params, | 289 bool RenderPages(const PrintMsg_PrintPages_Params& params, |
290 WebKit::WebFrame* frame, const WebKit::WebNode& node, | 290 WebKit::WebFrame* frame, const WebKit::WebNode& node, |
291 int* page_count, PrepareFrameAndViewForPrint* prepare, | 291 int* page_count, PrepareFrameAndViewForPrint* prepare, |
292 printing::Metafile* metafile); | 292 printing::Metafile* metafile); |
293 #endif // defined(OS_WIN) | 293 #endif // defined(OS_WIN) |
294 | 294 |
| 295 // Renders page contents from |frame| to |content_area| of |canvas|. |
| 296 // |page_number| is zero-based. |
| 297 // When method is called, canvas should be setup to draw to |canvas_area| |
| 298 // with |scale_factor|. |
| 299 static float RenderPageContent(WebKit::WebFrame* frame, |
| 300 int page_number, |
| 301 const gfx::Rect& canvas_area, |
| 302 const gfx::Rect& content_area, |
| 303 double scale_factor, |
| 304 WebKit::WebCanvas* canvas); |
| 305 |
295 // Helper methods ----------------------------------------------------------- | 306 // Helper methods ----------------------------------------------------------- |
296 | 307 |
297 bool CopyAndPrint(WebKit::WebFrame* web_frame); | 308 bool CopyAndPrint(WebKit::WebFrame* web_frame); |
298 | 309 |
299 bool CopyMetafileDataToSharedMem(printing::Metafile* metafile, | 310 bool CopyMetafileDataToSharedMem(printing::Metafile* metafile, |
300 base::SharedMemoryHandle* shared_mem_handle); | 311 base::SharedMemoryHandle* shared_mem_handle); |
301 | 312 |
302 // Helper method to get page layout in points and fit to page if needed. | 313 // Helper method to get page layout in points and fit to page if needed. |
303 static void ComputePageLayoutInPointsForCss( | 314 static void ComputePageLayoutInPointsForCss( |
304 WebKit::WebFrame* frame, | 315 WebKit::WebFrame* frame, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 498 |
488 State state_; | 499 State state_; |
489 }; | 500 }; |
490 | 501 |
491 bool print_node_in_progress_; | 502 bool print_node_in_progress_; |
492 PrintPreviewContext print_preview_context_; | 503 PrintPreviewContext print_preview_context_; |
493 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 504 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
494 }; | 505 }; |
495 | 506 |
496 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 507 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |