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

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

Issue 516823002: Removed print_web_view_helper_win.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Thu Aug 28 14:04:52 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 #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 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 prep_frame_view_->GetPrintCanvasSize())) { 1326 prep_frame_view_->GetPrintCanvasSize())) {
1327 LOG(ERROR) << "Printing failed."; 1327 LOG(ERROR) << "Printing failed.";
1328 return DidFinishPrinting(FAIL_PRINT); 1328 return DidFinishPrinting(FAIL_PRINT);
1329 } 1329 }
1330 } 1330 }
1331 1331
1332 void PrintWebViewHelper::FinishFramePrinting() { 1332 void PrintWebViewHelper::FinishFramePrinting() {
1333 prep_frame_view_.reset(); 1333 prep_frame_view_.reset();
1334 } 1334 }
1335 1335
1336 #if defined(OS_MACOSX) || \ 1336 #if defined(OS_MACOSX)
1337 (defined(OS_WIN) && !defined(WIN_PDF_METAFILE_FOR_PRINTING))
1338 bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, 1337 bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
1339 int page_count, 1338 int page_count,
1340 const gfx::Size& canvas_size) { 1339 const gfx::Size& canvas_size) {
1341 const PrintMsg_PrintPages_Params& params = *print_pages_params_; 1340 const PrintMsg_PrintPages_Params& params = *print_pages_params_;
1342 const PrintMsg_Print_Params& print_params = params.params; 1341 const PrintMsg_Print_Params& print_params = params.params;
1343 1342
1344 PrintMsg_PrintPage_Params page_params; 1343 PrintMsg_PrintPage_Params page_params;
1345 page_params.params = print_params; 1344 page_params.params = print_params;
1346 if (params.pages.empty()) { 1345 if (params.pages.empty()) {
1347 for (int i = 0; i < page_count; ++i) { 1346 for (int i = 0; i < page_count; ++i) {
1348 page_params.page_number = i; 1347 page_params.page_number = i;
1349 PrintPageInternal(page_params, canvas_size, frame); 1348 PrintPageInternal(page_params, canvas_size, frame);
1350 } 1349 }
1351 } else { 1350 } else {
1352 for (size_t i = 0; i < params.pages.size(); ++i) { 1351 for (size_t i = 0; i < params.pages.size(); ++i) {
1353 if (params.pages[i] >= page_count) 1352 if (params.pages[i] >= page_count)
1354 break; 1353 break;
1355 page_params.page_number = params.pages[i]; 1354 page_params.page_number = params.pages[i];
1356 PrintPageInternal(page_params, canvas_size, frame); 1355 PrintPageInternal(page_params, canvas_size, frame);
1357 } 1356 }
1358 } 1357 }
1359 return true; 1358 return true;
1360 } 1359 }
1361 1360
1362 #endif // OS_MACOSX || !WIN_PDF_METAFILE_FOR_PRINTING 1361 #endif // OS_MACOSX
1363 1362
1364 // static - Not anonymous so that platform implementations can use it. 1363 // static - Not anonymous so that platform implementations can use it.
1365 void PrintWebViewHelper::ComputePageLayoutInPointsForCss( 1364 void PrintWebViewHelper::ComputePageLayoutInPointsForCss(
1366 blink::WebFrame* frame, 1365 blink::WebFrame* frame,
1367 int page_index, 1366 int page_index,
1368 const PrintMsg_Print_Params& page_params, 1367 const PrintMsg_Print_Params& page_params,
1369 bool ignore_css_margins, 1368 bool ignore_css_margins,
1370 double* scale_factor, 1369 double* scale_factor,
1371 PageSizeMargins* page_layout_in_points) { 1370 PageSizeMargins* page_layout_in_points) {
1372 PrintMsg_Print_Params params = CalculatePrintParamsForCss( 1371 PrintMsg_Print_Params params = CalculatePrintParamsForCss(
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 } 1963 }
1965 1964
1966 void PrintWebViewHelper::SetPrintPagesParams( 1965 void PrintWebViewHelper::SetPrintPagesParams(
1967 const PrintMsg_PrintPages_Params& settings) { 1966 const PrintMsg_PrintPages_Params& settings) {
1968 print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings)); 1967 print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings));
1969 Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(), 1968 Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(),
1970 settings.params.document_cookie)); 1969 settings.params.document_cookie));
1971 } 1970 }
1972 1971
1973 } // namespace printing 1972 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/renderer/printing/print_web_view_helper.h ('k') | chrome/renderer/printing/print_web_view_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698