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 CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 6 #define CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 // Helper method to get page layout in points and fit to page if needed. | 259 // Helper method to get page layout in points and fit to page if needed. |
260 static void ComputePageLayoutInPointsForCss( | 260 static void ComputePageLayoutInPointsForCss( |
261 blink::WebFrame* frame, | 261 blink::WebFrame* frame, |
262 int page_index, | 262 int page_index, |
263 const PrintMsg_Print_Params& default_params, | 263 const PrintMsg_Print_Params& default_params, |
264 bool ignore_css_margins, | 264 bool ignore_css_margins, |
265 double* scale_factor, | 265 double* scale_factor, |
266 PageSizeMargins* page_layout_in_points); | 266 PageSizeMargins* page_layout_in_points); |
267 | 267 |
| 268 #if defined(ENABLE_PRINT_PREVIEW) |
268 // Given the |device| and |canvas| to draw on, prints the appropriate headers | 269 // Given the |device| and |canvas| to draw on, prints the appropriate headers |
269 // and footers using strings from |header_footer_info| on to the canvas. | 270 // and footers using strings from |header_footer_info| on to the canvas. |
270 static void PrintHeaderAndFooter(blink::WebCanvas* canvas, | 271 static void PrintHeaderAndFooter(blink::WebCanvas* canvas, |
271 int page_number, | 272 int page_number, |
272 int total_pages, | 273 int total_pages, |
273 const blink::WebFrame& source_frame, | 274 const blink::WebFrame& source_frame, |
274 float webkit_scale_factor, | 275 float webkit_scale_factor, |
275 const PageSizeMargins& page_layout_in_points, | 276 const PageSizeMargins& page_layout_in_points, |
276 const PrintMsg_Print_Params& params); | 277 const PrintMsg_Print_Params& params); |
| 278 #endif // defined(ENABLE_PRINT_PREVIEW) |
277 | 279 |
278 bool GetPrintFrame(blink::WebLocalFrame** frame); | 280 bool GetPrintFrame(blink::WebLocalFrame** frame); |
279 | 281 |
280 // Script Initiated Printing ------------------------------------------------ | 282 // Script Initiated Printing ------------------------------------------------ |
281 | 283 |
282 // Return true if script initiated printing is currently | 284 // Return true if script initiated printing is currently |
283 // allowed. |user_initiated| should be true when a user event triggered the | 285 // allowed. |user_initiated| should be true when a user event triggered the |
284 // script, most likely by pressing a print button on the page. | 286 // script, most likely by pressing a print button on the page. |
285 bool IsScriptInitiatedPrintAllowed(blink::WebFrame* frame, | 287 bool IsScriptInitiatedPrintAllowed(blink::WebFrame* frame, |
286 bool user_initiated); | 288 bool user_initiated); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 base::Closure on_stop_loading_closure_; | 462 base::Closure on_stop_loading_closure_; |
461 | 463 |
462 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 464 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
463 | 465 |
464 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 466 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
465 }; | 467 }; |
466 | 468 |
467 } // namespace printing | 469 } // namespace printing |
468 | 470 |
469 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ | 471 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |