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

Side by Side Diff: chrome/renderer/print_web_view_helper.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
« 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) 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 <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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 const PrintMsg_PrintPages_Params& oldParams, 122 const PrintMsg_PrintPages_Params& oldParams,
123 const PrintMsg_PrintPages_Params& newParams) { 123 const PrintMsg_PrintPages_Params& newParams) {
124 return PageLayoutIsEqual(oldParams, newParams) && 124 return PageLayoutIsEqual(oldParams, newParams) &&
125 oldParams.params.max_shrink == newParams.params.max_shrink && 125 oldParams.params.max_shrink == newParams.params.max_shrink &&
126 oldParams.params.min_shrink == newParams.params.min_shrink && 126 oldParams.params.min_shrink == newParams.params.min_shrink &&
127 oldParams.params.selection_only == newParams.params.selection_only && 127 oldParams.params.selection_only == newParams.params.selection_only &&
128 oldParams.params.supports_alpha_blend == 128 oldParams.params.supports_alpha_blend ==
129 newParams.params.supports_alpha_blend && 129 newParams.params.supports_alpha_blend &&
130 oldParams.pages.size() == newParams.pages.size() && 130 oldParams.pages.size() == newParams.pages.size() &&
131 oldParams.params.print_to_pdf == newParams.params.print_to_pdf && 131 oldParams.params.print_to_pdf == newParams.params.print_to_pdf &&
132 oldParams.params.fit_to_paper_size ==
133 newParams.params.fit_to_paper_size &&
132 oldParams.params.display_header_footer == 134 oldParams.params.display_header_footer ==
133 newParams.params.display_header_footer && 135 newParams.params.display_header_footer &&
134 oldParams.params.date == newParams.params.date && 136 oldParams.params.date == newParams.params.date &&
135 oldParams.params.title == newParams.params.title && 137 oldParams.params.title == newParams.params.title &&
136 oldParams.params.url == newParams.params.url && 138 oldParams.params.url == newParams.params.url &&
137 std::equal(oldParams.pages.begin(), oldParams.pages.end(), 139 std::equal(oldParams.pages.begin(), oldParams.pages.end(),
138 newParams.pages.begin()); 140 newParams.pages.begin());
139 } 141 }
140 142
141 PrintMsg_Print_Params GetCssPrintParams( 143 PrintMsg_Print_Params GetCssPrintParams(
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 } 658 }
657 } 659 }
658 660
659 PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view) 661 PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view)
660 : content::RenderViewObserver(render_view), 662 : content::RenderViewObserver(render_view),
661 content::RenderViewObserverTracker<PrintWebViewHelper>(render_view), 663 content::RenderViewObserverTracker<PrintWebViewHelper>(render_view),
662 print_web_view_(NULL), 664 print_web_view_(NULL),
663 is_preview_enabled_(IsPrintPreviewEnabled()), 665 is_preview_enabled_(IsPrintPreviewEnabled()),
664 is_print_ready_metafile_sent_(false), 666 is_print_ready_metafile_sent_(false),
665 ignore_css_margins_(false), 667 ignore_css_margins_(false),
666 fit_to_page_(true),
667 user_cancelled_scripted_print_count_(0), 668 user_cancelled_scripted_print_count_(0),
668 is_scripted_printing_blocked_(false), 669 is_scripted_printing_blocked_(false),
669 notify_browser_of_print_failure_(true), 670 notify_browser_of_print_failure_(true),
670 print_for_preview_(false) { 671 print_for_preview_(false) {
671 } 672 }
672 673
673 PrintWebViewHelper::~PrintWebViewHelper() {} 674 PrintWebViewHelper::~PrintWebViewHelper() {}
674 675
675 bool PrintWebViewHelper::IsScriptInitiatedPrintAllowed( 676 bool PrintWebViewHelper::IsScriptInitiatedPrintAllowed(
676 WebKit::WebFrame* frame) { 677 WebKit::WebFrame* frame) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 if (notify_browser_of_print_failure_) 881 if (notify_browser_of_print_failure_)
881 LOG(ERROR) << "CreatePreviewDocument failed"; 882 LOG(ERROR) << "CreatePreviewDocument failed";
882 DidFinishPrinting(FAIL_PREVIEW); 883 DidFinishPrinting(FAIL_PREVIEW);
883 } 884 }
884 } 885 }
885 886
886 bool PrintWebViewHelper::CreatePreviewDocument() { 887 bool PrintWebViewHelper::CreatePreviewDocument() {
887 PrintMsg_Print_Params print_params = print_pages_params_->params; 888 PrintMsg_Print_Params print_params = print_pages_params_->params;
888 const std::vector<int>& pages = print_pages_params_->pages; 889 const std::vector<int>& pages = print_pages_params_->pages;
889 if (!print_preview_context_.CreatePreviewDocument(&print_params, pages, 890 if (!print_preview_context_.CreatePreviewDocument(&print_params, pages,
890 ignore_css_margins_, 891 ignore_css_margins_)) {
891 fit_to_page_)) {
892 return false; 892 return false;
893 } 893 }
894 894
895 PageSizeMargins default_page_layout; 895 PageSizeMargins default_page_layout;
896 ComputePageLayoutInPointsForCss(print_preview_context_.frame(), 0, 896 ComputePageLayoutInPointsForCss(print_preview_context_.frame(), 0,
897 print_params, ignore_css_margins_, 897 print_params, ignore_css_margins_, NULL,
898 fit_to_page_, NULL, &default_page_layout); 898 &default_page_layout);
899 899
900 if (!old_print_pages_params_.get() || 900 if (!old_print_pages_params_.get() ||
901 !PageLayoutIsEqual(*old_print_pages_params_, *print_pages_params_)) { 901 !PageLayoutIsEqual(*old_print_pages_params_, *print_pages_params_)) {
902 bool has_page_size_style = PrintingFrameHasPageSizeStyle( 902 bool has_page_size_style = PrintingFrameHasPageSizeStyle(
903 print_preview_context_.frame(), 903 print_preview_context_.frame(),
904 print_preview_context_.total_page_count()); 904 print_preview_context_.total_page_count());
905 int dpi = GetDPI(&print_params); 905 int dpi = GetDPI(&print_params);
906 gfx::Rect printable_area_in_points( 906 gfx::Rect printable_area_in_points(
907 ConvertUnit(print_pages_params_->params.printable_area.x(), 907 ConvertUnit(print_pages_params_->params.printable_area.x(),
908 dpi, printing::kPointsPerInch), 908 dpi, printing::kPointsPerInch),
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1158
1159 return true; 1159 return true;
1160 } 1160 }
1161 1161
1162 #if defined(OS_MACOSX) || defined(OS_WIN) 1162 #if defined(OS_MACOSX) || defined(OS_WIN)
1163 bool PrintWebViewHelper::PrintPages(WebFrame* frame, const WebNode& node) { 1163 bool PrintWebViewHelper::PrintPages(WebFrame* frame, const WebNode& node) {
1164 const PrintMsg_PrintPages_Params& params = *print_pages_params_; 1164 const PrintMsg_PrintPages_Params& params = *print_pages_params_;
1165 const PrintMsg_Print_Params& print_params = params.params; 1165 const PrintMsg_Print_Params& print_params = params.params;
1166 PrepareFrameAndViewForPrint prep_frame_view(print_params, frame, node); 1166 PrepareFrameAndViewForPrint prep_frame_view(print_params, frame, node);
1167 UpdateFrameAndViewFromCssPageLayout(frame, node, &prep_frame_view, 1167 UpdateFrameAndViewFromCssPageLayout(frame, node, &prep_frame_view,
1168 print_params, ignore_css_margins_, 1168 print_params, ignore_css_margins_);
1169 fit_to_page_);
1170 1169
1171 int page_count = prep_frame_view.GetExpectedPageCount(); 1170 int page_count = prep_frame_view.GetExpectedPageCount();
1172 if (!page_count) 1171 if (!page_count)
1173 return false; 1172 return false;
1174 Send(new PrintHostMsg_DidGetPrintedPagesCount(routing_id(), 1173 Send(new PrintHostMsg_DidGetPrintedPagesCount(routing_id(),
1175 print_params.document_cookie, 1174 print_params.document_cookie,
1176 page_count)); 1175 page_count));
1177 1176
1178 const gfx::Size& canvas_size = prep_frame_view.GetPrintCanvasSize(); 1177 const gfx::Size& canvas_size = prep_frame_view.GetPrintCanvasSize();
1179 PrintMsg_PrintPage_Params page_params; 1178 PrintMsg_PrintPage_Params page_params;
(...skipping 18 matching lines...) Expand all
1198 void PrintWebViewHelper::didStopLoading() { 1197 void PrintWebViewHelper::didStopLoading() {
1199 PrintPages(print_web_view_->mainFrame(), WebNode()); 1198 PrintPages(print_web_view_->mainFrame(), WebNode());
1200 } 1199 }
1201 1200
1202 // static - Not anonymous so that platform implementations can use it. 1201 // static - Not anonymous so that platform implementations can use it.
1203 void PrintWebViewHelper::ComputePageLayoutInPointsForCss( 1202 void PrintWebViewHelper::ComputePageLayoutInPointsForCss(
1204 WebFrame* frame, 1203 WebFrame* frame,
1205 int page_index, 1204 int page_index,
1206 const PrintMsg_Print_Params& page_params, 1205 const PrintMsg_Print_Params& page_params,
1207 bool ignore_css_margins, 1206 bool ignore_css_margins,
1208 bool fit_to_page,
1209 double* scale_factor, 1207 double* scale_factor,
1210 PageSizeMargins* page_layout_in_points) { 1208 PageSizeMargins* page_layout_in_points) {
1211 PrintMsg_Print_Params params = CalculatePrintParamsForCss(frame, page_index, 1209 PrintMsg_Print_Params params = CalculatePrintParamsForCss(
1212 page_params, 1210 frame, page_index, page_params, ignore_css_margins,
1213 ignore_css_margins, 1211 page_params.fit_to_paper_size, scale_factor);
1214 fit_to_page,
1215 scale_factor);
1216 CalculatePageLayoutFromPrintParams(params, page_layout_in_points); 1212 CalculatePageLayoutFromPrintParams(params, page_layout_in_points);
1217 } 1213 }
1218 1214
1219 // static - Not anonymous so that platform implementations can use it. 1215 // static - Not anonymous so that platform implementations can use it.
1220 void PrintWebViewHelper::UpdateFrameAndViewFromCssPageLayout( 1216 void PrintWebViewHelper::UpdateFrameAndViewFromCssPageLayout(
1221 WebFrame* frame, 1217 WebFrame* frame,
1222 const WebNode& node, 1218 const WebNode& node,
1223 PrepareFrameAndViewForPrint* prepare, 1219 PrepareFrameAndViewForPrint* prepare,
1224 const PrintMsg_Print_Params& params, 1220 const PrintMsg_Print_Params& params,
1225 bool ignore_css_margins, 1221 bool ignore_css_margins) {
1226 bool fit_to_page) {
1227 if (PrintingNodeOrPdfFrame(frame, node)) 1222 if (PrintingNodeOrPdfFrame(frame, node))
1228 return; 1223 return;
1229 PrintMsg_Print_Params print_params = CalculatePrintParamsForCss( 1224 PrintMsg_Print_Params print_params = CalculatePrintParamsForCss(
1230 frame, 0, params, ignore_css_margins, ignore_css_margins && fit_to_page, 1225 frame, 0, params, ignore_css_margins,
1231 NULL); 1226 ignore_css_margins && params.fit_to_paper_size, NULL);
1232 prepare->UpdatePrintParams(print_params); 1227 prepare->UpdatePrintParams(print_params);
1233 } 1228 }
1234 1229
1235 bool PrintWebViewHelper::InitPrintSettings() { 1230 bool PrintWebViewHelper::InitPrintSettings(WebKit::WebFrame* frame,
1231 const WebKit::WebNode& node) {
1236 PrintMsg_PrintPages_Params settings; 1232 PrintMsg_PrintPages_Params settings;
1237 Send(new PrintHostMsg_GetDefaultPrintSettings(routing_id(), 1233 Send(new PrintHostMsg_GetDefaultPrintSettings(routing_id(),
1238 &settings.params)); 1234 &settings.params));
1239 // Check if the printer returned any settings, if the settings is empty, we 1235 // Check if the printer returned any settings, if the settings is empty, we
1240 // can safely assume there are no printer drivers configured. So we safely 1236 // can safely assume there are no printer drivers configured. So we safely
1241 // terminate. 1237 // terminate.
1242 bool result = true; 1238 bool result = true;
1243 if (!PrintMsg_Print_Params_IsValid(settings.params)) 1239 if (!PrintMsg_Print_Params_IsValid(settings.params))
1244 result = false; 1240 result = false;
1245 1241
1246 if (result && 1242 if (result &&
1247 (settings.params.dpi < kMinDpi || settings.params.document_cookie == 0)) { 1243 (settings.params.dpi < kMinDpi || settings.params.document_cookie == 0)) {
1248 // Invalid print page settings. 1244 // Invalid print page settings.
1249 NOTREACHED(); 1245 NOTREACHED();
1250 result = false; 1246 result = false;
1251 } 1247 }
1252 1248
1253 // Reset to default values. 1249 // Reset to default values.
1254 ignore_css_margins_ = false; 1250 ignore_css_margins_ = false;
1255 fit_to_page_ = true;
1256 settings.pages.clear(); 1251 settings.pages.clear();
1257 1252
1253 settings.params.fit_to_paper_size = !(PrintingNodeOrPdfFrame(frame, node) &&
vandebo (ex-Chrome) 2012/04/19 23:56:07 Looks like there's only one caller to this method.
kmadhusu 2012/04/20 00:36:37 ok.
1254 frame->isPrintScalingDisabledForPlugin(node));
vandebo (ex-Chrome) 2012/04/19 23:56:07 Is this a change in behavior? For a refactoring c
kmadhusu 2012/04/20 00:36:37 Reverted the changes.
1255
1258 print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings)); 1256 print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings));
1259 return result; 1257 return result;
1260 } 1258 }
1261 1259
1262 bool PrintWebViewHelper::InitPrintSettingsAndPrepareFrame( 1260 bool PrintWebViewHelper::InitPrintSettingsAndPrepareFrame(
1263 WebKit::WebFrame* frame, const WebKit::WebNode& node, 1261 WebKit::WebFrame* frame, const WebKit::WebNode& node,
1264 scoped_ptr<PrepareFrameAndViewForPrint>* prepare) { 1262 scoped_ptr<PrepareFrameAndViewForPrint>* prepare) {
1265 DCHECK(frame); 1263 DCHECK(frame);
1266 if (!InitPrintSettings()) { 1264 if (!InitPrintSettings(frame, node)) {
1267 notify_browser_of_print_failure_ = false; 1265 notify_browser_of_print_failure_ = false;
1268 render_view()->RunModalAlertDialog( 1266 render_view()->RunModalAlertDialog(
1269 frame, 1267 frame,
1270 l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_INVALID_PRINTER_SETTINGS)); 1268 l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_INVALID_PRINTER_SETTINGS));
1271 return false; 1269 return false;
1272 } 1270 }
1273 1271
1274 DCHECK(!prepare->get()); 1272 DCHECK(!prepare->get());
1275 prepare->reset(new PrepareFrameAndViewForPrint(print_pages_params_->params, 1273 prepare->reset(new PrepareFrameAndViewForPrint(print_pages_params_->params,
1276 frame, node)); 1274 frame, node));
1277 UpdateFrameAndViewFromCssPageLayout(frame, node, prepare->get(), 1275 UpdateFrameAndViewFromCssPageLayout(frame, node, prepare->get(),
1278 print_pages_params_->params, 1276 print_pages_params_->params,
1279 ignore_css_margins_, fit_to_page_); 1277 ignore_css_margins_);
1280 Send(new PrintHostMsg_DidGetDocumentCookie( 1278 Send(new PrintHostMsg_DidGetDocumentCookie(
1281 routing_id(), print_pages_params_->params.document_cookie)); 1279 routing_id(), print_pages_params_->params.document_cookie));
1282 return true; 1280 return true;
1283 } 1281 }
1284 1282
1285 bool PrintWebViewHelper::UpdatePrintSettings( 1283 bool PrintWebViewHelper::UpdatePrintSettings(
1286 WebKit::WebFrame* frame, const WebKit::WebNode& node, 1284 WebKit::WebFrame* frame, const WebKit::WebNode& node,
1287 const DictionaryValue& passed_job_settings) { 1285 const DictionaryValue& passed_job_settings) {
1288 DCHECK(is_preview_enabled_); 1286 DCHECK(is_preview_enabled_);
1289 const DictionaryValue* job_settings = &passed_job_settings; 1287 const DictionaryValue* job_settings = &passed_job_settings;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 &(settings.params.preview_request_id)) || 1370 &(settings.params.preview_request_id)) ||
1373 !job_settings->GetBoolean(printing::kIsFirstRequest, 1371 !job_settings->GetBoolean(printing::kIsFirstRequest,
1374 &(settings.params.is_first_request))) { 1372 &(settings.params.is_first_request))) {
1375 NOTREACHED(); 1373 NOTREACHED();
1376 print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); 1374 print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING);
1377 return false; 1375 return false;
1378 } 1376 }
1379 1377
1380 settings.params.print_to_pdf = IsPrintToPdfRequested(*job_settings); 1378 settings.params.print_to_pdf = IsPrintToPdfRequested(*job_settings);
1381 UpdateFrameMarginsCssInfo(*job_settings); 1379 UpdateFrameMarginsCssInfo(*job_settings);
1382 fit_to_page_ = source_is_html && !IsPrintToPdfRequested(*job_settings); 1380
1381 // Fit to paper size.
1382 bool fit_to_paper_size = true;
vandebo (ex-Chrome) 2012/04/19 23:56:07 Looks like you're making changes here as well.
kmadhusu 2012/04/20 00:36:37 Reverted these changes.
1383 if (print_for_preview_ || IsPrintToPdfRequested(*job_settings) ||
1384 (PrintingNodeOrPdfFrame(frame, node) &&
1385 frame->isPrintScalingDisabledForPlugin(node))) {
1386 fit_to_paper_size = false;
1387 }
1388 settings.params.fit_to_paper_size = fit_to_paper_size;
vandebo (ex-Chrome) 2012/04/19 23:56:07 Looks like you can negate the conditional in the i
kmadhusu 2012/04/20 00:36:37 Will do this in the next CL.
1383 1389
1384 // Header/Footer: Set |header_footer_info_|. 1390 // Header/Footer: Set |header_footer_info_|.
1385 if (settings.params.display_header_footer) { 1391 if (settings.params.display_header_footer) {
1386 header_footer_info_.reset(new DictionaryValue()); 1392 header_footer_info_.reset(new DictionaryValue());
1387 header_footer_info_->SetString(printing::kSettingHeaderFooterDate, 1393 header_footer_info_->SetString(printing::kSettingHeaderFooterDate,
1388 settings.params.date); 1394 settings.params.date);
1389 header_footer_info_->SetString(printing::kSettingHeaderFooterURL, 1395 header_footer_info_->SetString(printing::kSettingHeaderFooterURL,
1390 settings.params.url); 1396 settings.params.url);
1391 header_footer_info_->SetString(printing::kSettingHeaderFooterTitle, 1397 header_footer_info_->SetString(printing::kSettingHeaderFooterTitle,
1392 settings.params.title); 1398 settings.params.title);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 } 1632 }
1627 1633
1628 void PrintWebViewHelper::PrintPreviewContext::OnPrintPreview() { 1634 void PrintWebViewHelper::PrintPreviewContext::OnPrintPreview() {
1629 DCHECK_EQ(INITIALIZED, state_); 1635 DCHECK_EQ(INITIALIZED, state_);
1630 ClearContext(); 1636 ClearContext();
1631 } 1637 }
1632 1638
1633 bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument( 1639 bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument(
1634 PrintMsg_Print_Params* print_params, 1640 PrintMsg_Print_Params* print_params,
1635 const std::vector<int>& pages, 1641 const std::vector<int>& pages,
1636 bool ignore_css_margins, 1642 bool ignore_css_margins) {
1637 bool fit_to_page) {
1638 DCHECK_EQ(INITIALIZED, state_); 1643 DCHECK_EQ(INITIALIZED, state_);
1639 state_ = RENDERING; 1644 state_ = RENDERING;
1640 1645
1641 metafile_.reset(new printing::PreviewMetafile); 1646 metafile_.reset(new printing::PreviewMetafile);
1642 if (!metafile_->Init()) { 1647 if (!metafile_->Init()) {
1643 set_error(PREVIEW_ERROR_METAFILE_INIT_FAILED); 1648 set_error(PREVIEW_ERROR_METAFILE_INIT_FAILED);
1644 LOG(ERROR) << "PreviewMetafile Init failed"; 1649 LOG(ERROR) << "PreviewMetafile Init failed";
1645 return false; 1650 return false;
1646 } 1651 }
1647 1652
1648 // Need to make sure old object gets destroyed first. 1653 // Need to make sure old object gets destroyed first.
1649 prep_frame_view_.reset(new PrepareFrameAndViewForPrint(*print_params, frame(), 1654 prep_frame_view_.reset(new PrepareFrameAndViewForPrint(*print_params, frame(),
1650 node())); 1655 node()));
1651 UpdateFrameAndViewFromCssPageLayout(frame_, node_, prep_frame_view_.get(), 1656 UpdateFrameAndViewFromCssPageLayout(frame_, node_, prep_frame_view_.get(),
1652 *print_params, ignore_css_margins, 1657 *print_params, ignore_css_margins);
1653 fit_to_page);
1654 1658
1655 print_params_.reset(new PrintMsg_Print_Params(*print_params)); 1659 print_params_.reset(new PrintMsg_Print_Params(*print_params));
1656 1660
1657 total_page_count_ = prep_frame_view_->GetExpectedPageCount(); 1661 total_page_count_ = prep_frame_view_->GetExpectedPageCount();
1658 if (total_page_count_ == 0) { 1662 if (total_page_count_ == 0) {
1659 LOG(ERROR) << "CreatePreviewDocument got 0 page count"; 1663 LOG(ERROR) << "CreatePreviewDocument got 0 page count";
1660 set_error(PREVIEW_ERROR_ZERO_PAGES); 1664 set_error(PREVIEW_ERROR_ZERO_PAGES);
1661 return false; 1665 return false;
1662 } 1666 }
1663 1667
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 DCHECK(IsRendering()); 1822 DCHECK(IsRendering());
1819 return prep_frame_view_->GetPrintCanvasSize(); 1823 return prep_frame_view_->GetPrintCanvasSize();
1820 } 1824 }
1821 1825
1822 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 1826 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
1823 prep_frame_view_.reset(); 1827 prep_frame_view_.reset();
1824 metafile_.reset(); 1828 metafile_.reset();
1825 pages_to_render_.clear(); 1829 pages_to_render_.clear();
1826 error_ = PREVIEW_ERROR_NONE; 1830 error_ = PREVIEW_ERROR_NONE;
1827 } 1831 }
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