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

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

Issue 7549001: PrintPreview: Remove |page_number| from StartPageForVectorCanvas function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nit Created 9 years, 4 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
« no previous file with comments | « chrome/renderer/print_web_view_helper.h ('k') | chrome/renderer/print_web_view_helper_linux.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 Send(new PrintHostMsg_DidGetPrintedPagesCount(routing_id(), 575 Send(new PrintHostMsg_DidGetPrintedPagesCount(routing_id(),
576 print_params.document_cookie, 576 print_params.document_cookie,
577 page_count)); 577 page_count));
578 578
579 const gfx::Size& canvas_size = prepare->GetPrintCanvasSize(); 579 const gfx::Size& canvas_size = prepare->GetPrintCanvasSize();
580 PrintMsg_PrintPage_Params page_params; 580 PrintMsg_PrintPage_Params page_params;
581 page_params.params = print_params; 581 page_params.params = print_params;
582 if (params.pages.empty()) { 582 if (params.pages.empty()) {
583 for (int i = 0; i < page_count; ++i) { 583 for (int i = 0; i < page_count; ++i) {
584 page_params.page_number = i; 584 page_params.page_number = i;
585 page_params.page_slot = i;
586 PrintPageInternal(page_params, canvas_size, frame); 585 PrintPageInternal(page_params, canvas_size, frame);
587 } 586 }
588 } else { 587 } else {
589 for (size_t i = 0; i < params.pages.size(); ++i) { 588 for (size_t i = 0; i < params.pages.size(); ++i) {
590 if (params.pages[i] >= page_count) 589 if (params.pages[i] >= page_count)
591 break; 590 break;
592 page_params.page_number = params.pages[i]; 591 page_params.page_number = params.pages[i];
593 page_params.page_slot = i;
594 PrintPageInternal(page_params, canvas_size, frame); 592 PrintPageInternal(page_params, canvas_size, frame);
595 } 593 }
596 } 594 }
597 return true; 595 return true;
598 } 596 }
599 #endif // OS_MACOSX || OS_WIN 597 #endif // OS_MACOSX || OS_WIN
600 598
601 void PrintWebViewHelper::didStopLoading() { 599 void PrintWebViewHelper::didStopLoading() {
602 PrintMsg_PrintPages_Params* params = print_pages_params_.get(); 600 PrintMsg_PrintPages_Params* params = print_pages_params_.get();
603 DCHECK(params != NULL); 601 DCHECK(params != NULL);
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 bool PrintWebViewHelper::PrintPreviewContext::IsModifiable() const { 1085 bool PrintWebViewHelper::PrintPreviewContext::IsModifiable() const {
1088 // TODO(vandebo) I think this should only return false if the content is a 1086 // TODO(vandebo) I think this should only return false if the content is a
1089 // PDF, just because we are printing a particular node does not mean it's 1087 // PDF, just because we are printing a particular node does not mean it's
1090 // a PDF (right?), we should check the mime type of the node. 1088 // a PDF (right?), we should check the mime type of the node.
1091 if (node()) 1089 if (node())
1092 return false; 1090 return false;
1093 std::string mime(frame()->dataSource()->response().mimeType().utf8()); 1091 std::string mime(frame()->dataSource()->response().mimeType().utf8());
1094 return mime != "application/pdf"; 1092 return mime != "application/pdf";
1095 } 1093 }
1096 1094
1097 int PrintWebViewHelper::PrintPreviewContext::GetPageSlotForPage(
1098 int page_number) const {
1099 int page_slot = rendered_pages_[page_number].second;
1100 return page_slot == -1 ? page_number : page_slot;
1101 }
1102
1103 WebKit::WebFrame* PrintWebViewHelper::PrintPreviewContext::frame() const { 1095 WebKit::WebFrame* PrintWebViewHelper::PrintPreviewContext::frame() const {
1104 return frame_; 1096 return frame_;
1105 } 1097 }
1106 1098
1107 WebKit::WebNode* PrintWebViewHelper::PrintPreviewContext::node() const { 1099 WebKit::WebNode* PrintWebViewHelper::PrintPreviewContext::node() const {
1108 return node_.get(); 1100 return node_.get();
1109 } 1101 }
1110 1102
1111 int PrintWebViewHelper::PrintPreviewContext::total_page_count() const { 1103 int PrintWebViewHelper::PrintPreviewContext::total_page_count() const {
1112 return total_page_count_; 1104 return total_page_count_;
(...skipping 11 matching lines...) Expand all
1124 const gfx::Size& 1116 const gfx::Size&
1125 PrintWebViewHelper::PrintPreviewContext::GetPrintCanvasSize() const { 1117 PrintWebViewHelper::PrintPreviewContext::GetPrintCanvasSize() const {
1126 return prep_frame_view_->GetPrintCanvasSize(); 1118 return prep_frame_view_->GetPrintCanvasSize();
1127 } 1119 }
1128 1120
1129 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 1121 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
1130 prep_frame_view_.reset(); 1122 prep_frame_view_.reset();
1131 metafile_.reset(); 1123 metafile_.reset();
1132 rendered_pages_.clear(); 1124 rendered_pages_.clear();
1133 } 1125 }
OLDNEW
« no previous file with comments | « chrome/renderer/print_web_view_helper.h ('k') | chrome/renderer/print_web_view_helper_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698