diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-28 23:37:55 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-28 23:37:55 +0000 |
commit | 87c0254db050a6df147be484e2496aaa4b4f95a1 (patch) | |
tree | f0db8c3d0ab2c5e92ae48e43cbf210ca1e3042dd /chrome/renderer/render_view.cc | |
parent | 0fc9dca2aae7f778a5a43aee1f898af7d93b15b8 (diff) | |
download | chromium_src-87c0254db050a6df147be484e2496aaa4b4f95a1.zip chromium_src-87c0254db050a6df147be484e2496aaa4b4f95a1.tar.gz chromium_src-87c0254db050a6df147be484e2496aaa4b4f95a1.tar.bz2 |
Roll back r8821
Review URL: http://codereview.chromium.org/19453
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r-- | chrome/renderer/render_view.cc | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 45a64dc..b8d321a 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -341,6 +341,7 @@ void RenderView::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(RenderView, message) IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, SendThumbnail) + IPC_MESSAGE_HANDLER(ViewMsg_GetPrintedPagesCount, OnGetPrintedPagesCount) IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) @@ -514,6 +515,12 @@ void RenderView::SwitchFrameToDisplayMediaType(WebFrame* frame) { printed_document_width_ = 0; } +void RenderView::OnPrintPage(const ViewMsg_PrintPage_Params& params) { + DCHECK(webview()); + if (webview()) + PrintPage(params, webview()->GetMainFrame()); +} + void RenderView::PrintPage(const ViewMsg_PrintPage_Params& params, WebFrame* frame) { #if defined(OS_WIN) @@ -639,12 +646,26 @@ void RenderView::PrintPage(const ViewMsg_PrintPage_Params& params, #endif } -void RenderView::OnPrintPages() { +void RenderView::OnGetPrintedPagesCount(const ViewMsg_Print_Params& params) { DCHECK(webview()); - if (webview()) { - // The renderer own the control flow as if it was a window.print() call. - ScriptedPrint(webview()->GetMainFrame()); + if (!webview()) { + Send(new ViewHostMsg_DidGetPrintedPagesCount(routing_id_, + params.document_cookie, + 0)); + return; } + WebFrame* frame = webview()->GetMainFrame(); + int expected_pages = SwitchFrameToPrintMediaType(params, frame); + Send(new ViewHostMsg_DidGetPrintedPagesCount(routing_id_, + params.document_cookie, + expected_pages)); + SwitchFrameToDisplayMediaType(frame); +} + +void RenderView::OnPrintPages(const ViewMsg_PrintPages_Params& params) { + DCHECK(webview()); + if (webview()) + PrintPages(params, webview()->GetMainFrame()); } void RenderView::PrintPages(const ViewMsg_PrintPages_Params& params, |