| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 | 5 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 |
| 6 | 6 |
| 7 #ifndef AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 7 #ifndef AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 8 #define AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 8 #define AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.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 "content/public/renderer/render_view_observer.h" | 17 #include "content/public/renderer/render_view_observer.h" |
| 18 #include "content/public/renderer/render_view_observer_tracker.h" | 18 #include "content/public/renderer/render_view_observer_tracker.h" |
| 19 #include "printing/metafile_impl.h" | 19 #include "printing/pdf_metafile_skia.h" |
| 20 #include "third_party/WebKit/public/platform/WebCanvas.h" | 20 #include "third_party/WebKit/public/platform/WebCanvas.h" |
| 21 #include "third_party/WebKit/public/web/WebNode.h" | 21 #include "third_party/WebKit/public/web/WebNode.h" |
| 22 #include "third_party/WebKit/public/web/WebPrintParams.h" | 22 #include "third_party/WebKit/public/web/WebPrintParams.h" |
| 23 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
| 24 | 24 |
| 25 struct PrintMsg_Print_Params; | 25 struct PrintMsg_Print_Params; |
| 26 struct PrintMsg_PrintPage_Params; | 26 struct PrintMsg_PrintPage_Params; |
| 27 struct PrintMsg_PrintPages_Params; | 27 struct PrintMsg_PrintPages_Params; |
| 28 | 28 |
| 29 namespace base { | 29 namespace base { |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 // Frame to be use to render preview. May be the same as source_frame(), or | 414 // Frame to be use to render preview. May be the same as source_frame(), or |
| 415 // generated from it, e.g. copy of selected block. | 415 // generated from it, e.g. copy of selected block. |
| 416 blink::WebLocalFrame* prepared_frame(); | 416 blink::WebLocalFrame* prepared_frame(); |
| 417 // Node to be use to render preview. May be the same as source_node(), or | 417 // Node to be use to render preview. May be the same as source_node(), or |
| 418 // generated from it, e.g. copy of selected block. | 418 // generated from it, e.g. copy of selected block. |
| 419 const blink::WebNode& prepared_node() const; | 419 const blink::WebNode& prepared_node() const; |
| 420 | 420 |
| 421 int total_page_count() const; | 421 int total_page_count() const; |
| 422 bool generate_draft_pages() const; | 422 bool generate_draft_pages() const; |
| 423 PreviewMetafile* metafile(); | 423 PdfMetafileSkia* metafile(); |
| 424 gfx::Size GetPrintCanvasSize() const; | 424 gfx::Size GetPrintCanvasSize() const; |
| 425 int last_error() const; | 425 int last_error() const; |
| 426 | 426 |
| 427 private: | 427 private: |
| 428 enum State { | 428 enum State { |
| 429 UNINITIALIZED, // Not ready to render. | 429 UNINITIALIZED, // Not ready to render. |
| 430 INITIALIZED, // Ready to render. | 430 INITIALIZED, // Ready to render. |
| 431 RENDERING, // Rendering. | 431 RENDERING, // Rendering. |
| 432 DONE // Finished rendering. | 432 DONE // Finished rendering. |
| 433 }; | 433 }; |
| 434 | 434 |
| 435 // Reset some of the internal rendering context. | 435 // Reset some of the internal rendering context. |
| 436 void ClearContext(); | 436 void ClearContext(); |
| 437 | 437 |
| 438 // Specifies what to render for print preview. | 438 // Specifies what to render for print preview. |
| 439 FrameReference source_frame_; | 439 FrameReference source_frame_; |
| 440 blink::WebNode source_node_; | 440 blink::WebNode source_node_; |
| 441 | 441 |
| 442 scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_; | 442 scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_; |
| 443 scoped_ptr<PreviewMetafile> metafile_; | 443 scoped_ptr<PdfMetafileSkia> metafile_; |
| 444 | 444 |
| 445 // Total page count in the renderer. | 445 // Total page count in the renderer. |
| 446 int total_page_count_; | 446 int total_page_count_; |
| 447 | 447 |
| 448 // The current page to render. | 448 // The current page to render. |
| 449 int current_page_index_; | 449 int current_page_index_; |
| 450 | 450 |
| 451 // List of page indices that need to be rendered. | 451 // List of page indices that need to be rendered. |
| 452 std::vector<int> pages_to_render_; | 452 std::vector<int> pages_to_render_; |
| 453 | 453 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 469 PrintPreviewContext print_preview_context_; | 469 PrintPreviewContext print_preview_context_; |
| 470 bool is_loading_; | 470 bool is_loading_; |
| 471 bool is_scripted_preview_delayed_; | 471 bool is_scripted_preview_delayed_; |
| 472 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 472 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
| 473 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 473 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 474 }; | 474 }; |
| 475 | 475 |
| 476 } // namespace printing | 476 } // namespace printing |
| 477 | 477 |
| 478 #endif // AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 478 #endif // AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |