| Index: chrome/renderer/render_view.cc
|
| ===================================================================
|
| --- chrome/renderer/render_view.cc (revision 70859)
|
| +++ chrome/renderer/render_view.cc (working copy)
|
| @@ -972,6 +972,9 @@
|
| IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot)
|
| IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages)
|
| IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone)
|
| + IPC_MESSAGE_HANDLER(ViewMsg_PrintPreview, OnPrintPreview)
|
| + IPC_MESSAGE_HANDLER(ViewMsg_PrintNodeUnderContextMenu,
|
| + OnPrintNodeUnderContextMenu)
|
| IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate)
|
| IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop)
|
| IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame)
|
| @@ -1100,7 +1103,7 @@
|
| #if defined(OS_MACOSX)
|
| IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
|
| #endif
|
| - IPC_MESSAGE_HANDLER(ViewMsg_PrintPreview, OnPrintPreview)
|
| + IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed)
|
|
|
| // Have the super handle all other messages.
|
| IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message))
|
| @@ -1182,6 +1185,16 @@
|
| }
|
| }
|
|
|
| +
|
| +void RenderView::OnPrintNodeUnderContextMenu() {
|
| + if (context_menu_node_.isNull()) {
|
| + NOTREACHED();
|
| + return;
|
| + }
|
| +
|
| + GetPrintWebViewHelper()->Print(&context_menu_node_, false, false);
|
| +}
|
| +
|
| void RenderView::CapturePageInfo(int load_id, bool preliminary_capture) {
|
| if (load_id != page_id_)
|
| return; // this capture call is no longer relevant due to navigation
|
| @@ -2493,6 +2506,7 @@
|
| // data encoded images. We should have a way to save them.
|
| if (params.src_url.spec().size() > chrome::kMaxURLChars)
|
| params.src_url = GURL();
|
| + context_menu_node_ = data.node;
|
| Send(new ViewHostMsg_ContextMenu(routing_id_, params));
|
| }
|
|
|
| @@ -5385,10 +5399,13 @@
|
| bool script_initiated,
|
| bool is_preview) {
|
| DCHECK(frame);
|
| - if (print_helper_.get() == NULL) {
|
| + GetPrintWebViewHelper()->Print(frame, script_initiated, is_preview);
|
| +}
|
| +
|
| +PrintWebViewHelper* RenderView::GetPrintWebViewHelper() {
|
| + if (print_helper_.get() == NULL)
|
| print_helper_.reset(new PrintWebViewHelper(this));
|
| - }
|
| - print_helper_->Print(frame, script_initiated, is_preview);
|
| + return print_helper_.get();
|
| }
|
|
|
| void RenderView::OnSetEditCommandsForNextKeyEvent(
|
| @@ -5770,3 +5787,7 @@
|
| remote_addr);
|
| }
|
| #endif
|
| +
|
| +void RenderView::OnContextMenuClosed() {
|
| + context_menu_node_.reset();
|
| +}
|
|
|