| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 477 |
| 478 RenderFrameHostImpl::~RenderFrameHostImpl() { | 478 RenderFrameHostImpl::~RenderFrameHostImpl() { |
| 479 // Destroying navigation handle may call into delegates/observers, | 479 // Destroying navigation handle may call into delegates/observers, |
| 480 // so we do it early while |this| object is still in a sane state. | 480 // so we do it early while |this| object is still in a sane state. |
| 481 navigation_handle_.reset(); | 481 navigation_handle_.reset(); |
| 482 | 482 |
| 483 // Release the WebUI instances before all else as the WebUI may accesses the | 483 // Release the WebUI instances before all else as the WebUI may accesses the |
| 484 // RenderFrameHost during cleanup. | 484 // RenderFrameHost during cleanup. |
| 485 ClearAllWebUI(); | 485 ClearAllWebUI(); |
| 486 | 486 |
| 487 SetLastCommittedSiteUrl(GURL()); |
| 488 |
| 487 GetProcess()->RemoveRoute(routing_id_); | 489 GetProcess()->RemoveRoute(routing_id_); |
| 488 g_routing_id_frame_map.Get().erase( | 490 g_routing_id_frame_map.Get().erase( |
| 489 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); | 491 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); |
| 490 | 492 |
| 491 if (overlay_routing_token_) | 493 if (overlay_routing_token_) |
| 492 g_token_frame_map.Get().erase(*overlay_routing_token_); | 494 g_token_frame_map.Get().erase(*overlay_routing_token_); |
| 493 | 495 |
| 494 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 496 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 495 base::Bind(&NotifyRenderFrameDetachedOnIO, | 497 base::Bind(&NotifyRenderFrameDetachedOnIO, |
| 496 GetProcess()->GetID(), routing_id_)); | 498 GetProcess()->GetID(), routing_id_)); |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 frame_tree_node()->DidStartLoading(true, was_loading); | 1450 frame_tree_node()->DidStartLoading(true, was_loading); |
| 1449 } | 1451 } |
| 1450 pending_commit_ = false; | 1452 pending_commit_ = false; |
| 1451 } | 1453 } |
| 1452 | 1454 |
| 1453 // Find the appropriate NavigationHandle for this navigation. | 1455 // Find the appropriate NavigationHandle for this navigation. |
| 1454 std::unique_ptr<NavigationHandleImpl> navigation_handle = | 1456 std::unique_ptr<NavigationHandleImpl> navigation_handle = |
| 1455 TakeNavigationHandleForCommit(validated_params); | 1457 TakeNavigationHandleForCommit(validated_params); |
| 1456 DCHECK(navigation_handle); | 1458 DCHECK(navigation_handle); |
| 1457 | 1459 |
| 1460 // Update the site url if the navigation was successful and the page is not an |
| 1461 // interstitial. |
| 1462 if (validated_params.url_is_unreachable || |
| 1463 delegate_->GetAsInterstitialPage()) { |
| 1464 SetLastCommittedSiteUrl(GURL()); |
| 1465 } else { |
| 1466 SetLastCommittedSiteUrl(validated_params.url); |
| 1467 } |
| 1468 |
| 1458 // PlzNavigate sends searchable form data in the BeginNavigation message | 1469 // PlzNavigate sends searchable form data in the BeginNavigation message |
| 1459 // while non-PlzNavigate sends it in the DidCommitProvisionalLoad message. | 1470 // while non-PlzNavigate sends it in the DidCommitProvisionalLoad message. |
| 1460 // Update |navigation_handle| if necessary. | 1471 // Update |navigation_handle| if necessary. |
| 1461 if (!IsBrowserSideNavigationEnabled() && | 1472 if (!IsBrowserSideNavigationEnabled() && |
| 1462 !validated_params.searchable_form_url.is_empty()) { | 1473 !validated_params.searchable_form_url.is_empty()) { |
| 1463 navigation_handle->set_searchable_form_url( | 1474 navigation_handle->set_searchable_form_url( |
| 1464 validated_params.searchable_form_url); | 1475 validated_params.searchable_form_url); |
| 1465 navigation_handle->set_searchable_form_encoding( | 1476 navigation_handle->set_searchable_form_encoding( |
| 1466 validated_params.searchable_form_encoding); | 1477 validated_params.searchable_form_encoding); |
| 1467 | 1478 |
| (...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3920 false); // is_form_submission | 3931 false); // is_form_submission |
| 3921 } | 3932 } |
| 3922 | 3933 |
| 3923 void RenderFrameHostImpl::BeforeUnloadTimeout() { | 3934 void RenderFrameHostImpl::BeforeUnloadTimeout() { |
| 3924 if (render_view_host_->GetDelegate()->ShouldIgnoreUnresponsiveRenderer()) | 3935 if (render_view_host_->GetDelegate()->ShouldIgnoreUnresponsiveRenderer()) |
| 3925 return; | 3936 return; |
| 3926 | 3937 |
| 3927 SimulateBeforeUnloadAck(); | 3938 SimulateBeforeUnloadAck(); |
| 3928 } | 3939 } |
| 3929 | 3940 |
| 3941 void RenderFrameHostImpl::SetLastCommittedSiteUrl(const GURL& url) { |
| 3942 GURL site_url = |
| 3943 url.is_empty() ? GURL() |
| 3944 : SiteInstance::GetSiteForURL(frame_tree_node_->navigator() |
| 3945 ->GetController() |
| 3946 ->GetBrowserContext(), |
| 3947 url); |
| 3948 |
| 3949 if (last_committed_site_url_ == site_url) |
| 3950 return; |
| 3951 |
| 3952 if (!last_committed_site_url_.is_empty()) { |
| 3953 RenderProcessHostImpl::RemoveFrameWithSite( |
| 3954 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
| 3955 GetProcess(), last_committed_site_url_); |
| 3956 } |
| 3957 |
| 3958 last_committed_site_url_ = site_url; |
| 3959 |
| 3960 if (!last_committed_site_url_.is_empty()) { |
| 3961 RenderProcessHostImpl::AddFrameWithSite( |
| 3962 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
| 3963 GetProcess(), last_committed_site_url_); |
| 3964 } |
| 3965 } |
| 3966 |
| 3930 #if defined(OS_ANDROID) | 3967 #if defined(OS_ANDROID) |
| 3931 | 3968 |
| 3932 class RenderFrameHostImpl::JavaInterfaceProvider | 3969 class RenderFrameHostImpl::JavaInterfaceProvider |
| 3933 : public service_manager::mojom::InterfaceProvider { | 3970 : public service_manager::mojom::InterfaceProvider { |
| 3934 public: | 3971 public: |
| 3935 using BindCallback = | 3972 using BindCallback = |
| 3936 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>; | 3973 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>; |
| 3937 | 3974 |
| 3938 JavaInterfaceProvider( | 3975 JavaInterfaceProvider( |
| 3939 const BindCallback& bind_callback, | 3976 const BindCallback& bind_callback, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3984 } | 4021 } |
| 3985 | 4022 |
| 3986 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 4023 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
| 3987 const std::string& interface_name, | 4024 const std::string& interface_name, |
| 3988 mojo::ScopedMessagePipeHandle pipe) { | 4025 mojo::ScopedMessagePipeHandle pipe) { |
| 3989 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 4026 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
| 3990 } | 4027 } |
| 3991 #endif | 4028 #endif |
| 3992 | 4029 |
| 3993 } // namespace content | 4030 } // namespace content |
| OLD | NEW |