| 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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) | 875 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) |
| 876 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) | 876 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) |
| 877 #endif | 877 #endif |
| 878 #if defined(OS_ANDROID) | 878 #if defined(OS_ANDROID) |
| 879 IPC_MESSAGE_HANDLER(FrameHostMsg_NavigationHandledByEmbedder, | 879 IPC_MESSAGE_HANDLER(FrameHostMsg_NavigationHandledByEmbedder, |
| 880 OnNavigationHandledByEmbedder) | 880 OnNavigationHandledByEmbedder) |
| 881 #endif | 881 #endif |
| 882 IPC_MESSAGE_HANDLER(FrameHostMsg_RequestOverlayRoutingToken, | 882 IPC_MESSAGE_HANDLER(FrameHostMsg_RequestOverlayRoutingToken, |
| 883 OnRequestOverlayRoutingToken) | 883 OnRequestOverlayRoutingToken) |
| 884 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow) | 884 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow) |
| 885 IPC_MESSAGE_HANDLER(FrameHostMsg_StreamHandleConsumed, |
| 886 OnStreamHandleConsumed) |
| 885 IPC_END_MESSAGE_MAP() | 887 IPC_END_MESSAGE_MAP() |
| 886 | 888 |
| 887 // No further actions here, since we may have been deleted. | 889 // No further actions here, since we may have been deleted. |
| 888 return handled; | 890 return handled; |
| 889 } | 891 } |
| 890 | 892 |
| 891 void RenderFrameHostImpl::OnAssociatedInterfaceRequest( | 893 void RenderFrameHostImpl::OnAssociatedInterfaceRequest( |
| 892 const std::string& interface_name, | 894 const std::string& interface_name, |
| 893 mojo::ScopedInterfaceEndpointHandle handle) { | 895 mojo::ScopedInterfaceEndpointHandle handle) { |
| 894 if (associated_registry_->CanBindRequest(interface_name)) { | 896 if (associated_registry_->CanBindRequest(interface_name)) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 } | 980 } |
| 979 | 981 |
| 980 void RenderFrameHostImpl::RenderProcessGone(SiteInstanceImpl* site_instance) { | 982 void RenderFrameHostImpl::RenderProcessGone(SiteInstanceImpl* site_instance) { |
| 981 DCHECK_EQ(site_instance_.get(), site_instance); | 983 DCHECK_EQ(site_instance_.get(), site_instance); |
| 982 | 984 |
| 983 // The renderer process is gone, so this frame can no longer be loading. | 985 // The renderer process is gone, so this frame can no longer be loading. |
| 984 if (navigation_handle_) | 986 if (navigation_handle_) |
| 985 navigation_handle_->set_net_error_code(net::ERR_ABORTED); | 987 navigation_handle_->set_net_error_code(net::ERR_ABORTED); |
| 986 ResetLoadingState(); | 988 ResetLoadingState(); |
| 987 | 989 |
| 990 // The renderer process is gone, so the |stream_handle_| will no longer be |
| 991 // used. It can be released. |
| 992 // TODO(clamy): Remove this when we switch to Mojo streams. |
| 993 stream_handle_.reset(); |
| 994 |
| 988 // Any future UpdateState or UpdateTitle messages from this or a recreated | 995 // Any future UpdateState or UpdateTitle messages from this or a recreated |
| 989 // process should be ignored until the next commit. | 996 // process should be ignored until the next commit. |
| 990 set_nav_entry_id(0); | 997 set_nav_entry_id(0); |
| 991 } | 998 } |
| 992 | 999 |
| 993 void RenderFrameHostImpl::ReportContentSecurityPolicyViolation( | 1000 void RenderFrameHostImpl::ReportContentSecurityPolicyViolation( |
| 994 const CSPViolationParams& violation_params) { | 1001 const CSPViolationParams& violation_params) { |
| 995 Send(new FrameMsg_ReportContentSecurityPolicyViolation(routing_id_, | 1002 Send(new FrameMsg_ReportContentSecurityPolicyViolation(routing_id_, |
| 996 violation_params)); | 1003 violation_params)); |
| 997 } | 1004 } |
| (...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3175 } | 3182 } |
| 3176 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, commit_data, | 3183 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, commit_data, |
| 3177 common_params, request_params)); | 3184 common_params, request_params)); |
| 3178 | 3185 |
| 3179 // If a network request was made, update the Previews state. | 3186 // If a network request was made, update the Previews state. |
| 3180 if (ShouldMakeNetworkRequestForURL(common_params.url) && | 3187 if (ShouldMakeNetworkRequestForURL(common_params.url) && |
| 3181 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) { | 3188 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) { |
| 3182 last_navigation_previews_state_ = common_params.previews_state; | 3189 last_navigation_previews_state_ = common_params.previews_state; |
| 3183 } | 3190 } |
| 3184 | 3191 |
| 3185 // TODO(clamy): Release the stream handle once the renderer has finished | 3192 // Released in OnStreamHandleConsumed(). |
| 3186 // reading it. | |
| 3187 stream_handle_ = std::move(body); | 3193 stream_handle_ = std::move(body); |
| 3188 | 3194 |
| 3189 // When navigating to a debug url, no commit is expected from the | 3195 // When navigating to a debug url, no commit is expected from the |
| 3190 // RenderFrameHost, nor should the throbber start. The NavigationRequest is | 3196 // RenderFrameHost, nor should the throbber start. The NavigationRequest is |
| 3191 // also not stored in the FrameTreeNode. Therefore do not reset it, as this | 3197 // also not stored in the FrameTreeNode. Therefore do not reset it, as this |
| 3192 // could cancel an existing pending navigation. | 3198 // could cancel an existing pending navigation. |
| 3193 if (!IsRendererDebugURL(common_params.url)) { | 3199 if (!IsRendererDebugURL(common_params.url)) { |
| 3194 pending_commit_ = true; | 3200 pending_commit_ = true; |
| 3195 is_loading_ = true; | 3201 is_loading_ = true; |
| 3196 } | 3202 } |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4044 | 4050 |
| 4045 last_committed_site_url_ = site_url; | 4051 last_committed_site_url_ = site_url; |
| 4046 | 4052 |
| 4047 if (!last_committed_site_url_.is_empty()) { | 4053 if (!last_committed_site_url_.is_empty()) { |
| 4048 RenderProcessHostImpl::AddFrameWithSite( | 4054 RenderProcessHostImpl::AddFrameWithSite( |
| 4049 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), | 4055 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
| 4050 GetProcess(), last_committed_site_url_); | 4056 GetProcess(), last_committed_site_url_); |
| 4051 } | 4057 } |
| 4052 } | 4058 } |
| 4053 | 4059 |
| 4060 void RenderFrameHostImpl::OnStreamHandleConsumed(const GURL& stream_url) { |
| 4061 if (stream_handle_ && stream_handle_->GetURL() == stream_url) |
| 4062 stream_handle_.reset(); |
| 4063 } |
| 4064 |
| 4054 #if defined(OS_ANDROID) | 4065 #if defined(OS_ANDROID) |
| 4055 | 4066 |
| 4056 class RenderFrameHostImpl::JavaInterfaceProvider | 4067 class RenderFrameHostImpl::JavaInterfaceProvider |
| 4057 : public service_manager::mojom::InterfaceProvider { | 4068 : public service_manager::mojom::InterfaceProvider { |
| 4058 public: | 4069 public: |
| 4059 using BindCallback = | 4070 using BindCallback = |
| 4060 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>; | 4071 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>; |
| 4061 | 4072 |
| 4062 JavaInterfaceProvider( | 4073 JavaInterfaceProvider( |
| 4063 const BindCallback& bind_callback, | 4074 const BindCallback& bind_callback, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4108 } | 4119 } |
| 4109 | 4120 |
| 4110 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 4121 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
| 4111 const std::string& interface_name, | 4122 const std::string& interface_name, |
| 4112 mojo::ScopedMessagePipeHandle pipe) { | 4123 mojo::ScopedMessagePipeHandle pipe) { |
| 4113 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 4124 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
| 4114 } | 4125 } |
| 4115 #endif | 4126 #endif |
| 4116 | 4127 |
| 4117 } // namespace content | 4128 } // namespace content |
| OLD | NEW |