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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameFocused, OnFrameFocused) | 452 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameFocused, OnFrameFocused) |
453 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartProvisionalLoadForFrame, | 453 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartProvisionalLoadForFrame, |
454 OnDidStartProvisionalLoadForFrame) | 454 OnDidStartProvisionalLoadForFrame) |
455 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailProvisionalLoadWithError, | 455 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailProvisionalLoadWithError, |
456 OnDidFailProvisionalLoadWithError) | 456 OnDidFailProvisionalLoadWithError) |
457 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError, | 457 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError, |
458 OnDidFailLoadWithError) | 458 OnDidFailLoadWithError) |
459 IPC_MESSAGE_HANDLER_GENERIC(FrameHostMsg_DidCommitProvisionalLoad, | 459 IPC_MESSAGE_HANDLER_GENERIC(FrameHostMsg_DidCommitProvisionalLoad, |
460 OnDidCommitProvisionalLoad(msg)) | 460 OnDidCommitProvisionalLoad(msg)) |
461 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDropNavigation, OnDidDropNavigation) | 461 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDropNavigation, OnDidDropNavigation) |
| 462 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateState, OnUpdateState) |
462 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) | 463 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) |
463 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted, | 464 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted, |
464 OnDocumentOnLoadCompleted) | 465 OnDocumentOnLoadCompleted) |
465 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) | 466 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) |
466 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) | 467 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) |
467 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) | 468 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) |
468 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, | 469 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, |
469 OnJavaScriptExecuteResponse) | 470 OnJavaScriptExecuteResponse) |
470 IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse, | 471 IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse, |
471 OnVisualStateResponse) | 472 OnVisualStateResponse) |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 | 967 |
967 void RenderFrameHostImpl::OnDidDropNavigation() { | 968 void RenderFrameHostImpl::OnDidDropNavigation() { |
968 // At the end of Navigate(), the FrameTreeNode's DidStartLoading is called to | 969 // At the end of Navigate(), the FrameTreeNode's DidStartLoading is called to |
969 // force the spinner to start, even if the renderer didn't yet begin the load. | 970 // force the spinner to start, even if the renderer didn't yet begin the load. |
970 // If it turns out that the renderer dropped the navigation, the spinner needs | 971 // If it turns out that the renderer dropped the navigation, the spinner needs |
971 // to be turned off. | 972 // to be turned off. |
972 frame_tree_node_->DidStopLoading(); | 973 frame_tree_node_->DidStopLoading(); |
973 navigation_handle_.reset(); | 974 navigation_handle_.reset(); |
974 } | 975 } |
975 | 976 |
| 977 void RenderFrameHostImpl::OnUpdateState(const PageState& state) { |
| 978 // TODO(creis): Verify the state's ISN matches the last committed FNE. |
| 979 |
| 980 // Without this check, the renderer can trick the browser into using |
| 981 // filenames it can't access in a future session restore. |
| 982 // TODO(creis): Move CanAccessFilesOfPageState to RenderFrameHostImpl. |
| 983 if (!render_view_host_->CanAccessFilesOfPageState(state)) { |
| 984 bad_message::ReceivedBadMessage( |
| 985 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE); |
| 986 return; |
| 987 } |
| 988 |
| 989 delegate_->UpdateStateForFrame(this, state); |
| 990 } |
| 991 |
976 RenderWidgetHostImpl* RenderFrameHostImpl::GetRenderWidgetHost() { | 992 RenderWidgetHostImpl* RenderFrameHostImpl::GetRenderWidgetHost() { |
977 return render_widget_host_; | 993 return render_widget_host_; |
978 } | 994 } |
979 | 995 |
980 RenderWidgetHostView* RenderFrameHostImpl::GetView() { | 996 RenderWidgetHostView* RenderFrameHostImpl::GetView() { |
981 RenderFrameHostImpl* frame = this; | 997 RenderFrameHostImpl* frame = this; |
982 while (frame) { | 998 while (frame) { |
983 if (frame->render_widget_host_) | 999 if (frame->render_widget_host_) |
984 return frame->render_widget_host_->GetView(); | 1000 return frame->render_widget_host_->GetView(); |
985 frame = static_cast<RenderFrameHostImpl*>(frame->GetParent()); | 1001 frame = static_cast<RenderFrameHostImpl*>(frame->GetParent()); |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2338 *dst = src; | 2354 *dst = src; |
2339 | 2355 |
2340 if (src.routing_id != -1) | 2356 if (src.routing_id != -1) |
2341 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2357 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
2342 | 2358 |
2343 if (src.parent_routing_id != -1) | 2359 if (src.parent_routing_id != -1) |
2344 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2360 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
2345 } | 2361 } |
2346 | 2362 |
2347 } // namespace content | 2363 } // namespace content |
OLD | NEW |