OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 WebKit::WebFrame* frame); | 221 WebKit::WebFrame* frame); |
222 #endif | 222 #endif |
223 | 223 |
224 // Render the frame for printing. | 224 // Render the frame for printing. |
225 bool RenderPagesForPrint(WebKit::WebFrame* frame, WebKit::WebNode* node, | 225 bool RenderPagesForPrint(WebKit::WebFrame* frame, WebKit::WebNode* node, |
226 PrepareFrameAndViewForPrint* prepare); | 226 PrepareFrameAndViewForPrint* prepare); |
227 | 227 |
228 // Platform specific helper function for rendering page(s) to |metafile|. | 228 // Platform specific helper function for rendering page(s) to |metafile|. |
229 #if defined(OS_WIN) | 229 #if defined(OS_WIN) |
230 void RenderPage(const PrintMsg_Print_Params& params, float* scale_factor, | 230 void RenderPage(const PrintMsg_Print_Params& params, float* scale_factor, |
231 int page_number, int page_slot, bool is_preview, | 231 int page_number, bool is_preview, WebKit::WebFrame* frame, |
232 WebKit::WebFrame* frame, | |
233 scoped_ptr<printing::Metafile>* metafile); | 232 scoped_ptr<printing::Metafile>* metafile); |
234 #elif defined(OS_MACOSX) | 233 #elif defined(OS_MACOSX) |
235 void RenderPage(const gfx::Size& page_size, const gfx::Rect& content_area, | 234 void RenderPage(const gfx::Size& page_size, const gfx::Rect& content_area, |
236 const float& scale_factor, int page_number, int page_slot, | 235 const float& scale_factor, int page_number, |
237 WebKit::WebFrame* frame, printing::Metafile* metafile); | 236 WebKit::WebFrame* frame, printing::Metafile* metafile); |
238 #elif defined(OS_POSIX) | 237 #elif defined(OS_POSIX) |
239 bool RenderPages(const PrintMsg_PrintPages_Params& params, | 238 bool RenderPages(const PrintMsg_PrintPages_Params& params, |
240 WebKit::WebFrame* frame, WebKit::WebNode* node, | 239 WebKit::WebFrame* frame, WebKit::WebNode* node, |
241 int* page_count, PrepareFrameAndViewForPrint* prepare, | 240 int* page_count, PrepareFrameAndViewForPrint* prepare, |
242 printing::Metafile* metafile); | 241 printing::Metafile* metafile); |
243 #endif // defined(OS_WIN) | 242 #endif // defined(OS_WIN) |
244 | 243 |
245 // Helper methods ----------------------------------------------------------- | 244 // Helper methods ----------------------------------------------------------- |
246 | 245 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 333 |
335 // Abort the print preview. | 334 // Abort the print preview. |
336 void Abort(); | 335 void Abort(); |
337 | 336 |
338 // Helper functions | 337 // Helper functions |
339 int GetNextPageNumber(); | 338 int GetNextPageNumber(); |
340 bool IsReadyToRender() const; | 339 bool IsReadyToRender() const; |
341 bool IsBusy() const; | 340 bool IsBusy() const; |
342 bool IsModifiable() const; | 341 bool IsModifiable() const; |
343 | 342 |
344 // Return the page slot in the final document for |page_number|. i.e. if | |
345 // the user selected just page 3, the page slot would be 0, since it is | |
346 // the first page in the resulting document. | |
347 int GetPageSlotForPage(int page_number) const; | |
348 | |
349 // Getters | 343 // Getters |
350 WebKit::WebFrame* frame() const; | 344 WebKit::WebFrame* frame() const; |
351 WebKit::WebNode* node() const; | 345 WebKit::WebNode* node() const; |
352 int total_page_count() const; | 346 int total_page_count() const; |
353 printing::Metafile* metafile() const; | 347 printing::Metafile* metafile() const; |
354 const PrintMsg_Print_Params& print_params() const; | 348 const PrintMsg_Print_Params& print_params() const; |
355 const gfx::Size& GetPrintCanvasSize() const; | 349 const gfx::Size& GetPrintCanvasSize() const; |
356 | 350 |
357 private: | 351 private: |
358 enum State { | 352 enum State { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 386 |
393 State state_; | 387 State state_; |
394 }; | 388 }; |
395 | 389 |
396 PrintPreviewContext print_preview_context_; | 390 PrintPreviewContext print_preview_context_; |
397 | 391 |
398 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 392 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
399 }; | 393 }; |
400 | 394 |
401 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 395 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |