OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 } | 962 } |
963 // Don't continue looking for someone to handle it. | 963 // Don't continue looking for someone to handle it. |
964 return true; | 964 return true; |
965 } | 965 } |
966 } | 966 } |
967 | 967 |
968 if (delegate_->OnMessageReceived(this, msg)) | 968 if (delegate_->OnMessageReceived(this, msg)) |
969 return true; | 969 return true; |
970 | 970 |
971 bool handled = true; | 971 bool handled = true; |
972 bool msg_is_ok = true; | 972 IPC_BEGIN_MESSAGE_MAP(RenderViewHostImpl, msg) |
973 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHostImpl, msg, msg_is_ok) | |
974 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnShowView) | 973 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnShowView) |
975 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) | 974 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) |
976 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, | 975 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, |
977 OnShowFullscreenWidget) | 976 OnShowFullscreenWidget) |
978 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) | 977 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) |
979 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) | 978 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) |
980 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) | 979 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) |
981 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) | 980 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) |
982 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) | 981 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) |
983 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateInspectorSetting, | 982 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateInspectorSetting, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 IPC_MESSAGE_HANDLER(ViewHostMsg_HidePopup, OnHidePopup) | 1015 IPC_MESSAGE_HANDLER(ViewHostMsg_HidePopup, OnHidePopup) |
1017 #endif | 1016 #endif |
1018 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 1017 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
1019 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 1018 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
1020 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 1019 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
1021 OnAccessibilityLocationChanges) | 1020 OnAccessibilityLocationChanges) |
1022 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) | 1021 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) |
1023 // Have the super handle all other messages. | 1022 // Have the super handle all other messages. |
1024 IPC_MESSAGE_UNHANDLED( | 1023 IPC_MESSAGE_UNHANDLED( |
1025 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) | 1024 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) |
1026 IPC_END_MESSAGE_MAP_EX() | 1025 IPC_END_MESSAGE_MAP() |
1027 | |
1028 if (!msg_is_ok) { | |
1029 // The message had a handler, but its de-serialization failed. | |
1030 // Kill the renderer. | |
1031 RecordAction(base::UserMetricsAction("BadMessageTerminate_RVH")); | |
1032 GetProcess()->ReceivedBadMessage(); | |
1033 } | |
1034 | 1026 |
1035 return handled; | 1027 return handled; |
1036 } | 1028 } |
1037 | 1029 |
1038 void RenderViewHostImpl::Init() { | 1030 void RenderViewHostImpl::Init() { |
1039 RenderWidgetHostImpl::Init(); | 1031 RenderWidgetHostImpl::Init(); |
1040 } | 1032 } |
1041 | 1033 |
1042 void RenderViewHostImpl::Shutdown() { | 1034 void RenderViewHostImpl::Shutdown() { |
1043 // If we are being run modally (see RunModal), then we need to cleanup. | 1035 // If we are being run modally (see RunModal), then we need to cleanup. |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 return true; | 1685 return true; |
1694 } | 1686 } |
1695 | 1687 |
1696 void RenderViewHostImpl::AttachToFrameTree() { | 1688 void RenderViewHostImpl::AttachToFrameTree() { |
1697 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1689 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1698 | 1690 |
1699 frame_tree->ResetForMainFrameSwap(); | 1691 frame_tree->ResetForMainFrameSwap(); |
1700 } | 1692 } |
1701 | 1693 |
1702 } // namespace content | 1694 } // namespace content |
OLD | NEW |