OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/user_metrics_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 | 270 |
271 if (delegate_->OnMessageReceived(this, msg)) | 271 if (delegate_->OnMessageReceived(this, msg)) |
272 return true; | 272 return true; |
273 | 273 |
274 if (cross_process_frame_connector_ && | 274 if (cross_process_frame_connector_ && |
275 cross_process_frame_connector_->OnMessageReceived(msg)) | 275 cross_process_frame_connector_->OnMessageReceived(msg)) |
276 return true; | 276 return true; |
277 | 277 |
278 bool handled = true; | 278 bool handled = true; |
279 bool msg_is_ok = true; | 279 IPC_BEGIN_MESSAGE_MAP(RenderFrameHostImpl, msg) |
280 IPC_BEGIN_MESSAGE_MAP_EX(RenderFrameHostImpl, msg, msg_is_ok) | |
281 IPC_MESSAGE_HANDLER(FrameHostMsg_AddMessageToConsole, OnAddMessageToConsole) | 280 IPC_MESSAGE_HANDLER(FrameHostMsg_AddMessageToConsole, OnAddMessageToConsole) |
282 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) | 281 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) |
283 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameFocused, OnFrameFocused) | 282 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameFocused, OnFrameFocused) |
284 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartProvisionalLoadForFrame, | 283 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartProvisionalLoadForFrame, |
285 OnDidStartProvisionalLoadForFrame) | 284 OnDidStartProvisionalLoadForFrame) |
286 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailProvisionalLoadWithError, | 285 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailProvisionalLoadWithError, |
287 OnDidFailProvisionalLoadWithError) | 286 OnDidFailProvisionalLoadWithError) |
288 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRedirectProvisionalLoad, | 287 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRedirectProvisionalLoad, |
289 OnDidRedirectProvisionalLoad) | 288 OnDidRedirectProvisionalLoad) |
290 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError, | 289 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError, |
(...skipping 18 matching lines...) Expand all Loading... |
309 OnDidAccessInitialDocument) | 308 OnDidAccessInitialDocument) |
310 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) | 309 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) |
311 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 310 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
312 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 311 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
313 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, | 312 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, |
314 OnRequestDesktopNotificationPermission) | 313 OnRequestDesktopNotificationPermission) |
315 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, | 314 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, |
316 OnShowDesktopNotification) | 315 OnShowDesktopNotification) |
317 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, | 316 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, |
318 OnCancelDesktopNotification) | 317 OnCancelDesktopNotification) |
319 IPC_END_MESSAGE_MAP_EX() | 318 IPC_END_MESSAGE_MAP() |
320 | |
321 if (!msg_is_ok) { | |
322 // The message had a handler, but its de-serialization failed. | |
323 // Kill the renderer. | |
324 RecordAction(base::UserMetricsAction("BadMessageTerminate_RFH")); | |
325 GetProcess()->ReceivedBadMessage(); | |
326 } | |
327 | 319 |
328 return handled; | 320 return handled; |
329 } | 321 } |
330 | 322 |
331 void RenderFrameHostImpl::Init() { | 323 void RenderFrameHostImpl::Init() { |
332 GetProcess()->ResumeRequestsForView(routing_id_); | 324 GetProcess()->ResumeRequestsForView(routing_id_); |
333 } | 325 } |
334 | 326 |
335 void RenderFrameHostImpl::OnAddMessageToConsole( | 327 void RenderFrameHostImpl::OnAddMessageToConsole( |
336 int32 level, | 328 int32 level, |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 cancel_notification_callbacks_.erase(notification_id); | 886 cancel_notification_callbacks_.erase(notification_id); |
895 } | 887 } |
896 | 888 |
897 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone( | 889 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone( |
898 int callback_context) { | 890 int callback_context) { |
899 Send(new DesktopNotificationMsg_PermissionRequestDone( | 891 Send(new DesktopNotificationMsg_PermissionRequestDone( |
900 routing_id_, callback_context)); | 892 routing_id_, callback_context)); |
901 } | 893 } |
902 | 894 |
903 } // namespace content | 895 } // namespace content |
OLD | NEW |