OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_DELEGATE_H_ | 5 #ifndef CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
6 #define CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_ | 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "webkit/glue/webview_delegate.h" | 13 #include "webkit/glue/webview_delegate.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 class Size; | 16 class Size; |
17 } | 17 } |
18 | 18 |
19 namespace IPC { | 19 namespace IPC { |
20 class Message; | 20 class Message; |
21 } | 21 } |
22 | 22 |
| 23 #if defined(OS_LINUX) |
| 24 namespace printing { |
| 25 class PdfPsMetafile; |
| 26 typedef PdfPsMetafile NativeMetafile; |
| 27 } |
| 28 #endif |
| 29 |
23 class RenderView; | 30 class RenderView; |
24 class WebView; | 31 class WebView; |
25 struct ViewMsg_Print_Params; | 32 struct ViewMsg_Print_Params; |
26 struct ViewMsg_PrintPage_Params; | 33 struct ViewMsg_PrintPage_Params; |
27 struct ViewMsg_PrintPages_Params; | 34 struct ViewMsg_PrintPages_Params; |
28 | 35 |
29 | 36 |
30 // Class that calls the Begin and End print functions on the frame and changes | 37 // Class that calls the Begin and End print functions on the frame and changes |
31 // the size of the view temporarily to support full page printing.. | 38 // the size of the view temporarily to support full page printing.. |
32 // Do not serve any events in the time between construction and destruction of | 39 // Do not serve any events in the time between construction and destruction of |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 void PrintPageAsJPEG(const ViewMsg_PrintPage_Params& params, | 88 void PrintPageAsJPEG(const ViewMsg_PrintPage_Params& params, |
82 WebKit::WebFrame* frame, | 89 WebKit::WebFrame* frame, |
83 float zoom_factor, | 90 float zoom_factor, |
84 std::vector<unsigned char>* image_data); | 91 std::vector<unsigned char>* image_data); |
85 | 92 |
86 protected: | 93 protected: |
87 bool CopyAndPrint(const ViewMsg_PrintPages_Params& params, | 94 bool CopyAndPrint(const ViewMsg_PrintPages_Params& params, |
88 WebKit::WebFrame* web_frame); | 95 WebKit::WebFrame* web_frame); |
89 | 96 |
90 // Prints the page listed in |params|. | 97 // Prints the page listed in |params|. |
| 98 #if defined(OS_LINUX) |
| 99 void PrintPage(const ViewMsg_PrintPage_Params& params, |
| 100 const gfx::Size& canvas_size, |
| 101 WebKit::WebFrame* frame, |
| 102 printing::NativeMetafile* metafile); |
| 103 #else |
91 void PrintPage(const ViewMsg_PrintPage_Params& params, | 104 void PrintPage(const ViewMsg_PrintPage_Params& params, |
92 const gfx::Size& canvas_size, | 105 const gfx::Size& canvas_size, |
93 WebKit::WebFrame* frame); | 106 WebKit::WebFrame* frame); |
| 107 #endif |
94 | 108 |
95 // Prints all the pages listed in |params|. | 109 // Prints all the pages listed in |params|. |
96 // It will implicitly revert the document to display CSS media type. | 110 // It will implicitly revert the document to display CSS media type. |
97 void PrintPages(const ViewMsg_PrintPages_Params& params, | 111 void PrintPages(const ViewMsg_PrintPages_Params& params, |
98 WebKit::WebFrame* frame); | 112 WebKit::WebFrame* frame); |
99 | 113 |
100 // IPC::Message::Sender | 114 // IPC::Message::Sender |
101 bool Send(IPC::Message* msg); | 115 bool Send(IPC::Message* msg); |
102 | 116 |
103 int32 routing_id(); | 117 int32 routing_id(); |
(...skipping 18 matching lines...) Expand all Loading... |
122 RenderView* render_view_; | 136 RenderView* render_view_; |
123 scoped_ptr<WebView> print_web_view_; | 137 scoped_ptr<WebView> print_web_view_; |
124 scoped_ptr<ViewMsg_PrintPages_Params> print_pages_params_; | 138 scoped_ptr<ViewMsg_PrintPages_Params> print_pages_params_; |
125 base::Time last_cancelled_script_print_; | 139 base::Time last_cancelled_script_print_; |
126 int user_cancelled_scripted_print_count_; | 140 int user_cancelled_scripted_print_count_; |
127 | 141 |
128 private: | 142 private: |
129 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 143 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
130 }; | 144 }; |
131 | 145 |
132 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_DELEGATE_H_ | 146 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |