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

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

Issue 255543006: Printing on Windows via PDF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove ref to internal_pdf and rebase Created 6 years, 7 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/printing/print_web_view_helper.h" 5 #include "chrome/renderer/printing/print_web_view_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 prep_frame_view_->GetPrintCanvasSize())) { 1361 prep_frame_view_->GetPrintCanvasSize())) {
1362 LOG(ERROR) << "Printing failed."; 1362 LOG(ERROR) << "Printing failed.";
1363 return DidFinishPrinting(FAIL_PRINT); 1363 return DidFinishPrinting(FAIL_PRINT);
1364 } 1364 }
1365 } 1365 }
1366 1366
1367 void PrintWebViewHelper::FinishFramePrinting() { 1367 void PrintWebViewHelper::FinishFramePrinting() {
1368 prep_frame_view_.reset(); 1368 prep_frame_view_.reset();
1369 } 1369 }
1370 1370
1371 #if defined(OS_MACOSX) || defined(OS_WIN) 1371 #if defined(OS_MACOSX) || \
1372 (defined(OS_WIN) && !defined(WIN_PDF_METAFILE_FOR_PRINTING))
1372 bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, 1373 bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
1373 int page_count, 1374 int page_count,
1374 const gfx::Size& canvas_size) { 1375 const gfx::Size& canvas_size) {
1375 const PrintMsg_PrintPages_Params& params = *print_pages_params_; 1376 const PrintMsg_PrintPages_Params& params = *print_pages_params_;
1376 const PrintMsg_Print_Params& print_params = params.params; 1377 const PrintMsg_Print_Params& print_params = params.params;
1377 1378
1378 PrintMsg_PrintPage_Params page_params; 1379 PrintMsg_PrintPage_Params page_params;
1379 page_params.params = print_params; 1380 page_params.params = print_params;
1380 if (params.pages.empty()) { 1381 if (params.pages.empty()) {
1381 for (int i = 0; i < page_count; ++i) { 1382 for (int i = 0; i < page_count; ++i) {
1382 page_params.page_number = i; 1383 page_params.page_number = i;
1383 PrintPageInternal(page_params, canvas_size, frame); 1384 PrintPageInternal(page_params, canvas_size, frame);
1384 } 1385 }
1385 } else { 1386 } else {
1386 for (size_t i = 0; i < params.pages.size(); ++i) { 1387 for (size_t i = 0; i < params.pages.size(); ++i) {
1387 if (params.pages[i] >= page_count) 1388 if (params.pages[i] >= page_count)
1388 break; 1389 break;
1389 page_params.page_number = params.pages[i]; 1390 page_params.page_number = params.pages[i];
1390 PrintPageInternal(page_params, canvas_size, frame); 1391 PrintPageInternal(page_params, canvas_size, frame);
1391 } 1392 }
1392 } 1393 }
1393 return true; 1394 return true;
1394 } 1395 }
1395 1396
1396 #endif // OS_MACOSX || OS_WIN 1397 #endif // OS_MACOSX || !WIN_PDF_METAFILE_FOR_PRINTING
1397 1398
1398 // static - Not anonymous so that platform implementations can use it. 1399 // static - Not anonymous so that platform implementations can use it.
1399 void PrintWebViewHelper::ComputePageLayoutInPointsForCss( 1400 void PrintWebViewHelper::ComputePageLayoutInPointsForCss(
1400 blink::WebFrame* frame, 1401 blink::WebFrame* frame,
1401 int page_index, 1402 int page_index,
1402 const PrintMsg_Print_Params& page_params, 1403 const PrintMsg_Print_Params& page_params,
1403 bool ignore_css_margins, 1404 bool ignore_css_margins,
1404 double* scale_factor, 1405 double* scale_factor,
1405 PageSizeMargins* page_layout_in_points) { 1406 PageSizeMargins* page_layout_in_points) {
1406 PrintMsg_Print_Params params = CalculatePrintParamsForCss( 1407 PrintMsg_Print_Params params = CalculatePrintParamsForCss(
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 } 2025 }
2025 2026
2026 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 2027 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
2027 prep_frame_view_.reset(); 2028 prep_frame_view_.reset();
2028 metafile_.reset(); 2029 metafile_.reset();
2029 pages_to_render_.clear(); 2030 pages_to_render_.clear();
2030 error_ = PREVIEW_ERROR_NONE; 2031 error_ = PREVIEW_ERROR_NONE;
2031 } 2032 }
2032 2033
2033 } // namespace printing 2034 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/renderer/printing/print_web_view_helper.h ('k') | chrome/renderer/printing/print_web_view_helper_pdf_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698