Chromium Code Reviews| Index: chrome/renderer/print_web_view_helper.cc |
| diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc |
| index 5ba2c8036817a3b36d5b52af139a5ea3347e393d..0f918f6432a7a413191df7995e4777db65214916 100644 |
| --- a/chrome/renderer/print_web_view_helper.cc |
| +++ b/chrome/renderer/print_web_view_helper.cc |
| @@ -60,25 +60,12 @@ |
| #include "ui/gfx/render_text.h" |
| #endif |
| -using printing::ConvertPixelsToPoint; |
| -using printing::ConvertPixelsToPointDouble; |
| -using printing::ConvertPointsToPixelDouble; |
| using printing::ConvertUnit; |
| -using printing::ConvertUnitDouble; |
| -using printing::GetHeaderFooterSegmentWidth; |
| using printing::PageSizeMargins; |
| -using WebKit::WebConsoleMessage; |
| -using WebKit::WebDocument; |
| -using WebKit::WebElement; |
| +using printing::kPixelsPerInch; |
| +using printing::kPointsPerInch; |
| using WebKit::WebFrame; |
| using WebKit::WebNode; |
| -using WebKit::WebPlugin; |
| -using WebKit::WebPluginDocument; |
| -using WebKit::WebPrintParams; |
| -using WebKit::WebSize; |
| -using WebKit::WebString; |
| -using WebKit::WebURLRequest; |
| -using WebKit::WebView; |
| namespace { |
| @@ -94,7 +81,7 @@ int GetDPI(const PrintMsg_Print_Params* print_params) { |
| #if defined(OS_MACOSX) |
| // On the Mac, the printable area is in points, don't do any scaling based |
| // on dpi. |
| - return printing::kPointsPerInch; |
| + return kPointsPerInch; |
| #else |
| return static_cast<int>(print_params->dpi); |
| #endif // defined(OS_MACOSX) |
| @@ -146,27 +133,24 @@ PrintMsg_Print_Params GetCssPrintParams( |
| const PrintMsg_Print_Params& page_params) { |
| PrintMsg_Print_Params page_css_params = page_params; |
| int dpi = GetDPI(&page_params); |
| - WebSize page_size_in_pixels( |
| - ConvertUnit(page_params.page_size.width(), |
| - dpi, printing::kPixelsPerInch), |
| - ConvertUnit(page_params.page_size.height(), |
| - dpi, printing::kPixelsPerInch)); |
| - int margin_top_in_pixels = ConvertUnit( |
| - page_params.margin_top, |
| - dpi, printing::kPixelsPerInch); |
| + WebKit::WebSize page_size_in_pixels( |
| + ConvertUnit(page_params.page_size.width(), dpi, kPixelsPerInch), |
| + ConvertUnit(page_params.page_size.height(), dpi, kPixelsPerInch)); |
| + int margin_top_in_pixels = |
| + ConvertUnit(page_params.margin_top, dpi, kPixelsPerInch); |
| int margin_right_in_pixels = ConvertUnit( |
| page_params.page_size.width() - |
| page_params.content_size.width() - page_params.margin_left, |
| - dpi, printing::kPixelsPerInch); |
| + dpi, kPixelsPerInch); |
| int margin_bottom_in_pixels = ConvertUnit( |
| page_params.page_size.height() - |
| page_params.content_size.height() - page_params.margin_top, |
| - dpi, printing::kPixelsPerInch); |
| + dpi, kPixelsPerInch); |
| int margin_left_in_pixels = ConvertUnit( |
| page_params.margin_left, |
| - dpi, printing::kPixelsPerInch); |
| + dpi, kPixelsPerInch); |
| - WebSize original_page_size_in_pixels = page_size_in_pixels; |
| + WebKit::WebSize original_page_size_in_pixels = page_size_in_pixels; |
| if (frame) { |
| frame->pageSizeAndMarginsInPixels(page_index, |
| @@ -190,17 +174,13 @@ PrintMsg_Print_Params GetCssPrintParams( |
| } |
| page_css_params.content_size = gfx::Size( |
| - static_cast<int>(ConvertUnit(new_content_width, |
| - printing::kPixelsPerInch, dpi)), |
| - static_cast<int>(ConvertUnit(new_content_height, |
| - printing::kPixelsPerInch, dpi))); |
| + ConvertUnit(new_content_width, kPixelsPerInch, dpi), |
| + ConvertUnit(new_content_height, kPixelsPerInch, dpi)); |
| if (original_page_size_in_pixels != page_size_in_pixels) { |
| page_css_params.page_size = gfx::Size( |
| - static_cast<int>(ConvertUnit(page_size_in_pixels.width, |
| - printing::kPixelsPerInch, dpi)), |
| - static_cast<int>(ConvertUnit(page_size_in_pixels.height, |
| - printing::kPixelsPerInch, dpi))); |
| + ConvertUnit(page_size_in_pixels.width, kPixelsPerInch, dpi), |
| + ConvertUnit(page_size_in_pixels.height, kPixelsPerInch, dpi)); |
| } else { |
| // Printing frame doesn't have any page size css. Pixels to dpi conversion |
| // causes rounding off errors. Therefore use the default page size values |
| @@ -209,12 +189,9 @@ PrintMsg_Print_Params GetCssPrintParams( |
| } |
| page_css_params.margin_top = |
| - static_cast<int>(ConvertUnit(margin_top_in_pixels, |
| - printing::kPixelsPerInch, dpi)); |
| - |
| + ConvertUnit(margin_top_in_pixels, kPixelsPerInch, dpi); |
| page_css_params.margin_left = |
| - static_cast<int>(ConvertUnit(margin_left_in_pixels, |
| - printing::kPixelsPerInch, dpi)); |
| + ConvertUnit(margin_left_in_pixels, kPixelsPerInch, dpi); |
| return page_css_params; |
| } |
| @@ -267,18 +244,18 @@ void CalculatePageLayoutFromPrintParams( |
| int margin_right = params.page_size.width() - |
| content_width - params.margin_left; |
| - page_layout_in_points->content_width = ConvertUnit( |
| - content_width, dpi, printing::kPointsPerInch); |
| - page_layout_in_points->content_height = ConvertUnit( |
| - content_height, dpi, printing::kPointsPerInch); |
| - page_layout_in_points->margin_top = ConvertUnit( |
| - params.margin_top, dpi, printing::kPointsPerInch); |
| - page_layout_in_points->margin_right = ConvertUnit( |
| - margin_right, dpi, printing::kPointsPerInch); |
| - page_layout_in_points->margin_bottom = ConvertUnit( |
| - margin_bottom, dpi, printing::kPointsPerInch); |
| - page_layout_in_points->margin_left = ConvertUnit( |
| - params.margin_left, dpi, printing::kPointsPerInch); |
| + page_layout_in_points->content_width = |
| + ConvertUnit(content_width, dpi, kPointsPerInch); |
| + page_layout_in_points->content_height = |
| + ConvertUnit(content_height, dpi, kPointsPerInch); |
| + page_layout_in_points->margin_top = |
| + ConvertUnit(params.margin_top, dpi, kPointsPerInch); |
| + page_layout_in_points->margin_right = |
| + ConvertUnit(margin_right, dpi, kPointsPerInch); |
| + page_layout_in_points->margin_bottom = |
| + ConvertUnit(margin_bottom, dpi, kPointsPerInch); |
| + page_layout_in_points->margin_left = |
| + ConvertUnit(params.margin_left, dpi, kPointsPerInch); |
| } |
| void EnsureOrientationMatches(const PrintMsg_Print_Params& css_params, |
| @@ -300,7 +277,7 @@ void EnsureOrientationMatches(const PrintMsg_Print_Params& css_params, |
| void ComputeWebKitPrintParamsInDesiredDpi( |
| const PrintMsg_Print_Params& print_params, |
| - WebPrintParams* webkit_print_params) { |
| + WebKit::WebPrintParams* webkit_print_params) { |
| int dpi = GetDPI(&print_params); |
| webkit_print_params->printerDPI = dpi; |
| webkit_print_params->printScalingOption = print_params.print_scaling_option; |
| @@ -338,7 +315,8 @@ bool PrintingNodeOrPdfFrame(const WebFrame* frame, const WebNode& node) { |
| return true; |
| if (!frame->document().isPluginDocument()) |
| return false; |
| - WebPlugin* plugin = frame->document().to<WebPluginDocument>().plugin(); |
| + WebKit::WebPlugin* plugin = |
| + frame->document().to<WebKit::WebPluginDocument>().plugin(); |
| return plugin && plugin->supportsPaginatedPrint(); |
| } |
| @@ -393,7 +371,7 @@ SkPoint GetHeaderFooterPosition( |
| break; |
| } |
| case printing::CENTER: { |
| - SkScalar available_width = GetHeaderFooterSegmentWidth( |
| + SkScalar available_width = printing::GetHeaderFooterSegmentWidth( |
| page_layout.margin_left + page_layout.margin_right + |
| page_layout.content_width); |
| x = available_width - page_layout.margin_left + |
| @@ -541,7 +519,8 @@ void PrintWebViewHelper::PrintHeaderAndFooter( |
| int total_pages, |
| float webkit_scale_factor, |
| const PageSizeMargins& page_layout, |
| - const DictionaryValue& header_footer_info) { |
| + const DictionaryValue& header_footer_info, |
| + const PrintMsg_Print_Params& params) { |
| skia::VectorPlatformDeviceSkia* device = |
| static_cast<skia::VectorPlatformDeviceSkia*>(canvas->getTopDevice()); |
| device->setDrawingArea(SkPDFDevice::kMargin_DrawingArea); |
| @@ -608,8 +587,7 @@ void PrintWebViewHelper::PrintHeaderAndFooter( |
| UTF8ToUTF16("/") + |
| base::IntToString16(total_pages); |
| string16 url; |
| - if (!header_footer_info.GetString(printing::kSettingHeaderFooterURL, |
| - &url)) { |
| + if (!header_footer_info.GetString(printing::kSettingHeaderFooterURL, &url)) { |
| NOTREACHED(); |
| } |
| string16 footer_text = page_of_total_pages + url; |
| @@ -653,7 +631,7 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint( |
| expected_pages_count_(0), |
| use_browser_overlays_(true), |
| finished_(false) { |
| - WebPrintParams webkit_print_params; |
| + WebKit::WebPrintParams webkit_print_params; |
| ComputeWebKitPrintParamsInDesiredDpi(print_params, &webkit_print_params); |
| if (WebFrame* web_frame = web_view_->mainFrame()) |
| @@ -670,7 +648,7 @@ PrepareFrameAndViewForPrint::~PrepareFrameAndViewForPrint() { |
| void PrepareFrameAndViewForPrint::UpdatePrintParams( |
| const PrintMsg_Print_Params& print_params) { |
| DCHECK(!finished_); |
| - WebPrintParams webkit_print_params; |
| + WebKit::WebPrintParams webkit_print_params; |
| ComputeWebKitPrintParamsInDesiredDpi(print_params, &webkit_print_params); |
| if (webkit_print_params.printContentArea == |
| @@ -686,8 +664,13 @@ void PrepareFrameAndViewForPrint::UpdatePrintParams( |
| StartPrinting(webkit_print_params); |
| } |
| +gfx::Size PrepareFrameAndViewForPrint::GetPrintCanvasSize() const { |
| + return gfx::Size(web_print_params_.printContentArea.width, |
| + web_print_params_.printContentArea.height); |
| +} |
| + |
| void PrepareFrameAndViewForPrint::StartPrinting( |
| - const WebPrintParams& webkit_print_params) { |
| + const WebKit::WebPrintParams& webkit_print_params) { |
| web_print_params_ = webkit_print_params; |
| // Layout page according to printer page size. Since WebKit shrinks the |
| @@ -734,7 +717,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view) |
| PrintWebViewHelper::~PrintWebViewHelper() {} |
| bool PrintWebViewHelper::IsScriptInitiatedPrintAllowed( |
| - WebKit::WebFrame* frame, bool user_initiated) { |
|
Lei Zhang
2012/11/01 19:21:42
If you don't mind, can we keep this one and the on
Vitaly Buka (NO REVIEWS)
2012/11/01 19:55:56
Then we don't need these usings, most of them inte
|
| + WebFrame* frame, bool user_initiated) { |
| if (is_scripted_printing_blocked_) |
| return false; |
| // If preview is enabled, then the print dialog is tab modal, and the user |
| @@ -749,7 +732,7 @@ bool PrintWebViewHelper::IsScriptInitiatedPrintAllowed( |
| } |
| // Prints |frame| which called window.print(). |
| -void PrintWebViewHelper::PrintPage(WebKit::WebFrame* frame, |
| +void PrintWebViewHelper::PrintPage(WebFrame* frame, |
| bool user_initiated) { |
| DCHECK(frame); |
| @@ -804,10 +787,10 @@ void PrintWebViewHelper::OnPrintForPrintPreview( |
| if (!main_frame) |
| return; |
| - WebDocument document = main_frame->document(); |
| + WebKit::WebDocument document = main_frame->document(); |
| // <object> with id="pdf-viewer" is created in |
| // chrome/browser/resources/print_preview/print_preview.js |
| - WebElement pdf_element = document.getElementById("pdf-viewer"); |
| + WebKit::WebElement pdf_element = document.getElementById("pdf-viewer"); |
| if (pdf_element.isNull()) { |
| NOTREACHED(); |
| return; |
| @@ -843,7 +826,7 @@ void PrintWebViewHelper::OnPrintForPrintPreview( |
| } |
| } |
| -bool PrintWebViewHelper::GetPrintFrame(WebKit::WebFrame** frame) { |
| +bool PrintWebViewHelper::GetPrintFrame(WebFrame** frame) { |
| DCHECK(frame); |
| DCHECK(render_view()->GetWebView()); |
| if (!render_view()->GetWebView()) |
| @@ -874,7 +857,7 @@ void PrintWebViewHelper::OnPrintForSystemDialog() { |
| } |
| void PrintWebViewHelper::GetPageSizeAndContentAreaFromPageLayout( |
| - const printing::PageSizeMargins& page_layout_in_points, |
| + const PageSizeMargins& page_layout_in_points, |
| gfx::Size* page_size, |
| gfx::Rect* content_area) { |
| *page_size = gfx::Size( |
| @@ -895,7 +878,7 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo( |
| int margins_type = 0; |
| if (!settings.GetInteger(printing::kSettingMarginsType, &margins_type)) |
| margins_type = printing::DEFAULT_MARGINS; |
| - ignore_css_margins_ = margins_type != printing::DEFAULT_MARGINS; |
| + ignore_css_margins_ = (margins_type != printing::DEFAULT_MARGINS); |
| } |
| bool PrintWebViewHelper::IsPrintToPdfRequested( |
| @@ -996,9 +979,9 @@ void PrintWebViewHelper::OnPrintPreview(const DictionaryValue& settings) { |
| } |
| bool PrintWebViewHelper::CreatePreviewDocument() { |
| - PrintMsg_Print_Params print_params = print_pages_params_->params; |
| + const PrintMsg_Print_Params& print_params = print_pages_params_->params; |
| const std::vector<int>& pages = print_pages_params_->pages; |
| - if (!print_preview_context_.CreatePreviewDocument(&print_params, pages, |
| + if (!print_preview_context_.CreatePreviewDocument(print_params, pages, |
| ignore_css_margins_)) { |
| return false; |
| } |
| @@ -1015,14 +998,10 @@ bool PrintWebViewHelper::CreatePreviewDocument() { |
| print_preview_context_.total_page_count()); |
| int dpi = GetDPI(&print_params); |
| gfx::Rect printable_area_in_points( |
| - ConvertUnit(print_pages_params_->params.printable_area.x(), |
| - dpi, printing::kPointsPerInch), |
| - ConvertUnit(print_pages_params_->params.printable_area.y(), |
| - dpi, printing::kPointsPerInch), |
| - ConvertUnit(print_pages_params_->params.printable_area.width(), |
| - dpi, printing::kPointsPerInch), |
| - ConvertUnit(print_pages_params_->params.printable_area.height(), |
| - dpi, printing::kPointsPerInch)); |
| + ConvertUnit(print_params.printable_area.x(), dpi, kPointsPerInch), |
| + ConvertUnit(print_params.printable_area.y(), dpi, kPointsPerInch), |
| + ConvertUnit(print_params.printable_area.width(), dpi, kPointsPerInch), |
| + ConvertUnit(print_params.printable_area.height(), dpi, kPointsPerInch)); |
| // Margins: Send default page layout to browser process. |
| Send(new PrintHostMsg_DidGetDefaultPageLayout(routing_id(), |
| @@ -1034,8 +1013,8 @@ bool PrintWebViewHelper::CreatePreviewDocument() { |
| PrintHostMsg_DidGetPreviewPageCount_Params params; |
| params.page_count = print_preview_context_.total_page_count(); |
| params.is_modifiable = print_preview_context_.IsModifiable(); |
| - params.document_cookie = print_pages_params_->params.document_cookie; |
| - params.preview_request_id = print_pages_params_->params.preview_request_id; |
| + params.document_cookie = print_params.document_cookie; |
| + params.preview_request_id = print_params.preview_request_id; |
| params.clear_preview_data = print_preview_context_.generate_draft_pages(); |
| Send(new PrintHostMsg_DidGetPreviewPageCount(routing_id(), params)); |
| if (CheckForCancel()) |
| @@ -1044,7 +1023,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() { |
| while (!print_preview_context_.IsFinalPageRendered()) { |
| int page_number = print_preview_context_.GetNextPageNumber(); |
| DCHECK_GE(page_number, 0); |
| - if (!RenderPreviewPage(page_number)) |
| + if (!RenderPreviewPage(page_number, print_params)) |
| return false; |
| if (CheckForCancel()) |
| @@ -1152,8 +1131,8 @@ void PrintWebViewHelper::PrintNode(const WebNode& node) { |
| } |
| } |
| -void PrintWebViewHelper::Print(WebKit::WebFrame* frame, |
| - const WebKit::WebNode& node) { |
| +void PrintWebViewHelper::Print(WebFrame* frame, |
| + const WebNode& node) { |
| // If still not finished with earlier print request simply ignore. |
| if (print_web_view_) |
| return; |
| @@ -1242,7 +1221,7 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { |
| notify_browser_of_print_failure_ = true; |
| } |
| -bool PrintWebViewHelper::CopyAndPrint(WebKit::WebFrame* web_frame) { |
| +bool PrintWebViewHelper::CopyAndPrint(WebFrame* web_frame) { |
| // Create a new WebView with the same settings as the current display one. |
| // Except that we disable javascript (don't want any active content running |
| // on the page). |
| @@ -1250,7 +1229,7 @@ bool PrintWebViewHelper::CopyAndPrint(WebKit::WebFrame* web_frame) { |
| prefs.javascript_enabled = false; |
| prefs.java_enabled = false; |
| - print_web_view_ = WebView::create(this); |
| + print_web_view_ = WebKit::WebView::create(this); |
| prefs.Apply(print_web_view_); |
| print_web_view_->initializeMainFrame(this); |
| @@ -1263,7 +1242,7 @@ bool PrintWebViewHelper::CopyAndPrint(WebKit::WebFrame* web_frame) { |
| // When loading is done this will call didStopLoading() and that will do the |
| // actual printing. |
| - print_web_view_->mainFrame()->loadRequest(WebURLRequest(url)); |
| + print_web_view_->mainFrame()->loadRequest(WebKit::WebURLRequest(url)); |
| return true; |
| } |
| @@ -1374,7 +1353,7 @@ bool PrintWebViewHelper::InitPrintSettings(bool fit_to_paper_size) { |
| } |
| bool PrintWebViewHelper::InitPrintSettingsAndPrepareFrame( |
| - WebKit::WebFrame* frame, const WebKit::WebNode& node, |
| + WebFrame* frame, const WebNode& node, |
| scoped_ptr<PrepareFrameAndViewForPrint>* prepare) { |
| DCHECK(frame); |
| @@ -1399,7 +1378,7 @@ bool PrintWebViewHelper::InitPrintSettingsAndPrepareFrame( |
| } |
| bool PrintWebViewHelper::UpdatePrintSettings( |
| - WebKit::WebFrame* frame, const WebKit::WebNode& node, |
| + WebFrame* frame, const WebNode& node, |
| const DictionaryValue& passed_job_settings) { |
| DCHECK(is_preview_enabled_); |
| const DictionaryValue* job_settings = &passed_job_settings; |
| @@ -1443,7 +1422,7 @@ bool PrintWebViewHelper::UpdatePrintSettings( |
| print_preview_context_.set_error(PREVIEW_ERROR_INVALID_PRINTER_SETTINGS); |
| } else { |
| // PrintForPrintPreview |
| - WebKit::WebFrame* print_frame = NULL; |
| + WebFrame* print_frame = NULL; |
| // This may not be the right frame, but the alert will be modal, |
| // therefore it works well enough. |
| GetPrintFrame(&print_frame); |
| @@ -1498,8 +1477,8 @@ bool PrintWebViewHelper::UpdatePrintSettings( |
| return true; |
| } |
| -bool PrintWebViewHelper::GetPrintSettingsFromUser(WebKit::WebFrame* frame, |
| - const WebKit::WebNode& node, |
| +bool PrintWebViewHelper::GetPrintSettingsFromUser(WebFrame* frame, |
| + const WebNode& node, |
| int expected_pages_count, |
| bool use_browser_overlays) { |
| PrintHostMsg_ScriptedPrint_Params params; |
| @@ -1532,8 +1511,8 @@ bool PrintWebViewHelper::GetPrintSettingsFromUser(WebKit::WebFrame* frame, |
| } |
| bool PrintWebViewHelper::RenderPagesForPrint( |
| - WebKit::WebFrame* frame, |
| - const WebKit::WebNode& node) { |
| + WebFrame* frame, |
| + const WebNode& node) { |
| if (print_pages_params_->params.selection_only) |
| return CopyAndPrint(frame); |
| return PrintPages(frame, node); |
| @@ -1561,7 +1540,7 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( |
| #endif // defined(OS_POSIX) |
| bool PrintWebViewHelper::IsScriptInitiatedPrintTooFrequent( |
| - WebKit::WebFrame* frame) { |
| + WebFrame* frame) { |
| const int kMinSecondsToIgnoreJavascriptInitiatedPrint = 2; |
| const int kMaxSecondsToIgnoreJavascriptInitiatedPrint = 32; |
| bool too_frequent = false; |
| @@ -1589,10 +1568,11 @@ bool PrintWebViewHelper::IsScriptInitiatedPrintTooFrequent( |
| if (!too_frequent) |
| return false; |
| - WebString message(WebString::fromUTF8( |
| - "Ignoring too frequent calls to print().")); |
| - frame->addMessageToConsole(WebConsoleMessage(WebConsoleMessage::LevelWarning, |
| - message)); |
| + WebKit::WebString message( |
| + WebKit::WebString::fromUTF8("Ignoring too frequent calls to print().")); |
| + frame->addMessageToConsole( |
| + WebKit::WebConsoleMessage( |
| + WebKit::WebConsoleMessage::LevelWarning, message)); |
| return true; |
| } |
| @@ -1699,7 +1679,7 @@ PrintWebViewHelper::PrintPreviewContext::~PrintPreviewContext() { |
| } |
| void PrintWebViewHelper::PrintPreviewContext::InitWithFrame( |
| - WebKit::WebFrame* web_frame) { |
| + WebFrame* web_frame) { |
| DCHECK(web_frame); |
| DCHECK(!IsRendering()); |
| state_ = INITIALIZED; |
| @@ -1708,7 +1688,7 @@ void PrintWebViewHelper::PrintPreviewContext::InitWithFrame( |
| } |
| void PrintWebViewHelper::PrintPreviewContext::InitWithNode( |
| - const WebKit::WebNode& web_node) { |
| + const WebNode& web_node) { |
| DCHECK(!web_node.isNull()); |
| DCHECK(web_node.document().frame()); |
| DCHECK(!IsRendering()); |
| @@ -1723,7 +1703,7 @@ void PrintWebViewHelper::PrintPreviewContext::OnPrintPreview() { |
| } |
| bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument( |
| - PrintMsg_Print_Params* print_params, |
| + const PrintMsg_Print_Params& print_params, |
| const std::vector<int>& pages, |
| bool ignore_css_margins) { |
| DCHECK_EQ(INITIALIZED, state_); |
| @@ -1737,12 +1717,10 @@ bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument( |
| } |
| // Need to make sure old object gets destroyed first. |
| - prep_frame_view_.reset(new PrepareFrameAndViewForPrint(*print_params, frame(), |
| + prep_frame_view_.reset(new PrepareFrameAndViewForPrint(print_params, frame(), |
| node())); |
| UpdateFrameAndViewFromCssPageLayout(frame_, node_, prep_frame_view_.get(), |
| - *print_params, ignore_css_margins); |
| - |
| - print_params_.reset(new PrintMsg_Print_Params(*print_params)); |
| + print_params, ignore_css_margins); |
| total_page_count_ = prep_frame_view_->GetExpectedPageCount(); |
| if (total_page_count_ == 0) { |
| @@ -1867,14 +1845,14 @@ void PrintWebViewHelper::PrintPreviewContext::set_error( |
| error_ = error; |
| } |
| -WebKit::WebFrame* PrintWebViewHelper::PrintPreviewContext::frame() { |
| +WebFrame* PrintWebViewHelper::PrintPreviewContext::frame() { |
| // TODO(thestig) turn this back into a DCHECK when http://crbug.com/118303 is |
| // resolved. |
| CHECK(state_ != UNINITIALIZED); |
| return frame_; |
| } |
| -const WebKit::WebNode& PrintWebViewHelper::PrintPreviewContext::node() const { |
| +const WebNode& PrintWebViewHelper::PrintPreviewContext::node() const { |
| DCHECK(state_ != UNINITIALIZED); |
| return node_; |
| } |
| @@ -1893,12 +1871,6 @@ printing::PreviewMetafile* PrintWebViewHelper::PrintPreviewContext::metafile() { |
| return metafile_.get(); |
| } |
| -const PrintMsg_Print_Params& |
| -PrintWebViewHelper::PrintPreviewContext::print_params() const { |
| - DCHECK(state_ != UNINITIALIZED); |
| - return *print_params_; |
| -} |
| - |
| int PrintWebViewHelper::PrintPreviewContext::last_error() const { |
| return error_; |
| } |