| 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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 render_view_host_->GetWidget()->GetView()); | 954 render_view_host_->GetWidget()->GetView()); |
| 955 if (view) | 955 if (view) |
| 956 return view->AccessibilityGetNativeViewAccessible(); | 956 return view->AccessibilityGetNativeViewAccessible(); |
| 957 return NULL; | 957 return NULL; |
| 958 } | 958 } |
| 959 | 959 |
| 960 void RenderFrameHostImpl::RenderProcessGone(SiteInstanceImpl* site_instance) { | 960 void RenderFrameHostImpl::RenderProcessGone(SiteInstanceImpl* site_instance) { |
| 961 DCHECK_EQ(site_instance_.get(), site_instance); | 961 DCHECK_EQ(site_instance_.get(), site_instance); |
| 962 | 962 |
| 963 // The renderer process is gone, so this frame can no longer be loading. | 963 // The renderer process is gone, so this frame can no longer be loading. |
| 964 if (navigation_handle_) |
| 965 navigation_handle_->set_net_error_code(net::ERR_ABORTED); |
| 964 ResetLoadingState(); | 966 ResetLoadingState(); |
| 965 | 967 |
| 966 // Any future UpdateState or UpdateTitle messages from this or a recreated | 968 // Any future UpdateState or UpdateTitle messages from this or a recreated |
| 967 // process should be ignored until the next commit. | 969 // process should be ignored until the next commit. |
| 968 set_nav_entry_id(0); | 970 set_nav_entry_id(0); |
| 969 } | 971 } |
| 970 | 972 |
| 971 void RenderFrameHostImpl::ReportContentSecurityPolicyViolation( | 973 void RenderFrameHostImpl::ReportContentSecurityPolicyViolation( |
| 972 const CSPViolationParams& violation_params) { | 974 const CSPViolationParams& violation_params) { |
| 973 Send(new FrameMsg_ReportContentSecurityPolicyViolation(routing_id_, | 975 Send(new FrameMsg_ReportContentSecurityPolicyViolation(routing_id_, |
| (...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2887 Send(new FrameMsg_Stop(routing_id_)); | 2889 Send(new FrameMsg_Stop(routing_id_)); |
| 2888 } | 2890 } |
| 2889 | 2891 |
| 2890 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, | 2892 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, |
| 2891 bool is_reload) { | 2893 bool is_reload) { |
| 2892 DCHECK(for_navigation || !is_reload); | 2894 DCHECK(for_navigation || !is_reload); |
| 2893 | 2895 |
| 2894 if (IsBrowserSideNavigationEnabled() && !for_navigation) { | 2896 if (IsBrowserSideNavigationEnabled() && !for_navigation) { |
| 2895 // Cancel any pending navigations, to avoid their navigation commit/fail | 2897 // Cancel any pending navigations, to avoid their navigation commit/fail |
| 2896 // event from wiping out the is_waiting_for_beforeunload_ack_ state. | 2898 // event from wiping out the is_waiting_for_beforeunload_ack_ state. |
| 2899 if (frame_tree_node_->navigation_request() && |
| 2900 frame_tree_node_->navigation_request()->navigation_handle()) { |
| 2901 frame_tree_node_->navigation_request() |
| 2902 ->navigation_handle() |
| 2903 ->set_net_error_code(net::ERR_ABORTED); |
| 2904 } |
| 2897 frame_tree_node_->ResetNavigationRequest(false, true); | 2905 frame_tree_node_->ResetNavigationRequest(false, true); |
| 2898 } | 2906 } |
| 2899 | 2907 |
| 2900 // TODO(creis): Support beforeunload on subframes. For now just pretend that | 2908 // TODO(creis): Support beforeunload on subframes. For now just pretend that |
| 2901 // the handler ran and allowed the navigation to proceed. | 2909 // the handler ran and allowed the navigation to proceed. |
| 2902 if (!ShouldDispatchBeforeUnload()) { | 2910 if (!ShouldDispatchBeforeUnload()) { |
| 2903 DCHECK(!(IsBrowserSideNavigationEnabled() && for_navigation)); | 2911 DCHECK(!(IsBrowserSideNavigationEnabled() && for_navigation)); |
| 2904 frame_tree_node_->render_manager()->OnBeforeUnloadACK( | 2912 frame_tree_node_->render_manager()->OnBeforeUnloadACK( |
| 2905 for_navigation, true, base::TimeTicks::Now()); | 2913 for_navigation, true, base::TimeTicks::Now()); |
| 2906 return; | 2914 return; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3117 ResetWaitingState(); | 3125 ResetWaitingState(); |
| 3118 | 3126 |
| 3119 Send(new FrameMsg_FailedNavigation(routing_id_, common_params, request_params, | 3127 Send(new FrameMsg_FailedNavigation(routing_id_, common_params, request_params, |
| 3120 has_stale_copy_in_cache, error_code)); | 3128 has_stale_copy_in_cache, error_code)); |
| 3121 | 3129 |
| 3122 RenderFrameDevToolsAgentHost::OnFailedNavigation( | 3130 RenderFrameDevToolsAgentHost::OnFailedNavigation( |
| 3123 this, common_params, begin_params, static_cast<net::Error>(error_code)); | 3131 this, common_params, begin_params, static_cast<net::Error>(error_code)); |
| 3124 | 3132 |
| 3125 // An error page is expected to commit, hence why is_loading_ is set to true. | 3133 // An error page is expected to commit, hence why is_loading_ is set to true. |
| 3126 is_loading_ = true; | 3134 is_loading_ = true; |
| 3135 if (navigation_handle_) |
| 3136 DCHECK_NE(net::OK, navigation_handle_->GetNetErrorCode()); |
| 3127 frame_tree_node_->ResetNavigationRequest(true, true); | 3137 frame_tree_node_->ResetNavigationRequest(true, true); |
| 3128 } | 3138 } |
| 3129 | 3139 |
| 3130 void RenderFrameHostImpl::SetUpMojoIfNeeded() { | 3140 void RenderFrameHostImpl::SetUpMojoIfNeeded() { |
| 3131 if (interface_registry_.get()) | 3141 if (interface_registry_.get()) |
| 3132 return; | 3142 return; |
| 3133 | 3143 |
| 3134 associated_registry_ = base::MakeUnique<AssociatedInterfaceRegistryImpl>(); | 3144 associated_registry_ = base::MakeUnique<AssociatedInterfaceRegistryImpl>(); |
| 3135 interface_registry_ = base::MakeUnique<service_manager::BinderRegistry>(); | 3145 interface_registry_ = base::MakeUnique<service_manager::BinderRegistry>(); |
| 3136 | 3146 |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3934 } | 3944 } |
| 3935 | 3945 |
| 3936 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 3946 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
| 3937 const std::string& interface_name, | 3947 const std::string& interface_name, |
| 3938 mojo::ScopedMessagePipeHandle pipe) { | 3948 mojo::ScopedMessagePipeHandle pipe) { |
| 3939 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 3949 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
| 3940 } | 3950 } |
| 3941 #endif | 3951 #endif |
| 3942 | 3952 |
| 3943 } // namespace content | 3953 } // namespace content |
| OLD | NEW |