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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1446 frame_tree_node()->DidStartLoading(true, was_loading); | 1448 frame_tree_node()->DidStartLoading(true, was_loading); |
1447 } | 1449 } |
1448 pending_commit_ = false; | 1450 pending_commit_ = false; |
1449 } | 1451 } |
1450 | 1452 |
1451 // Find the appropriate NavigationHandle for this navigation. | 1453 // Find the appropriate NavigationHandle for this navigation. |
1452 std::unique_ptr<NavigationHandleImpl> navigation_handle = | 1454 std::unique_ptr<NavigationHandleImpl> navigation_handle = |
1453 TakeNavigationHandleForCommit(validated_params); | 1455 TakeNavigationHandleForCommit(validated_params); |
1454 DCHECK(navigation_handle); | 1456 DCHECK(navigation_handle); |
1455 | 1457 |
1458 // Update the site url if the navigation was successful. | |
1459 if (navigation_handle->GetNetErrorCode() == net::OK) | |
Charlie Reis
2017/05/18 00:58:34
NavigatorImpl::DidNavigate gates last_successful_u
clamy
2017/05/22 16:59:52
Done.
| |
1460 SetLastCommittedSiteUrl(navigation_handle->GetURL()); | |
1461 | |
1456 // PlzNavigate sends searchable form data in the BeginNavigation message | 1462 // PlzNavigate sends searchable form data in the BeginNavigation message |
1457 // while non-PlzNavigate sends it in the DidCommitProvisionalLoad message. | 1463 // while non-PlzNavigate sends it in the DidCommitProvisionalLoad message. |
1458 // Update |navigation_handle| if necessary. | 1464 // Update |navigation_handle| if necessary. |
1459 if (!IsBrowserSideNavigationEnabled() && | 1465 if (!IsBrowserSideNavigationEnabled() && |
1460 !validated_params.searchable_form_url.is_empty()) { | 1466 !validated_params.searchable_form_url.is_empty()) { |
1461 navigation_handle->set_searchable_form_url( | 1467 navigation_handle->set_searchable_form_url( |
1462 validated_params.searchable_form_url); | 1468 validated_params.searchable_form_url); |
1463 navigation_handle->set_searchable_form_encoding( | 1469 navigation_handle->set_searchable_form_encoding( |
1464 validated_params.searchable_form_encoding); | 1470 validated_params.searchable_form_encoding); |
1465 | 1471 |
(...skipping 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3909 false); // is_form_submission | 3915 false); // is_form_submission |
3910 } | 3916 } |
3911 | 3917 |
3912 void RenderFrameHostImpl::BeforeUnloadTimeout() { | 3918 void RenderFrameHostImpl::BeforeUnloadTimeout() { |
3913 if (render_view_host_->GetDelegate()->ShouldIgnoreUnresponsiveRenderer()) | 3919 if (render_view_host_->GetDelegate()->ShouldIgnoreUnresponsiveRenderer()) |
3914 return; | 3920 return; |
3915 | 3921 |
3916 SimulateBeforeUnloadAck(); | 3922 SimulateBeforeUnloadAck(); |
3917 } | 3923 } |
3918 | 3924 |
3925 void RenderFrameHostImpl::SetLastCommittedSiteUrl(const GURL& url) { | |
3926 BrowserContext* browser_context = | |
3927 frame_tree_node_->navigator()->GetController()->GetBrowserContext(); | |
3928 GURL site_url = SiteInstance::GetSiteForURL(browser_context, url); | |
3929 | |
3930 if (last_committed_site_url_ == url) | |
3931 return; | |
3932 | |
3933 if (!last_committed_site_url_.is_empty()) { | |
3934 RenderProcessHostImpl::RemoveFrameWithSite(browser_context, GetProcess(), | |
3935 last_committed_site_url_); | |
3936 } | |
3937 | |
3938 last_committed_site_url_ = site_url; | |
3939 | |
3940 if (!last_committed_site_url_.is_empty()) { | |
3941 RenderProcessHostImpl::AddFrameWithSite(browser_context, GetProcess(), | |
3942 last_committed_site_url_); | |
3943 } | |
3944 } | |
3945 | |
3919 #if defined(OS_ANDROID) | 3946 #if defined(OS_ANDROID) |
3920 | 3947 |
3921 class RenderFrameHostImpl::JavaInterfaceProvider | 3948 class RenderFrameHostImpl::JavaInterfaceProvider |
3922 : public service_manager::mojom::InterfaceProvider { | 3949 : public service_manager::mojom::InterfaceProvider { |
3923 public: | 3950 public: |
3924 JavaInterfaceProvider( | 3951 JavaInterfaceProvider( |
3925 const service_manager::BinderRegistry::Binder& bind_callback, | 3952 const service_manager::BinderRegistry::Binder& bind_callback, |
3926 service_manager::mojom::InterfaceProviderRequest request) | 3953 service_manager::mojom::InterfaceProviderRequest request) |
3927 : bind_callback_(bind_callback), binding_(this, std::move(request)) {} | 3954 : bind_callback_(bind_callback), binding_(this, std::move(request)) {} |
3928 ~JavaInterfaceProvider() override = default; | 3955 ~JavaInterfaceProvider() override = default; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3970 } | 3997 } |
3971 | 3998 |
3972 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 3999 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
3973 const std::string& interface_name, | 4000 const std::string& interface_name, |
3974 mojo::ScopedMessagePipeHandle pipe) { | 4001 mojo::ScopedMessagePipeHandle pipe) { |
3975 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 4002 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
3976 } | 4003 } |
3977 #endif | 4004 #endif |
3978 | 4005 |
3979 } // namespace content | 4006 } // namespace content |
OLD | NEW |