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

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

Issue 15716006: Fixed reporting of PrintPreview.PageCount.PrintToCloudPrintWebDialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 if (!prep_frame_view_) // Printing is already canceled or failed. 1300 if (!prep_frame_view_) // Printing is already canceled or failed.
1301 return; 1301 return;
1302 prep_frame_view_->StartPrinting(); 1302 prep_frame_view_->StartPrinting();
1303 1303
1304 int page_count = prep_frame_view_->GetExpectedPageCount(); 1304 int page_count = prep_frame_view_->GetExpectedPageCount();
1305 if (!page_count) { 1305 if (!page_count) {
1306 LOG(ERROR) << "Can't print 0 pages."; 1306 LOG(ERROR) << "Can't print 0 pages.";
1307 return DidFinishPrinting(FAIL_PRINT); 1307 return DidFinishPrinting(FAIL_PRINT);
1308 } 1308 }
1309 1309
1310 #if !defined(OS_CHROMEOS)
1311 const PrintMsg_PrintPages_Params& params = *print_pages_params_; 1310 const PrintMsg_PrintPages_Params& params = *print_pages_params_;
1312 const PrintMsg_Print_Params& print_params = params.params; 1311 const PrintMsg_Print_Params& print_params = params.params;
1313 1312
1313 #if !defined(OS_CHROMEOS)
1314 // TODO(vitalybuka): should be page_count or valid pages from params.pages. 1314 // TODO(vitalybuka): should be page_count or valid pages from params.pages.
1315 // See http://crbug.com/161576 1315 // See http://crbug.com/161576
1316 Send(new PrintHostMsg_DidGetPrintedPagesCount(routing_id(), 1316 Send(new PrintHostMsg_DidGetPrintedPagesCount(routing_id(),
1317 print_params.document_cookie, 1317 print_params.document_cookie,
1318 page_count)); 1318 page_count));
1319 #endif // !defined(OS_CHROMEOS)
1320
1319 if (print_params.preview_ui_id < 0) { 1321 if (print_params.preview_ui_id < 0) {
1320 // Printing for system dialog. 1322 // Printing for system dialog.
1321 int printed_count = params.pages.empty() ? page_count : params.pages.size(); 1323 int printed_count = params.pages.empty() ? page_count : params.pages.size();
1324 #if !defined(OS_CHROMEOS)
1322 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.SystemDialog", printed_count); 1325 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.SystemDialog", printed_count);
1326 #else
1327 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToCloudPrintWebDialog",
1328 printed_count);
1329 #endif // !defined(OS_CHROMEOS)
1323 } 1330 }
1324 #endif // !defined(OS_CHROMEOS) 1331
1325 1332
1326 if (!PrintPagesNative(prep_frame_view_->frame(), prep_frame_view_->node(), 1333 if (!PrintPagesNative(prep_frame_view_->frame(), prep_frame_view_->node(),
1327 page_count, prep_frame_view_->GetPrintCanvasSize())) { 1334 page_count, prep_frame_view_->GetPrintCanvasSize())) {
1328 LOG(ERROR) << "Printing failed."; 1335 LOG(ERROR) << "Printing failed.";
1329 return DidFinishPrinting(FAIL_PRINT); 1336 return DidFinishPrinting(FAIL_PRINT);
1330 } 1337 }
1331 } 1338 }
1332 1339
1333 void PrintWebViewHelper::FinishFramePrinting() { 1340 void PrintWebViewHelper::FinishFramePrinting() {
1334 prep_frame_view_.reset(); 1341 prep_frame_view_.reset();
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 } 1984 }
1978 1985
1979 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 1986 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
1980 prep_frame_view_.reset(); 1987 prep_frame_view_.reset();
1981 metafile_.reset(); 1988 metafile_.reset();
1982 pages_to_render_.clear(); 1989 pages_to_render_.clear();
1983 error_ = PREVIEW_ERROR_NONE; 1990 error_ = PREVIEW_ERROR_NONE;
1984 } 1991 }
1985 1992
1986 } // namespace printing 1993 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698