| 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 if (main_frame) | 1048 if (main_frame) |
| 1049 GetContentClient()->SetActiveURL(main_frame->document().url()); | 1049 GetContentClient()->SetActiveURL(main_frame->document().url()); |
| 1050 | 1050 |
| 1051 ObserverListBase<RenderViewObserver>::Iterator it(observers_); | 1051 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
| 1052 RenderViewObserver* observer; | 1052 RenderViewObserver* observer; |
| 1053 while ((observer = it.GetNext()) != NULL) | 1053 while ((observer = it.GetNext()) != NULL) |
| 1054 if (observer->OnMessageReceived(message)) | 1054 if (observer->OnMessageReceived(message)) |
| 1055 return true; | 1055 return true; |
| 1056 | 1056 |
| 1057 bool handled = true; | 1057 bool handled = true; |
| 1058 bool msg_is_ok = true; | 1058 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
| 1059 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewImpl, message, msg_is_ok) | |
| 1060 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1059 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| 1061 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1060 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
| 1062 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1061 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
| 1063 OnScrollFocusedEditableNodeIntoRect) | 1062 OnScrollFocusedEditableNodeIntoRect) |
| 1064 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1063 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 1065 OnSetEditCommandsForNextKeyEvent) | 1064 OnSetEditCommandsForNextKeyEvent) |
| 1066 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) | 1065 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) |
| 1067 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) | 1066 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) |
| 1068 IPC_MESSAGE_HANDLER(ViewMsg_SetName, OnSetName) | 1067 IPC_MESSAGE_HANDLER(ViewMsg_SetName, OnSetName) |
| 1069 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 1068 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | 1141 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
| 1143 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | 1142 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
| 1144 #endif | 1143 #endif |
| 1145 // Adding a new message? Add platform independent ones first, then put the | 1144 // Adding a new message? Add platform independent ones first, then put the |
| 1146 // platform specific ones at the end. | 1145 // platform specific ones at the end. |
| 1147 | 1146 |
| 1148 // Have the super handle all other messages. | 1147 // Have the super handle all other messages. |
| 1149 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 1148 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
| 1150 IPC_END_MESSAGE_MAP() | 1149 IPC_END_MESSAGE_MAP() |
| 1151 | 1150 |
| 1152 if (!msg_is_ok) { | |
| 1153 // The message had a handler, but its deserialization failed. | |
| 1154 // Kill the renderer to avoid potential spoofing attacks. | |
| 1155 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; | |
| 1156 } | |
| 1157 | |
| 1158 return handled; | 1151 return handled; |
| 1159 } | 1152 } |
| 1160 | 1153 |
| 1161 void RenderViewImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { | 1154 void RenderViewImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
| 1162 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); | 1155 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); |
| 1163 } | 1156 } |
| 1164 | 1157 |
| 1165 bool RenderViewImpl::IsBackForwardToStaleEntry( | 1158 bool RenderViewImpl::IsBackForwardToStaleEntry( |
| 1166 const FrameMsg_Navigate_Params& params, | 1159 const FrameMsg_Navigate_Params& params, |
| 1167 bool is_reload) { | 1160 bool is_reload) { |
| (...skipping 2925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4093 std::vector<gfx::Size> sizes; | 4086 std::vector<gfx::Size> sizes; |
| 4094 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4087 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4095 if (!url.isEmpty()) | 4088 if (!url.isEmpty()) |
| 4096 urls.push_back( | 4089 urls.push_back( |
| 4097 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4090 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4098 } | 4091 } |
| 4099 SendUpdateFaviconURL(urls); | 4092 SendUpdateFaviconURL(urls); |
| 4100 } | 4093 } |
| 4101 | 4094 |
| 4102 } // namespace content | 4095 } // namespace content |
| OLD | NEW |