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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateToUniqueOrigin, | 777 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateToUniqueOrigin, |
778 OnUpdateToUniqueOrigin) | 778 OnUpdateToUniqueOrigin) |
779 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeSandboxFlags, | 779 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeSandboxFlags, |
780 OnDidChangeSandboxFlags) | 780 OnDidChangeSandboxFlags) |
781 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeFrameOwnerProperties, | 781 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeFrameOwnerProperties, |
782 OnDidChangeFrameOwnerProperties) | 782 OnDidChangeFrameOwnerProperties) |
783 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 783 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
784 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 784 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
785 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 785 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
786 OnBeginNavigation) | 786 OnBeginNavigation) |
| 787 IPC_MESSAGE_HANDLER(FrameHostMsg_AbortNavigation, OnAbortNavigation) |
787 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) | 788 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) |
788 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 789 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
789 OnTextSurroundingSelectionResponse) | 790 OnTextSurroundingSelectionResponse) |
790 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 791 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
791 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 792 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
792 OnAccessibilityLocationChanges) | 793 OnAccessibilityLocationChanges) |
793 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, | 794 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, |
794 OnAccessibilityFindInPageResult) | 795 OnAccessibilityFindInPageResult) |
795 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_ChildFrameHitTestResult, | 796 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_ChildFrameHitTestResult, |
796 OnAccessibilityChildFrameHitTestResult) | 797 OnAccessibilityChildFrameHitTestResult) |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 if (waiting_for_init_) { | 2038 if (waiting_for_init_) { |
2038 pendinging_navigate_ = base::MakeUnique<PendingNavigation>( | 2039 pendinging_navigate_ = base::MakeUnique<PendingNavigation>( |
2039 validated_params, validated_begin_params); | 2040 validated_params, validated_begin_params); |
2040 return; | 2041 return; |
2041 } | 2042 } |
2042 | 2043 |
2043 frame_tree_node()->navigator()->OnBeginNavigation( | 2044 frame_tree_node()->navigator()->OnBeginNavigation( |
2044 frame_tree_node(), validated_params, validated_begin_params); | 2045 frame_tree_node(), validated_params, validated_begin_params); |
2045 } | 2046 } |
2046 | 2047 |
| 2048 void RenderFrameHostImpl::OnAbortNavigation() { |
| 2049 if (!IsBrowserSideNavigationEnabled()) { |
| 2050 NOTREACHED(); |
| 2051 return; |
| 2052 } |
| 2053 if (!is_active()) |
| 2054 return; |
| 2055 frame_tree_node()->navigator()->OnAbortNavigation(frame_tree_node()); |
| 2056 } |
| 2057 |
2047 void RenderFrameHostImpl::OnDispatchLoad() { | 2058 void RenderFrameHostImpl::OnDispatchLoad() { |
2048 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); | 2059 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); |
2049 | 2060 |
2050 // Don't forward the load event if this RFH is pending deletion. This can | 2061 // Don't forward the load event if this RFH is pending deletion. This can |
2051 // happen in a race where this RenderFrameHost finishes loading just after | 2062 // happen in a race where this RenderFrameHost finishes loading just after |
2052 // the frame navigates away. See https://crbug.com/626802. | 2063 // the frame navigates away. See https://crbug.com/626802. |
2053 if (!is_active()) | 2064 if (!is_active()) |
2054 return; | 2065 return; |
2055 | 2066 |
2056 // Only frames with an out-of-process parent frame should be sending this | 2067 // Only frames with an out-of-process parent frame should be sending this |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 Send(new FrameMsg_Stop(routing_id_)); | 2646 Send(new FrameMsg_Stop(routing_id_)); |
2636 } | 2647 } |
2637 | 2648 |
2638 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, | 2649 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, |
2639 bool is_reload) { | 2650 bool is_reload) { |
2640 DCHECK(for_navigation || !is_reload); | 2651 DCHECK(for_navigation || !is_reload); |
2641 | 2652 |
2642 if (IsBrowserSideNavigationEnabled() && !for_navigation) { | 2653 if (IsBrowserSideNavigationEnabled() && !for_navigation) { |
2643 // Cancel any pending navigations, to avoid their navigation commit/fail | 2654 // Cancel any pending navigations, to avoid their navigation commit/fail |
2644 // event from wiping out the is_waiting_for_beforeunload_ack_ state. | 2655 // event from wiping out the is_waiting_for_beforeunload_ack_ state. |
2645 frame_tree_node_->ResetNavigationRequest(false); | 2656 frame_tree_node_->ResetNavigationRequest(false, true); |
2646 } | 2657 } |
2647 | 2658 |
2648 // TODO(creis): Support beforeunload on subframes. For now just pretend that | 2659 // TODO(creis): Support beforeunload on subframes. For now just pretend that |
2649 // the handler ran and allowed the navigation to proceed. | 2660 // the handler ran and allowed the navigation to proceed. |
2650 if (!ShouldDispatchBeforeUnload()) { | 2661 if (!ShouldDispatchBeforeUnload()) { |
2651 DCHECK(!(IsBrowserSideNavigationEnabled() && for_navigation)); | 2662 DCHECK(!(IsBrowserSideNavigationEnabled() && for_navigation)); |
2652 frame_tree_node_->render_manager()->OnBeforeUnloadACK( | 2663 frame_tree_node_->render_manager()->OnBeforeUnloadACK( |
2653 for_navigation, true, base::TimeTicks::Now()); | 2664 for_navigation, true, base::TimeTicks::Now()); |
2654 return; | 2665 return; |
2655 } | 2666 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2846 ResetWaitingState(); | 2857 ResetWaitingState(); |
2847 | 2858 |
2848 Send(new FrameMsg_FailedNavigation(routing_id_, common_params, request_params, | 2859 Send(new FrameMsg_FailedNavigation(routing_id_, common_params, request_params, |
2849 has_stale_copy_in_cache, error_code)); | 2860 has_stale_copy_in_cache, error_code)); |
2850 | 2861 |
2851 RenderFrameDevToolsAgentHost::OnFailedNavigation( | 2862 RenderFrameDevToolsAgentHost::OnFailedNavigation( |
2852 this, common_params, begin_params, static_cast<net::Error>(error_code)); | 2863 this, common_params, begin_params, static_cast<net::Error>(error_code)); |
2853 | 2864 |
2854 // An error page is expected to commit, hence why is_loading_ is set to true. | 2865 // An error page is expected to commit, hence why is_loading_ is set to true. |
2855 is_loading_ = true; | 2866 is_loading_ = true; |
2856 frame_tree_node_->ResetNavigationRequest(true); | 2867 frame_tree_node_->ResetNavigationRequest(true, true); |
2857 } | 2868 } |
2858 | 2869 |
2859 void RenderFrameHostImpl::SetUpMojoIfNeeded() { | 2870 void RenderFrameHostImpl::SetUpMojoIfNeeded() { |
2860 if (interface_registry_.get()) | 2871 if (interface_registry_.get()) |
2861 return; | 2872 return; |
2862 | 2873 |
2863 interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>( | 2874 interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>( |
2864 mojom::kNavigation_FrameSpec); | 2875 mojom::kNavigation_FrameSpec); |
2865 | 2876 |
2866 ServiceManagerConnection* service_manager_connection = | 2877 ServiceManagerConnection* service_manager_connection = |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3623 service_manager::mojom::InterfaceProviderPtr provider; | 3634 service_manager::mojom::InterfaceProviderPtr provider; |
3624 BindInterfaceRegistryForRenderFrameHost(mojo::MakeRequest(&provider), this); | 3635 BindInterfaceRegistryForRenderFrameHost(mojo::MakeRequest(&provider), this); |
3625 java_interfaces_.reset(new service_manager::InterfaceProvider); | 3636 java_interfaces_.reset(new service_manager::InterfaceProvider); |
3626 java_interfaces_->Bind(std::move(provider)); | 3637 java_interfaces_->Bind(std::move(provider)); |
3627 } | 3638 } |
3628 return java_interfaces_.get(); | 3639 return java_interfaces_.get(); |
3629 } | 3640 } |
3630 #endif | 3641 #endif |
3631 | 3642 |
3632 } // namespace content | 3643 } // namespace content |
OLD | NEW |