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

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

Issue 559263002: Replaced Metafile with PdfMetafileSkia in renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Thu Sep 11 15:46:31 PDT 2014 Created 6 years, 3 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 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 bool PrintPagesNative(blink::WebFrame* frame, 210 bool PrintPagesNative(blink::WebFrame* frame,
211 int page_count, 211 int page_count,
212 const gfx::Size& canvas_size); 212 const gfx::Size& canvas_size);
213 void FinishFramePrinting(); 213 void FinishFramePrinting();
214 214
215 // Prints the page listed in |params|. 215 // Prints the page listed in |params|.
216 #if defined(OS_LINUX) || defined(OS_ANDROID) 216 #if defined(OS_LINUX) || defined(OS_ANDROID)
217 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, 217 void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
218 const gfx::Size& canvas_size, 218 const gfx::Size& canvas_size,
219 blink::WebFrame* frame, 219 blink::WebFrame* frame,
220 Metafile* metafile); 220 PdfMetafileSkia* metafile);
221 #elif defined(OS_WIN) 221 #elif defined(OS_WIN)
222 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, 222 void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
223 const gfx::Size& canvas_size, 223 const gfx::Size& canvas_size,
224 blink::WebFrame* frame, 224 blink::WebFrame* frame,
225 Metafile* metafile, 225 PdfMetafileSkia* metafile,
226 gfx::Size* page_size_in_dpi, 226 gfx::Size* page_size_in_dpi,
227 gfx::Rect* content_area_in_dpi); 227 gfx::Rect* content_area_in_dpi);
228 #else 228 #else
229 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, 229 void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
230 const gfx::Size& canvas_size, 230 const gfx::Size& canvas_size,
231 blink::WebFrame* frame); 231 blink::WebFrame* frame);
232 #endif 232 #endif
233 233
234 // Render the frame for printing. 234 // Render the frame for printing.
235 bool RenderPagesForPrint(blink::WebLocalFrame* frame, 235 bool RenderPagesForPrint(blink::WebLocalFrame* frame,
236 const blink::WebNode& node); 236 const blink::WebNode& node);
237 237
238 // Platform specific helper function for rendering page(s) to |metafile|. 238 // Platform specific helper function for rendering page(s) to |metafile|.
239 #if defined(OS_MACOSX) 239 #if defined(OS_MACOSX)
240 void RenderPage(const PrintMsg_Print_Params& params, 240 void RenderPage(const PrintMsg_Print_Params& params,
241 int page_number, 241 int page_number,
242 blink::WebFrame* frame, 242 blink::WebFrame* frame,
243 bool is_preview, 243 bool is_preview,
244 Metafile* metafile, 244 PdfMetafileSkia* metafile,
245 gfx::Size* page_size, 245 gfx::Size* page_size,
246 gfx::Rect* content_rect); 246 gfx::Rect* content_rect);
247 #endif // defined(OS_MACOSX) 247 #endif // defined(OS_MACOSX)
248 248
249 // Renders page contents from |frame| to |content_area| of |canvas|. 249 // Renders page contents from |frame| to |content_area| of |canvas|.
250 // |page_number| is zero-based. 250 // |page_number| is zero-based.
251 // When method is called, canvas should be setup to draw to |canvas_area| 251 // When method is called, canvas should be setup to draw to |canvas_area|
252 // with |scale_factor|. 252 // with |scale_factor|.
253 static float RenderPageContent(blink::WebFrame* frame, 253 static float RenderPageContent(blink::WebFrame* frame,
254 int page_number, 254 int page_number,
255 const gfx::Rect& canvas_area, 255 const gfx::Rect& canvas_area,
256 const gfx::Rect& content_area, 256 const gfx::Rect& content_area,
257 double scale_factor, 257 double scale_factor,
258 blink::WebCanvas* canvas); 258 blink::WebCanvas* canvas);
259 259
260 // Helper methods ----------------------------------------------------------- 260 // Helper methods -----------------------------------------------------------
261 261
262 bool CopyMetafileDataToSharedMem(Metafile* metafile, 262 bool CopyMetafileDataToSharedMem(PdfMetafileSkia* metafile,
263 base::SharedMemoryHandle* shared_mem_handle); 263 base::SharedMemoryHandle* shared_mem_handle);
264 264
265 // Helper method to get page layout in points and fit to page if needed. 265 // Helper method to get page layout in points and fit to page if needed.
266 static void ComputePageLayoutInPointsForCss( 266 static void ComputePageLayoutInPointsForCss(
267 blink::WebFrame* frame, 267 blink::WebFrame* frame,
268 int page_index, 268 int page_index,
269 const PrintMsg_Print_Params& default_params, 269 const PrintMsg_Print_Params& default_params,
270 bool ignore_css_margins, 270 bool ignore_css_margins,
271 double* scale_factor, 271 double* scale_factor,
272 PageSizeMargins* page_layout_in_points); 272 PageSizeMargins* page_layout_in_points);
(...skipping 25 matching lines...) Expand all
298 298
299 // Checks whether print preview should continue or not. 299 // Checks whether print preview should continue or not.
300 // Returns true if canceling, false if continuing. 300 // Returns true if canceling, false if continuing.
301 bool CheckForCancel(); 301 bool CheckForCancel();
302 302
303 // Notifies the browser a print preview page has been rendered. 303 // Notifies the browser a print preview page has been rendered.
304 // |page_number| is 0-based. 304 // |page_number| is 0-based.
305 // For a valid |page_number| with modifiable content, 305 // For a valid |page_number| with modifiable content,
306 // |metafile| is the rendered page. Otherwise |metafile| is NULL. 306 // |metafile| is the rendered page. Otherwise |metafile| is NULL.
307 // Returns true if print preview should continue, false on failure. 307 // Returns true if print preview should continue, false on failure.
308 bool PreviewPageRendered(int page_number, Metafile* metafile); 308 bool PreviewPageRendered(int page_number, PdfMetafileSkia* metafile);
309 309
310 void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings); 310 void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings);
311 311
312 // WebView used only to print the selection. 312 // WebView used only to print the selection.
313 scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_; 313 scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_;
314 bool reset_prep_frame_view_; 314 bool reset_prep_frame_view_;
315 315
316 scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_; 316 scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_;
317 bool is_print_ready_metafile_sent_; 317 bool is_print_ready_metafile_sent_;
318 bool ignore_css_margins_; 318 bool ignore_css_margins_;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 // hangs because RequestPrintPreview is called before DidStopLoading() is 465 // hangs because RequestPrintPreview is called before DidStopLoading() is
466 // called. This is a store for the RequestPrintPreview() call and its 466 // called. This is a store for the RequestPrintPreview() call and its
467 // parameters so that it can be invoked after DidStopLoading. 467 // parameters so that it can be invoked after DidStopLoading.
468 base::Closure on_stop_loading_closure_; 468 base::Closure on_stop_loading_closure_;
469 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); 469 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper);
470 }; 470 };
471 471
472 } // namespace printing 472 } // namespace printing
473 473
474 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_ 474 #endif // CHROME_RENDERER_PRINTING_PRINT_WEB_VIEW_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.cc ('k') | chrome/renderer/printing/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698