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