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

Side by Side Diff: chrome/renderer/print_web_view_helper_win.cc

Issue 10142002: [Print Preview] Refactored code to support auto fit to page functionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
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 #include "chrome/renderer/print_web_view_helper.h" 5 #include "chrome/renderer/print_web_view_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return PreviewPageRendered(page_number, draft_metafile.get()); 213 return PreviewPageRendered(page_number, draft_metafile.get());
214 } 214 }
215 215
216 Metafile* PrintWebViewHelper::RenderPage( 216 Metafile* PrintWebViewHelper::RenderPage(
217 const PrintMsg_Print_Params& params, int page_number, WebFrame* frame, 217 const PrintMsg_Print_Params& params, int page_number, WebFrame* frame,
218 bool is_preview, Metafile* metafile, double* actual_shrink, 218 bool is_preview, Metafile* metafile, double* actual_shrink,
219 gfx::Size* page_size_in_dpi, gfx::Rect* content_area_in_dpi) { 219 gfx::Size* page_size_in_dpi, gfx::Rect* content_area_in_dpi) {
220 printing::PageSizeMargins page_layout_in_points; 220 printing::PageSizeMargins page_layout_in_points;
221 double css_scale_factor = 1.0f; 221 double css_scale_factor = 1.0f;
222 ComputePageLayoutInPointsForCss(frame, page_number, params, 222 ComputePageLayoutInPointsForCss(frame, page_number, params,
223 ignore_css_margins_, fit_to_page_, 223 ignore_css_margins_, &css_scale_factor,
224 &css_scale_factor, &page_layout_in_points); 224 &page_layout_in_points);
225 gfx::Size page_size; 225 gfx::Size page_size;
226 gfx::Rect content_area; 226 gfx::Rect content_area;
227 GetPageSizeAndContentAreaFromPageLayout(page_layout_in_points, &page_size, 227 GetPageSizeAndContentAreaFromPageLayout(page_layout_in_points, &page_size,
228 &content_area); 228 &content_area);
229 int dpi = static_cast<int>(params.dpi); 229 int dpi = static_cast<int>(params.dpi);
230 // Calculate the actual page size and content area in dpi. 230 // Calculate the actual page size and content area in dpi.
231 if (page_size_in_dpi) { 231 if (page_size_in_dpi) {
232 *page_size_in_dpi = gfx::Size( 232 *page_size_in_dpi = gfx::Size(
233 static_cast<int>(ConvertUnitDouble( 233 static_cast<int>(ConvertUnitDouble(
234 page_size.width(), printing::kPointsPerInch, dpi)), 234 page_size.width(), printing::kPointsPerInch, dpi)),
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 shared_buf.Unmap(); 375 shared_buf.Unmap();
376 return false; 376 return false;
377 } 377 }
378 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle); 378 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle);
379 shared_buf.Unmap(); 379 shared_buf.Unmap();
380 380
381 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle, 381 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle,
382 shared_mem_handle)); 382 shared_mem_handle));
383 return true; 383 return true;
384 } 384 }
OLDNEW
« chrome/renderer/print_web_view_helper.cc ('K') | « chrome/renderer/print_web_view_helper_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698