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 2451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3919 false); // is_form_submission | 3930 false); // is_form_submission |
3920 } | 3931 } |
3921 | 3932 |
3922 void RenderFrameHostImpl::BeforeUnloadTimeout() { | 3933 void RenderFrameHostImpl::BeforeUnloadTimeout() { |
3923 if (render_view_host_->GetDelegate()->ShouldIgnoreUnresponsiveRenderer()) | 3934 if (render_view_host_->GetDelegate()->ShouldIgnoreUnresponsiveRenderer()) |
3924 return; | 3935 return; |
3925 | 3936 |
3926 SimulateBeforeUnloadAck(); | 3937 SimulateBeforeUnloadAck(); |
3927 } | 3938 } |
3928 | 3939 |
| 3940 void RenderFrameHostImpl::SetLastCommittedSiteUrl(const GURL& url) { |
| 3941 GURL site_url = |
| 3942 url.is_empty() ? GURL() |
| 3943 : SiteInstance::GetSiteForURL(frame_tree_node_->navigator() |
| 3944 ->GetController() |
| 3945 ->GetBrowserContext(), |
| 3946 url); |
| 3947 |
| 3948 if (last_committed_site_url_ == site_url) |
| 3949 return; |
| 3950 |
| 3951 if (!last_committed_site_url_.is_empty()) { |
| 3952 RenderProcessHostImpl::RemoveFrameWithSite( |
| 3953 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
| 3954 GetProcess(), last_committed_site_url_); |
| 3955 } |
| 3956 |
| 3957 last_committed_site_url_ = site_url; |
| 3958 |
| 3959 if (!last_committed_site_url_.is_empty()) { |
| 3960 RenderProcessHostImpl::AddFrameWithSite( |
| 3961 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
| 3962 GetProcess(), last_committed_site_url_); |
| 3963 } |
| 3964 } |
| 3965 |
3929 #if defined(OS_ANDROID) | 3966 #if defined(OS_ANDROID) |
3930 | 3967 |
3931 class RenderFrameHostImpl::JavaInterfaceProvider | 3968 class RenderFrameHostImpl::JavaInterfaceProvider |
3932 : public service_manager::mojom::InterfaceProvider { | 3969 : public service_manager::mojom::InterfaceProvider { |
3933 public: | 3970 public: |
3934 using BindCallback = | 3971 using BindCallback = |
3935 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>; | 3972 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>; |
3936 | 3973 |
3937 JavaInterfaceProvider( | 3974 JavaInterfaceProvider( |
3938 const BindCallback& bind_callback, | 3975 const BindCallback& bind_callback, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3983 } | 4020 } |
3984 | 4021 |
3985 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 4022 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
3986 const std::string& interface_name, | 4023 const std::string& interface_name, |
3987 mojo::ScopedMessagePipeHandle pipe) { | 4024 mojo::ScopedMessagePipeHandle pipe) { |
3988 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 4025 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
3989 } | 4026 } |
3990 #endif | 4027 #endif |
3991 | 4028 |
3992 } // namespace content | 4029 } // namespace content |
OLD | NEW |