| 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 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #else | 37 #else |
| 38 #define MAYBE_PrintWebViewHelperTest PrintWebViewHelperTest | 38 #define MAYBE_PrintWebViewHelperTest PrintWebViewHelperTest |
| 39 #define MAYBE_PrintWebViewHelperPreviewTest PrintWebViewHelperPreviewTest | 39 #define MAYBE_PrintWebViewHelperPreviewTest PrintWebViewHelperPreviewTest |
| 40 #endif // defined(OS_ANDROID) | 40 #endif // defined(OS_ANDROID) |
| 41 | 41 |
| 42 namespace base { | 42 namespace base { |
| 43 class DictionaryValue; | 43 class DictionaryValue; |
| 44 } | 44 } |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 class WebFrame; | |
| 48 class WebLocalFrame; | 47 class WebLocalFrame; |
| 49 class WebView; | 48 class WebView; |
| 50 } | 49 } |
| 51 | 50 |
| 52 namespace printing { | 51 namespace printing { |
| 53 | 52 |
| 54 struct PageSizeMargins; | 53 struct PageSizeMargins; |
| 55 class PrepareFrameAndViewForPrint; | 54 class PrepareFrameAndViewForPrint; |
| 56 | 55 |
| 57 // Stores reference to frame using WebVew and unique name. | 56 // Stores reference to frame using WebVew and unique name. |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 bool is_preview, | 314 bool is_preview, |
| 316 PdfMetafileSkia* metafile, | 315 PdfMetafileSkia* metafile, |
| 317 gfx::Size* page_size, | 316 gfx::Size* page_size, |
| 318 gfx::Rect* content_rect); | 317 gfx::Rect* content_rect); |
| 319 #endif // defined(OS_MACOSX) | 318 #endif // defined(OS_MACOSX) |
| 320 | 319 |
| 321 // Renders page contents from |frame| to |content_area| of |canvas|. | 320 // Renders page contents from |frame| to |content_area| of |canvas|. |
| 322 // |page_number| is zero-based. | 321 // |page_number| is zero-based. |
| 323 // When method is called, canvas should be setup to draw to |canvas_area| | 322 // When method is called, canvas should be setup to draw to |canvas_area| |
| 324 // with |scale_factor|. | 323 // with |scale_factor|. |
| 325 static float RenderPageContent(blink::WebFrame* frame, | 324 static float RenderPageContent(blink::WebLocalFrame* frame, |
| 326 int page_number, | 325 int page_number, |
| 327 const gfx::Rect& canvas_area, | 326 const gfx::Rect& canvas_area, |
| 328 const gfx::Rect& content_area, | 327 const gfx::Rect& content_area, |
| 329 double scale_factor, | 328 double scale_factor, |
| 330 blink::WebCanvas* canvas); | 329 blink::WebCanvas* canvas); |
| 331 | 330 |
| 332 // Helper methods ----------------------------------------------------------- | 331 // Helper methods ----------------------------------------------------------- |
| 333 | 332 |
| 334 bool CopyMetafileDataToSharedMem(const PdfMetafileSkia& metafile, | 333 bool CopyMetafileDataToSharedMem(const PdfMetafileSkia& metafile, |
| 335 base::SharedMemoryHandle* shared_mem_handle); | 334 base::SharedMemoryHandle* shared_mem_handle); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 347 // |page_count|. Page numbers are zero-based. | 346 // |page_count|. Page numbers are zero-based. |
| 348 static std::vector<int> GetPrintedPages( | 347 static std::vector<int> GetPrintedPages( |
| 349 const PrintMsg_PrintPages_Params& params, | 348 const PrintMsg_PrintPages_Params& params, |
| 350 int page_count); | 349 int page_count); |
| 351 | 350 |
| 352 // Given the |canvas| to draw on, prints the appropriate headers and footers | 351 // Given the |canvas| to draw on, prints the appropriate headers and footers |
| 353 // to |canvas| using information from the remaining parameters. | 352 // to |canvas| using information from the remaining parameters. |
| 354 static void PrintHeaderAndFooter(blink::WebCanvas* canvas, | 353 static void PrintHeaderAndFooter(blink::WebCanvas* canvas, |
| 355 int page_number, | 354 int page_number, |
| 356 int total_pages, | 355 int total_pages, |
| 357 const blink::WebFrame& source_frame, | 356 const blink::WebLocalFrame& source_frame, |
| 358 float webkit_scale_factor, | 357 float webkit_scale_factor, |
| 359 const PageSizeMargins& page_layout_in_points, | 358 const PageSizeMargins& page_layout_in_points, |
| 360 const PrintMsg_Print_Params& params); | 359 const PrintMsg_Print_Params& params); |
| 361 | 360 |
| 362 // Script Initiated Printing ------------------------------------------------ | 361 // Script Initiated Printing ------------------------------------------------ |
| 363 | 362 |
| 364 // Return true if script initiated printing is currently | 363 // Return true if script initiated printing is currently |
| 365 // allowed. |user_initiated| should be true when a user event triggered the | 364 // allowed. |user_initiated| should be true when a user event triggered the |
| 366 // script, most likely by pressing a print button on the page. | 365 // script, most likely by pressing a print button on the page. |
| 367 bool IsScriptInitiatedPrintAllowed(blink::WebLocalFrame* frame, | 366 bool IsScriptInitiatedPrintAllowed(blink::WebLocalFrame* frame, |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 base::Closure on_stop_loading_closure_; | 557 base::Closure on_stop_loading_closure_; |
| 559 | 558 |
| 560 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 559 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
| 561 | 560 |
| 562 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 561 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 563 }; | 562 }; |
| 564 | 563 |
| 565 } // namespace printing | 564 } // namespace printing |
| 566 | 565 |
| 567 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 566 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |