OLD | NEW |
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 "content/browser/renderer_host/render_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 // If we are waiting for an unload or beforeunload ack and the user has | 582 // If we are waiting for an unload or beforeunload ack and the user has |
583 // suppressed messages, kill the tab immediately; a page that's spamming | 583 // suppressed messages, kill the tab immediately; a page that's spamming |
584 // alerts in onbeforeunload is presumably malicious, so there's no point in | 584 // alerts in onbeforeunload is presumably malicious, so there's no point in |
585 // continuing to run its script and dragging out the process. | 585 // continuing to run its script and dragging out the process. |
586 // This must be done after sending the reply since RenderView can't close | 586 // This must be done after sending the reply since RenderView can't close |
587 // correctly while waiting for a response. | 587 // correctly while waiting for a response. |
588 if (is_waiting && are_javascript_messages_suppressed_) | 588 if (is_waiting && are_javascript_messages_suppressed_) |
589 delegate_->RendererUnresponsive(this, is_waiting); | 589 delegate_->RendererUnresponsive(this, is_waiting); |
590 } | 590 } |
591 | 591 |
592 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, | |
593 const std::string& json_retval) { | |
594 if (is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_) | |
595 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | |
596 | |
597 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); | |
598 Send(reply_msg); | |
599 } | |
600 | |
601 void RenderViewHost::CopyImageAt(int x, int y) { | 592 void RenderViewHost::CopyImageAt(int x, int y) { |
602 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); | 593 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); |
603 } | 594 } |
604 | 595 |
605 void RenderViewHost::DragSourceEndedAt( | 596 void RenderViewHost::DragSourceEndedAt( |
606 int client_x, int client_y, int screen_x, int screen_y, | 597 int client_x, int client_y, int screen_x, int screen_y, |
607 WebDragOperation operation) { | 598 WebDragOperation operation) { |
608 Send(new ViewMsg_DragSourceEndedOrMoved( | 599 Send(new ViewMsg_DragSourceEndedOrMoved( |
609 routing_id(), | 600 routing_id(), |
610 gfx::Point(client_x, client_y), | 601 gfx::Point(client_x, client_y), |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, | 755 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, |
765 OnMsgDomOperationResponse) | 756 OnMsgDomOperationResponse) |
766 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnMsgWebUISend) | 757 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnMsgWebUISend) |
767 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, | 758 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, |
768 OnMsgForwardMessageToExternalHost) | 759 OnMsgForwardMessageToExternalHost) |
769 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) | 760 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) |
770 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage, | 761 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage, |
771 OnMsgRunJavaScriptMessage) | 762 OnMsgRunJavaScriptMessage) |
772 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, | 763 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, |
773 OnMsgRunBeforeUnloadConfirm) | 764 OnMsgRunBeforeUnloadConfirm) |
774 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ShowModalHTMLDialog, | |
775 OnMsgShowModalHTMLDialog) | |
776 IPC_MESSAGE_HANDLER(ViewHostMsg_StartDragging, OnMsgStartDragging) | 765 IPC_MESSAGE_HANDLER(ViewHostMsg_StartDragging, OnMsgStartDragging) |
777 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 766 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
778 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 767 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
779 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) | 768 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) |
780 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsAgent, | 769 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsAgent, |
781 OnForwardToDevToolsAgent) | 770 OnForwardToDevToolsAgent) |
782 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient, | 771 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient, |
783 OnForwardToDevToolsClient) | 772 OnForwardToDevToolsClient) |
784 IPC_MESSAGE_HANDLER(ViewHostMsg_ActivateDevToolsWindow, | 773 IPC_MESSAGE_HANDLER(ViewHostMsg_ActivateDevToolsWindow, |
785 OnActivateDevToolsWindow) | 774 OnActivateDevToolsWindow) |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, | 1218 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, |
1230 const std::wstring& message, | 1219 const std::wstring& message, |
1231 IPC::Message* reply_msg) { | 1220 IPC::Message* reply_msg) { |
1232 // While a JS before unload dialog is showing, tabs in the same process | 1221 // While a JS before unload dialog is showing, tabs in the same process |
1233 // shouldn't process input events. | 1222 // shouldn't process input events. |
1234 process()->set_ignore_input_events(true); | 1223 process()->set_ignore_input_events(true); |
1235 StopHangMonitorTimeout(); | 1224 StopHangMonitorTimeout(); |
1236 delegate_->RunBeforeUnloadConfirm(message, reply_msg); | 1225 delegate_->RunBeforeUnloadConfirm(message, reply_msg); |
1237 } | 1226 } |
1238 | 1227 |
1239 void RenderViewHost::OnMsgShowModalHTMLDialog( | |
1240 const GURL& url, int width, int height, const std::string& json_arguments, | |
1241 IPC::Message* reply_msg) { | |
1242 StopHangMonitorTimeout(); | |
1243 delegate_->ShowModalHTMLDialog(url, width, height, json_arguments, reply_msg); | |
1244 } | |
1245 | |
1246 void RenderViewHost::MediaPlayerActionAt(const gfx::Point& location, | 1228 void RenderViewHost::MediaPlayerActionAt(const gfx::Point& location, |
1247 const WebMediaPlayerAction& action) { | 1229 const WebMediaPlayerAction& action) { |
1248 // TODO(ajwong): Which thread should run this? Does it matter? | 1230 // TODO(ajwong): Which thread should run this? Does it matter? |
1249 Send(new ViewMsg_MediaPlayerActionAt(routing_id(), location, action)); | 1231 Send(new ViewMsg_MediaPlayerActionAt(routing_id(), location, action)); |
1250 } | 1232 } |
1251 | 1233 |
1252 void RenderViewHost::ContextMenuClosed( | 1234 void RenderViewHost::ContextMenuClosed( |
1253 const webkit_glue::CustomContextMenuContext& custom_context) { | 1235 const webkit_glue::CustomContextMenuContext& custom_context) { |
1254 Send(new ViewMsg_ContextMenuClosed(routing_id(), custom_context)); | 1236 Send(new ViewMsg_ContextMenuClosed(routing_id(), custom_context)); |
1255 } | 1237 } |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 LOG(DFATAL) << "Invalid checked state " << checked_state; | 1688 LOG(DFATAL) << "Invalid checked state " << checked_state; |
1707 return; | 1689 return; |
1708 } | 1690 } |
1709 | 1691 |
1710 CommandState state; | 1692 CommandState state; |
1711 state.is_enabled = is_enabled; | 1693 state.is_enabled = is_enabled; |
1712 state.checked_state = | 1694 state.checked_state = |
1713 static_cast<RenderViewCommandCheckedState>(checked_state); | 1695 static_cast<RenderViewCommandCheckedState>(checked_state); |
1714 command_states_[static_cast<RenderViewCommand>(command)] = state; | 1696 command_states_[static_cast<RenderViewCommand>(command)] = state; |
1715 } | 1697 } |
OLD | NEW |