| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // and so no tracing is done. | 341 // and so no tracing is done. |
| 342 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 342 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
| 343 "navigation", "Navigation timeToNetworkStack", | 343 "navigation", "Navigation timeToNetworkStack", |
| 344 frame_tree_node->navigation_request()->navigation_handle(), | 344 frame_tree_node->navigation_request()->navigation_handle(), |
| 345 navigation_start.ToInternalValue(), | 345 navigation_start.ToInternalValue(), |
| 346 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); | 346 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } else { | 349 } else { |
| 350 RenderFrameHostImpl* dest_render_frame_host = | 350 RenderFrameHostImpl* dest_render_frame_host = |
| 351 frame_tree_node->render_manager()->Navigate(dest_url, frame_entry, | 351 frame_tree_node->render_manager()->Navigate( |
| 352 entry); | 352 dest_url, frame_entry, entry, |
| 353 reload_type != NavigationController::NO_RELOAD); |
| 353 if (!dest_render_frame_host) | 354 if (!dest_render_frame_host) |
| 354 return false; // Unable to create the desired RenderFrameHost. | 355 return false; // Unable to create the desired RenderFrameHost. |
| 355 | 356 |
| 356 // Make sure no code called via RFHM::Navigate clears the pending entry. | 357 // Make sure no code called via RFHM::Navigate clears the pending entry. |
| 357 if (is_pending_entry) | 358 if (is_pending_entry) |
| 358 CHECK_EQ(controller_->GetPendingEntry(), &entry); | 359 CHECK_EQ(controller_->GetPendingEntry(), &entry); |
| 359 | 360 |
| 360 // For security, we should never send non-Web-UI URLs to a Web UI renderer. | 361 // For security, we should never send non-Web-UI URLs to a Web UI renderer. |
| 361 // Double check that here. | 362 // Double check that here. |
| 362 CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url); | 363 CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url); |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 navigation_request->CreateNavigationHandle(entry.GetUniqueID()); | 1015 navigation_request->CreateNavigationHandle(entry.GetUniqueID()); |
| 1015 | 1016 |
| 1016 // Have the current renderer execute its beforeunload event if needed. If it | 1017 // Have the current renderer execute its beforeunload event if needed. If it |
| 1017 // is not needed (when beforeunload dispatch is not needed or this navigation | 1018 // is not needed (when beforeunload dispatch is not needed or this navigation |
| 1018 // is synchronous and same-site) then NavigationRequest::BeginNavigation | 1019 // is synchronous and same-site) then NavigationRequest::BeginNavigation |
| 1019 // should be directly called instead. | 1020 // should be directly called instead. |
| 1020 if (should_dispatch_beforeunload && | 1021 if (should_dispatch_beforeunload && |
| 1021 ShouldMakeNetworkRequestForURL( | 1022 ShouldMakeNetworkRequestForURL( |
| 1022 navigation_request->common_params().url)) { | 1023 navigation_request->common_params().url)) { |
| 1023 navigation_request->SetWaitingForRendererResponse(); | 1024 navigation_request->SetWaitingForRendererResponse(); |
| 1024 frame_tree_node->current_frame_host()->DispatchBeforeUnload(true); | 1025 frame_tree_node->current_frame_host()->DispatchBeforeUnload( |
| 1026 true, reload_type != NavigationController::NO_RELOAD); |
| 1025 } else { | 1027 } else { |
| 1026 navigation_request->BeginNavigation(); | 1028 navigation_request->BeginNavigation(); |
| 1027 } | 1029 } |
| 1028 } | 1030 } |
| 1029 | 1031 |
| 1030 void NavigatorImpl::RecordNavigationMetrics( | 1032 void NavigatorImpl::RecordNavigationMetrics( |
| 1031 const LoadCommittedDetails& details, | 1033 const LoadCommittedDetails& details, |
| 1032 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 1034 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 1033 SiteInstance* site_instance) { | 1035 SiteInstance* site_instance) { |
| 1034 DCHECK(site_instance->HasProcess()); | 1036 DCHECK(site_instance->HasProcess()); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 if (pending_entry != controller_->GetVisibleEntry() || | 1165 if (pending_entry != controller_->GetVisibleEntry() || |
| 1164 !should_preserve_entry) { | 1166 !should_preserve_entry) { |
| 1165 controller_->DiscardPendingEntry(true); | 1167 controller_->DiscardPendingEntry(true); |
| 1166 | 1168 |
| 1167 // Also force the UI to refresh. | 1169 // Also force the UI to refresh. |
| 1168 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1170 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
| 1169 } | 1171 } |
| 1170 } | 1172 } |
| 1171 | 1173 |
| 1172 } // namespace content | 1174 } // namespace content |
| OLD | NEW |