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/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // and so no tracing is done. | 329 // and so no tracing is done. |
330 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 330 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
331 "navigation", "Navigation timeToNetworkStack", | 331 "navigation", "Navigation timeToNetworkStack", |
332 frame_tree_node->navigation_request()->navigation_handle(), | 332 frame_tree_node->navigation_request()->navigation_handle(), |
333 navigation_start.ToInternalValue(), | 333 navigation_start.ToInternalValue(), |
334 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); | 334 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); |
335 } | 335 } |
336 | 336 |
337 } else { | 337 } else { |
338 RenderFrameHostImpl* dest_render_frame_host = | 338 RenderFrameHostImpl* dest_render_frame_host = |
339 frame_tree_node->render_manager()->Navigate(dest_url, frame_entry, | 339 frame_tree_node->render_manager()->Navigate( |
340 entry); | 340 dest_url, frame_entry, entry, |
| 341 reload_type != NavigationController::NO_RELOAD); |
341 if (!dest_render_frame_host) | 342 if (!dest_render_frame_host) |
342 return false; // Unable to create the desired RenderFrameHost. | 343 return false; // Unable to create the desired RenderFrameHost. |
343 | 344 |
344 // Make sure no code called via RFHM::Navigate clears the pending entry. | 345 // Make sure no code called via RFHM::Navigate clears the pending entry. |
345 if (is_pending_entry) | 346 if (is_pending_entry) |
346 CHECK_EQ(controller_->GetPendingEntry(), &entry); | 347 CHECK_EQ(controller_->GetPendingEntry(), &entry); |
347 | 348 |
348 // For security, we should never send non-Web-UI URLs to a Web UI renderer. | 349 // For security, we should never send non-Web-UI URLs to a Web UI renderer. |
349 // Double check that here. | 350 // Double check that here. |
350 CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url); | 351 CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url); |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 navigation_request->CreateNavigationHandle(entry.GetUniqueID()); | 999 navigation_request->CreateNavigationHandle(entry.GetUniqueID()); |
999 | 1000 |
1000 // Have the current renderer execute its beforeunload event if needed. If it | 1001 // Have the current renderer execute its beforeunload event if needed. If it |
1001 // is not needed (when beforeunload dispatch is not needed or this navigation | 1002 // is not needed (when beforeunload dispatch is not needed or this navigation |
1002 // is synchronous and same-site) then NavigationRequest::BeginNavigation | 1003 // is synchronous and same-site) then NavigationRequest::BeginNavigation |
1003 // should be directly called instead. | 1004 // should be directly called instead. |
1004 if (should_dispatch_beforeunload && | 1005 if (should_dispatch_beforeunload && |
1005 ShouldMakeNetworkRequestForURL( | 1006 ShouldMakeNetworkRequestForURL( |
1006 navigation_request->common_params().url)) { | 1007 navigation_request->common_params().url)) { |
1007 navigation_request->SetWaitingForRendererResponse(); | 1008 navigation_request->SetWaitingForRendererResponse(); |
1008 frame_tree_node->current_frame_host()->DispatchBeforeUnload(true); | 1009 frame_tree_node->current_frame_host()->DispatchBeforeUnload( |
| 1010 true, reload_type != NavigationController::NO_RELOAD); |
1009 } else { | 1011 } else { |
1010 navigation_request->BeginNavigation(); | 1012 navigation_request->BeginNavigation(); |
1011 } | 1013 } |
1012 } | 1014 } |
1013 | 1015 |
1014 void NavigatorImpl::RecordNavigationMetrics( | 1016 void NavigatorImpl::RecordNavigationMetrics( |
1015 const LoadCommittedDetails& details, | 1017 const LoadCommittedDetails& details, |
1016 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 1018 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
1017 SiteInstance* site_instance) { | 1019 SiteInstance* site_instance) { |
1018 DCHECK(site_instance->HasProcess()); | 1020 DCHECK(site_instance->HasProcess()); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 if (pending_entry != controller_->GetVisibleEntry() || | 1149 if (pending_entry != controller_->GetVisibleEntry() || |
1148 !should_preserve_entry) { | 1150 !should_preserve_entry) { |
1149 controller_->DiscardPendingEntry(true); | 1151 controller_->DiscardPendingEntry(true); |
1150 | 1152 |
1151 // Also force the UI to refresh. | 1153 // Also force the UI to refresh. |
1152 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1154 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
1153 } | 1155 } |
1154 } | 1156 } |
1155 | 1157 |
1156 } // namespace content | 1158 } // namespace content |
OLD | NEW |