Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: components/printing/renderer/print_web_view_helper.h

Issue 2122083002: Move CSS3 Paged Media interface into WebLocalFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More build fixes Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
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; 47 class WebFrame;
48 class WebLocalFrame;
48 class WebView; 49 class WebView;
49 } 50 }
50 51
51 namespace printing { 52 namespace printing {
52 53
53 struct PageSizeMargins; 54 struct PageSizeMargins;
54 class PrepareFrameAndViewForPrint; 55 class PrepareFrameAndViewForPrint;
55 56
56 // Stores reference to frame using WebVew and unique name. 57 // Stores reference to frame using WebVew and unique name.
57 // Workaround to modal dialog issue on Linux. crbug.com/236147. 58 // Workaround to modal dialog issue on Linux. crbug.com/236147.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 bool GetPrintSettingsFromUser(blink::WebLocalFrame* frame, 255 bool GetPrintSettingsFromUser(blink::WebLocalFrame* frame,
255 const blink::WebNode& node, 256 const blink::WebNode& node,
256 int expected_pages_count, 257 int expected_pages_count,
257 bool is_scripted); 258 bool is_scripted);
258 259
259 // Page Printing / Rendering ------------------------------------------------ 260 // Page Printing / Rendering ------------------------------------------------
260 261
261 #if defined(ENABLE_BASIC_PRINTING) 262 #if defined(ENABLE_BASIC_PRINTING)
262 void OnFramePreparedForPrintPages(); 263 void OnFramePreparedForPrintPages();
263 void PrintPages(); 264 void PrintPages();
264 bool PrintPagesNative(blink::WebFrame* frame, int page_count); 265 bool PrintPagesNative(blink::WebLocalFrame* frame, int page_count);
265 void FinishFramePrinting(); 266 void FinishFramePrinting();
266 // Render the frame for printing. 267 // Render the frame for printing.
267 bool RenderPagesForPrint(blink::WebLocalFrame* frame, 268 bool RenderPagesForPrint(blink::WebLocalFrame* frame,
268 const blink::WebNode& node); 269 const blink::WebNode& node);
269 #endif // defined(ENABLE_BASIC_PRINTING) 270 #endif // defined(ENABLE_BASIC_PRINTING)
270 271
271 // Prints the page listed in |params|. 272 // Prints the page listed in |params|.
272 #if defined(OS_MACOSX) 273 #if defined(OS_MACOSX)
273 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, 274 void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
274 blink::WebFrame* frame); 275 blink::WebLocalFrame* frame);
275 #else 276 #else
276 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, 277 void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
277 blink::WebFrame* frame, 278 blink::WebLocalFrame* frame,
278 PdfMetafileSkia* metafile, 279 PdfMetafileSkia* metafile,
279 gfx::Size* page_size_in_dpi, 280 gfx::Size* page_size_in_dpi,
280 gfx::Rect* content_area_in_dpi); 281 gfx::Rect* content_area_in_dpi);
281 #endif // defined(OS_MACOSX) 282 #endif // defined(OS_MACOSX)
282 283
283 // Platform specific helper function for rendering page(s) to |metafile|. 284 // Platform specific helper function for rendering page(s) to |metafile|.
284 #if defined(OS_MACOSX) 285 #if defined(OS_MACOSX)
285 void RenderPage(const PrintMsg_Print_Params& params, 286 void RenderPage(const PrintMsg_Print_Params& params,
286 int page_number, 287 int page_number,
287 blink::WebFrame* frame, 288 blink::WebLocalFrame* frame,
288 bool is_preview, 289 bool is_preview,
289 PdfMetafileSkia* metafile, 290 PdfMetafileSkia* metafile,
290 gfx::Size* page_size, 291 gfx::Size* page_size,
291 gfx::Rect* content_rect); 292 gfx::Rect* content_rect);
292 #endif // defined(OS_MACOSX) 293 #endif // defined(OS_MACOSX)
293 294
294 // Renders page contents from |frame| to |content_area| of |canvas|. 295 // Renders page contents from |frame| to |content_area| of |canvas|.
295 // |page_number| is zero-based. 296 // |page_number| is zero-based.
296 // When method is called, canvas should be setup to draw to |canvas_area| 297 // When method is called, canvas should be setup to draw to |canvas_area|
297 // with |scale_factor|. 298 // with |scale_factor|.
298 static float RenderPageContent(blink::WebFrame* frame, 299 static float RenderPageContent(blink::WebFrame* frame,
299 int page_number, 300 int page_number,
300 const gfx::Rect& canvas_area, 301 const gfx::Rect& canvas_area,
301 const gfx::Rect& content_area, 302 const gfx::Rect& content_area,
302 double scale_factor, 303 double scale_factor,
303 blink::WebCanvas* canvas); 304 blink::WebCanvas* canvas);
304 305
305 // Helper methods ----------------------------------------------------------- 306 // Helper methods -----------------------------------------------------------
306 307
307 bool CopyMetafileDataToSharedMem(const PdfMetafileSkia& metafile, 308 bool CopyMetafileDataToSharedMem(const PdfMetafileSkia& metafile,
308 base::SharedMemoryHandle* shared_mem_handle); 309 base::SharedMemoryHandle* shared_mem_handle);
309 310
310 // Helper method to get page layout in points and fit to page if needed. 311 // Helper method to get page layout in points and fit to page if needed.
311 static void ComputePageLayoutInPointsForCss( 312 static void ComputePageLayoutInPointsForCss(
312 blink::WebFrame* frame, 313 blink::WebLocalFrame* frame,
313 int page_index, 314 int page_index,
314 const PrintMsg_Print_Params& default_params, 315 const PrintMsg_Print_Params& default_params,
315 bool ignore_css_margins, 316 bool ignore_css_margins,
316 double* scale_factor, 317 double* scale_factor,
317 PageSizeMargins* page_layout_in_points); 318 PageSizeMargins* page_layout_in_points);
318 319
319 // Return an array of pages to print given the print |params| and an expected 320 // Return an array of pages to print given the print |params| and an expected
320 // |page_count|. Page numbers are zero-based. 321 // |page_count|. Page numbers are zero-based.
321 static std::vector<int> GetPrintedPages( 322 static std::vector<int> GetPrintedPages(
322 const PrintMsg_PrintPages_Params& params, 323 const PrintMsg_PrintPages_Params& params,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 base::Closure on_stop_loading_closure_; 526 base::Closure on_stop_loading_closure_;
526 527
527 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; 528 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_;
528 529
529 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); 530 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper);
530 }; 531 };
531 532
532 } // namespace printing 533 } // namespace printing
533 534
534 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ 535 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | components/printing/renderer/print_web_view_helper.cc » ('j') | third_party/WebKit/public/web/WebLocalFrame.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698