| 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 COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 6 #define COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 6 #define COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/shared_memory.h" | 14 #include "base/memory/shared_memory.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "content/public/renderer/render_frame_observer.h" | 18 #include "content/public/renderer/render_frame_observer.h" |
| 19 #include "content/public/renderer/render_frame_observer_tracker.h" | 19 #include "content/public/renderer/render_frame_observer_tracker.h" |
| 20 #include "printing/features/features.h" | 20 #include "printing/features/features.h" |
| 21 #include "printing/pdf_metafile_skia.h" | 21 #include "printing/pdf_metafile_skia.h" |
| 22 #include "third_party/WebKit/public/platform/WebCanvas.h" | 22 #include "third_party/WebKit/public/platform/WebCanvas.h" |
| 23 #include "third_party/WebKit/public/web/WebNode.h" | 23 #include "third_party/WebKit/public/web/WebNode.h" |
| 24 #include "third_party/WebKit/public/web/WebPrintParams.h" | 24 #include "third_party/WebKit/public/web/WebPrintParams.h" |
| 25 #include "ui/gfx/geometry/size.h" | 25 #include "ui/gfx/geometry/size.h" |
| 26 | 26 |
| 27 struct PrintMsg_Print_Params; | 27 struct PrintMsg_Print_Params; |
| 28 struct PrintMsg_PrintPage_Params; | |
| 29 struct PrintMsg_PrintPages_Params; | 28 struct PrintMsg_PrintPages_Params; |
| 30 struct PrintHostMsg_SetOptionsFromDocument_Params; | 29 struct PrintHostMsg_SetOptionsFromDocument_Params; |
| 31 | 30 |
| 32 // RenderViewTest-based tests crash on Android | 31 // RenderViewTest-based tests crash on Android |
| 33 // http://crbug.com/187500 | 32 // http://crbug.com/187500 |
| 34 #if defined(OS_ANDROID) | 33 #if defined(OS_ANDROID) |
| 35 #define MAYBE_PrintWebViewHelperTest DISABLED_PrintWebViewHelperTest | 34 #define MAYBE_PrintWebViewHelperTest DISABLED_PrintWebViewHelperTest |
| 36 #define MAYBE_PrintWebViewHelperPreviewTest \ | 35 #define MAYBE_PrintWebViewHelperPreviewTest \ |
| 37 DISABLED_PrintWebViewHelperPreviewTest | 36 DISABLED_PrintWebViewHelperPreviewTest |
| 38 #else | 37 #else |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 void PrintPages(); | 284 void PrintPages(); |
| 286 bool PrintPagesNative(blink::WebLocalFrame* frame, int page_count); | 285 bool PrintPagesNative(blink::WebLocalFrame* frame, int page_count); |
| 287 void FinishFramePrinting(); | 286 void FinishFramePrinting(); |
| 288 // Render the frame for printing. | 287 // Render the frame for printing. |
| 289 bool RenderPagesForPrint(blink::WebLocalFrame* frame, | 288 bool RenderPagesForPrint(blink::WebLocalFrame* frame, |
| 290 const blink::WebNode& node); | 289 const blink::WebNode& node); |
| 291 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) | 290 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 292 | 291 |
| 293 // Prints the page listed in |params|. | 292 // Prints the page listed in |params|. |
| 294 #if defined(OS_MACOSX) | 293 #if defined(OS_MACOSX) |
| 295 void PrintPagesInternal(const PrintMsg_PrintPage_Params& params, | 294 void PrintPagesInternal(const PrintMsg_Print_Params& params, |
| 296 blink::WebLocalFrame* frame, | 295 const std::vector<int>& printed_pages, |
| 297 const std::vector<int>& printed_pages); | 296 blink::WebLocalFrame* frame); |
| 298 #else | 297 #else |
| 299 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, | 298 void PrintPageInternal(const PrintMsg_Print_Params& params, |
| 299 int page_number, |
| 300 blink::WebLocalFrame* frame, | 300 blink::WebLocalFrame* frame, |
| 301 PdfMetafileSkia* metafile, | 301 PdfMetafileSkia* metafile, |
| 302 gfx::Size* page_size_in_dpi, | 302 gfx::Size* page_size_in_dpi, |
| 303 gfx::Rect* content_area_in_dpi, | 303 gfx::Rect* content_area_in_dpi, |
| 304 gfx::Rect* printable_area_in_dpi); | 304 gfx::Rect* printable_area_in_dpi); |
| 305 #endif // defined(OS_MACOSX) | 305 #endif // defined(OS_MACOSX) |
| 306 | 306 |
| 307 // Platform specific helper function for rendering page(s) to |metafile|. | 307 // Platform specific helper function for rendering page(s) to |metafile|. |
| 308 #if defined(OS_MACOSX) | 308 #if defined(OS_MACOSX) |
| 309 void RenderPage(const PrintMsg_Print_Params& params, | 309 void RenderPage(const PrintMsg_Print_Params& params, |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 base::Closure on_stop_loading_closure_; | 549 base::Closure on_stop_loading_closure_; |
| 550 | 550 |
| 551 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 551 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
| 552 | 552 |
| 553 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 553 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 554 }; | 554 }; |
| 555 | 555 |
| 556 } // namespace printing | 556 } // namespace printing |
| 557 | 557 |
| 558 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 558 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |