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

Side by Side Diff: android_webview/renderer/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
« no previous file with comments | « no previous file | android_webview/renderer/print_web_view_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 5 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276
6 6
7 #ifndef AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ 7 #ifndef AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_
8 #define AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ 8 #define AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_
9 9
10 #include <vector> 10 #include <vector>
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 bool PrintPagesNative(blink::WebFrame* frame, 219 bool PrintPagesNative(blink::WebFrame* frame,
220 int page_count, 220 int page_count,
221 const gfx::Size& canvas_size); 221 const gfx::Size& canvas_size);
222 void FinishFramePrinting(); 222 void FinishFramePrinting();
223 223
224 // Prints the page listed in |params|. 224 // Prints the page listed in |params|.
225 #if defined(OS_LINUX) || defined(OS_ANDROID) 225 #if defined(OS_LINUX) || defined(OS_ANDROID)
226 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, 226 void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
227 const gfx::Size& canvas_size, 227 const gfx::Size& canvas_size,
228 blink::WebFrame* frame, 228 blink::WebFrame* frame,
229 Metafile* metafile); 229 PdfMetafileSkia* metafile);
230 #else 230 #else
231 void PrintPageInternal(const PrintMsg_PrintPage_Params& params, 231 void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
232 const gfx::Size& canvas_size, 232 const gfx::Size& canvas_size,
233 blink::WebFrame* frame); 233 blink::WebFrame* frame);
234 #endif 234 #endif
235 235
236 // Render the frame for printing. 236 // Render the frame for printing.
237 bool RenderPagesForPrint(blink::WebLocalFrame* frame, 237 bool RenderPagesForPrint(blink::WebLocalFrame* frame,
238 const blink::WebNode& node); 238 const blink::WebNode& node);
239 239
240 // Platform specific helper function for rendering page(s) to |metafile|. 240 // Platform specific helper function for rendering page(s) to |metafile|.
241 #if defined(OS_WIN) 241 #if defined(OS_WIN)
242 void RenderPage(const PrintMsg_Print_Params& params, 242 void RenderPage(const PrintMsg_Print_Params& params,
243 int page_number, 243 int page_number,
244 blink::WebFrame* frame, 244 blink::WebFrame* frame,
245 bool is_preview, 245 bool is_preview,
246 Metafile* metafile, 246 PdfMetafileSkia* metafile,
247 double* scale_factor, 247 double* scale_factor,
248 gfx::Size* page_size_in_dpi, 248 gfx::Size* page_size_in_dpi,
249 gfx::Rect* content_area_in_dpi); 249 gfx::Rect* content_area_in_dpi);
250 #elif defined(OS_MACOSX) 250 #elif defined(OS_MACOSX)
251 void RenderPage(const PrintMsg_Print_Params& params, 251 void RenderPage(const PrintMsg_Print_Params& params,
252 int page_number, 252 int page_number,
253 blink::WebFrame* frame, 253 blink::WebFrame* frame,
254 bool is_preview, 254 bool is_preview,
255 Metafile* metafile, 255 PdfMetafileSkia* metafile,
256 gfx::Size* page_size, 256 gfx::Size* page_size,
257 gfx::Rect* content_rect); 257 gfx::Rect* content_rect);
258 #endif // defined(OS_WIN) 258 #endif // defined(OS_WIN)
259 259
260 // Renders page contents from |frame| to |content_area| of |canvas|. 260 // Renders page contents from |frame| to |content_area| of |canvas|.
261 // |page_number| is zero-based. 261 // |page_number| is zero-based.
262 // When method is called, canvas should be setup to draw to |canvas_area| 262 // When method is called, canvas should be setup to draw to |canvas_area|
263 // with |scale_factor|. 263 // with |scale_factor|.
264 static float RenderPageContent(blink::WebFrame* frame, 264 static float RenderPageContent(blink::WebFrame* frame,
265 int page_number, 265 int page_number,
266 const gfx::Rect& canvas_area, 266 const gfx::Rect& canvas_area,
267 const gfx::Rect& content_area, 267 const gfx::Rect& content_area,
268 double scale_factor, 268 double scale_factor,
269 blink::WebCanvas* canvas); 269 blink::WebCanvas* canvas);
270 270
271 // Helper methods ----------------------------------------------------------- 271 // Helper methods -----------------------------------------------------------
272 272
273 bool CopyMetafileDataToSharedMem(Metafile* metafile, 273 bool CopyMetafileDataToSharedMem(PdfMetafileSkia* metafile,
274 base::SharedMemoryHandle* shared_mem_handle); 274 base::SharedMemoryHandle* shared_mem_handle);
275 275
276 // Helper method to get page layout in points and fit to page if needed. 276 // Helper method to get page layout in points and fit to page if needed.
277 static void ComputePageLayoutInPointsForCss( 277 static void ComputePageLayoutInPointsForCss(
278 blink::WebFrame* frame, 278 blink::WebFrame* frame,
279 int page_index, 279 int page_index,
280 const PrintMsg_Print_Params& default_params, 280 const PrintMsg_Print_Params& default_params,
281 bool ignore_css_margins, 281 bool ignore_css_margins,
282 double* scale_factor, 282 double* scale_factor,
283 PageSizeMargins* page_layout_in_points); 283 PageSizeMargins* page_layout_in_points);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 // Checks whether print preview should continue or not. 322 // Checks whether print preview should continue or not.
323 // Returns true if cancelling, false if continuing. 323 // Returns true if cancelling, false if continuing.
324 bool CheckForCancel(); 324 bool CheckForCancel();
325 325
326 // Notifies the browser a print preview page has been rendered. 326 // Notifies the browser a print preview page has been rendered.
327 // |page_number| is 0-based. 327 // |page_number| is 0-based.
328 // For a valid |page_number| with modifiable content, 328 // For a valid |page_number| with modifiable content,
329 // |metafile| is the rendered page. Otherwise |metafile| is NULL. 329 // |metafile| is the rendered page. Otherwise |metafile| is NULL.
330 // Returns true if print preview should continue, false on failure. 330 // Returns true if print preview should continue, false on failure.
331 bool PreviewPageRendered(int page_number, Metafile* metafile); 331 bool PreviewPageRendered(int page_number, PdfMetafileSkia* metafile);
332 332
333 // WebView used only to print the selection. 333 // WebView used only to print the selection.
334 scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_; 334 scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_;
335 bool reset_prep_frame_view_; 335 bool reset_prep_frame_view_;
336 336
337 scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_; 337 scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_;
338 bool is_preview_enabled_; 338 bool is_preview_enabled_;
339 bool is_scripted_print_throttling_disabled_; 339 bool is_scripted_print_throttling_disabled_;
340 bool is_print_ready_metafile_sent_; 340 bool is_print_ready_metafile_sent_;
341 bool ignore_css_margins_; 341 bool ignore_css_margins_;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 PrintPreviewContext print_preview_context_; 469 PrintPreviewContext print_preview_context_;
470 bool is_loading_; 470 bool is_loading_;
471 bool is_scripted_preview_delayed_; 471 bool is_scripted_preview_delayed_;
472 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; 472 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_;
473 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); 473 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper);
474 }; 474 };
475 475
476 } // namespace printing 476 } // namespace printing
477 477
478 #endif // AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_ 478 #endif // AW_RENDERER_PRINT_WEB_VIEW_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | android_webview/renderer/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698