| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "content/public/common/url_constants.h" | 45 #include "content/public/common/url_constants.h" |
| 46 #include "net/base/net_errors.h" | 46 #include "net/base/net_errors.h" |
| 47 #include "url/gurl.h" | 47 #include "url/gurl.h" |
| 48 #include "url/url_constants.h" | 48 #include "url/url_constants.h" |
| 49 | 49 |
| 50 namespace content { | 50 namespace content { |
| 51 | 51 |
| 52 namespace { | 52 namespace { |
| 53 | 53 |
| 54 FrameMsg_Navigate_Type::Value GetNavigationType( | 54 FrameMsg_Navigate_Type::Value GetNavigationType( |
| 55 BrowserContext* browser_context, const NavigationEntryImpl& entry, | 55 BrowserContext* browser_context, |
| 56 NavigationController::ReloadType reload_type) { | 56 const NavigationEntryImpl& entry, |
| 57 ReloadType reload_type) { |
| 57 switch (reload_type) { | 58 switch (reload_type) { |
| 58 case NavigationController::RELOAD: | 59 case ReloadType::NORMAL: |
| 59 return FrameMsg_Navigate_Type::RELOAD; | 60 return FrameMsg_Navigate_Type::RELOAD; |
| 60 case NavigationController::RELOAD_MAIN_RESOURCE: | 61 case ReloadType::MAIN_RESOURCE: |
| 61 return FrameMsg_Navigate_Type::RELOAD_MAIN_RESOURCE; | 62 return FrameMsg_Navigate_Type::RELOAD_MAIN_RESOURCE; |
| 62 case NavigationController::RELOAD_BYPASSING_CACHE: | 63 case ReloadType::BYPASSING_CACHE: |
| 63 case NavigationController::RELOAD_DISABLE_LOFI_MODE: | 64 case ReloadType::DISABLE_LOFI_MODE: |
| 64 return FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE; | 65 return FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE; |
| 65 case NavigationController::RELOAD_ORIGINAL_REQUEST_URL: | 66 case ReloadType::ORIGINAL_REQUEST_URL: |
| 66 return FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; | 67 return FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
| 67 case NavigationController::NO_RELOAD: | 68 case ReloadType::NONE: |
| 68 break; // Fall through to rest of function. | 69 break; // Fall through to rest of function. |
| 69 } | 70 } |
| 70 | 71 |
| 71 // |RenderViewImpl::PopulateStateFromPendingNavigationParams| differentiates | 72 // |RenderViewImpl::PopulateStateFromPendingNavigationParams| differentiates |
| 72 // between |RESTORE_WITH_POST| and |RESTORE|. | 73 // between |RESTORE_WITH_POST| and |RESTORE|. |
| 73 if (entry.restore_type() == | 74 if (entry.restore_type() == RestoreType::LAST_SESSION_EXITED_CLEANLY) { |
| 74 NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY) { | |
| 75 if (entry.GetHasPostData()) | 75 if (entry.GetHasPostData()) |
| 76 return FrameMsg_Navigate_Type::RESTORE_WITH_POST; | 76 return FrameMsg_Navigate_Type::RESTORE_WITH_POST; |
| 77 return FrameMsg_Navigate_Type::RESTORE; | 77 return FrameMsg_Navigate_Type::RESTORE; |
| 78 } | 78 } |
| 79 | 79 |
| 80 return FrameMsg_Navigate_Type::NORMAL; | 80 return FrameMsg_Navigate_Type::NORMAL; |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace | 83 } // namespace |
| 84 | 84 |
| 85 struct NavigatorImpl::NavigationMetricsData { | 85 struct NavigatorImpl::NavigationMetricsData { |
| 86 NavigationMetricsData(base::TimeTicks start_time, | 86 NavigationMetricsData(base::TimeTicks start_time, |
| 87 GURL url, | 87 GURL url, |
| 88 NavigationEntryImpl::RestoreType restore_type) | 88 RestoreType restore_type) |
| 89 : start_time_(start_time), url_(url) { | 89 : start_time_(start_time), url_(url) { |
| 90 is_restoring_from_last_session_ = | 90 is_restoring_from_last_session_ = |
| 91 (restore_type == | 91 (restore_type == RestoreType::LAST_SESSION_EXITED_CLEANLY || |
| 92 NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY || | 92 restore_type == RestoreType::LAST_SESSION_CRASHED); |
| 93 restore_type == NavigationEntryImpl::RESTORE_LAST_SESSION_CRASHED); | |
| 94 } | 93 } |
| 95 | 94 |
| 96 base::TimeTicks start_time_; | 95 base::TimeTicks start_time_; |
| 97 GURL url_; | 96 GURL url_; |
| 98 bool is_restoring_from_last_session_; | 97 bool is_restoring_from_last_session_; |
| 99 base::TimeTicks url_job_start_time_; | 98 base::TimeTicks url_job_start_time_; |
| 100 base::TimeDelta before_unload_delay_; | 99 base::TimeDelta before_unload_delay_; |
| 101 }; | 100 }; |
| 102 | 101 |
| 103 NavigatorImpl::NavigatorImpl( | 102 NavigatorImpl::NavigatorImpl( |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 delegate_->DidFailLoadWithError( | 261 delegate_->DidFailLoadWithError( |
| 263 render_frame_host, url, error_code, | 262 render_frame_host, url, error_code, |
| 264 error_description, was_ignored_by_handler); | 263 error_description, was_ignored_by_handler); |
| 265 } | 264 } |
| 266 } | 265 } |
| 267 | 266 |
| 268 bool NavigatorImpl::NavigateToEntry( | 267 bool NavigatorImpl::NavigateToEntry( |
| 269 FrameTreeNode* frame_tree_node, | 268 FrameTreeNode* frame_tree_node, |
| 270 const FrameNavigationEntry& frame_entry, | 269 const FrameNavigationEntry& frame_entry, |
| 271 const NavigationEntryImpl& entry, | 270 const NavigationEntryImpl& entry, |
| 272 NavigationController::ReloadType reload_type, | 271 ReloadType reload_type, |
| 273 bool is_same_document_history_load, | 272 bool is_same_document_history_load, |
| 274 bool is_history_navigation_in_new_child, | 273 bool is_history_navigation_in_new_child, |
| 275 bool is_pending_entry, | 274 bool is_pending_entry, |
| 276 const scoped_refptr<ResourceRequestBodyImpl>& post_body) { | 275 const scoped_refptr<ResourceRequestBodyImpl>& post_body) { |
| 277 TRACE_EVENT0("browser,navigation", "NavigatorImpl::NavigateToEntry"); | 276 TRACE_EVENT0("browser,navigation", "NavigatorImpl::NavigateToEntry"); |
| 278 | 277 |
| 279 GURL dest_url = frame_entry.url(); | 278 GURL dest_url = frame_entry.url(); |
| 280 Referrer dest_referrer = frame_entry.referrer(); | 279 Referrer dest_referrer = frame_entry.referrer(); |
| 281 if (reload_type == | 280 if (reload_type == ReloadType::ORIGINAL_REQUEST_URL && |
| 282 NavigationController::ReloadType::RELOAD_ORIGINAL_REQUEST_URL && | |
| 283 entry.GetOriginalRequestURL().is_valid() && !entry.GetHasPostData()) { | 281 entry.GetOriginalRequestURL().is_valid() && !entry.GetHasPostData()) { |
| 284 // We may have been redirected when navigating to the current URL. | 282 // We may have been redirected when navigating to the current URL. |
| 285 // Use the URL the user originally intended to visit, if it's valid and if a | 283 // Use the URL the user originally intended to visit, if it's valid and if a |
| 286 // POST wasn't involved; the latter case avoids issues with sending data to | 284 // POST wasn't involved; the latter case avoids issues with sending data to |
| 287 // the wrong page. | 285 // the wrong page. |
| 288 dest_url = entry.GetOriginalRequestURL(); | 286 dest_url = entry.GetOriginalRequestURL(); |
| 289 dest_referrer = Referrer(); | 287 dest_referrer = Referrer(); |
| 290 } | 288 } |
| 291 | 289 |
| 292 // Don't attempt to navigate to non-empty invalid URLs. | 290 // Don't attempt to navigate to non-empty invalid URLs. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 314 TRACE_EVENT_SCOPE_GLOBAL, navigation_start.ToInternalValue()); | 312 TRACE_EVENT_SCOPE_GLOBAL, navigation_start.ToInternalValue()); |
| 315 | 313 |
| 316 // Determine if LoFi should be used for the navigation. | 314 // Determine if LoFi should be used for the navigation. |
| 317 LoFiState lofi_state = LOFI_UNSPECIFIED; | 315 LoFiState lofi_state = LOFI_UNSPECIFIED; |
| 318 if (!frame_tree_node->IsMainFrame()) { | 316 if (!frame_tree_node->IsMainFrame()) { |
| 319 // For subframes, use the state of the top-level frame. | 317 // For subframes, use the state of the top-level frame. |
| 320 lofi_state = frame_tree_node->frame_tree() | 318 lofi_state = frame_tree_node->frame_tree() |
| 321 ->root() | 319 ->root() |
| 322 ->current_frame_host() | 320 ->current_frame_host() |
| 323 ->last_navigation_lofi_state(); | 321 ->last_navigation_lofi_state(); |
| 324 } else if (reload_type == | 322 } else if (reload_type == ReloadType::DISABLE_LOFI_MODE) { |
| 325 NavigationController::ReloadType::RELOAD_DISABLE_LOFI_MODE) { | |
| 326 // Disable LoFi when asked for it explicitly. | 323 // Disable LoFi when asked for it explicitly. |
| 327 lofi_state = LOFI_OFF; | 324 lofi_state = LOFI_OFF; |
| 328 } | 325 } |
| 329 | 326 |
| 330 // PlzNavigate: the RenderFrameHosts are no longer asked to navigate. | 327 // PlzNavigate: the RenderFrameHosts are no longer asked to navigate. |
| 331 if (IsBrowserSideNavigationEnabled()) { | 328 if (IsBrowserSideNavigationEnabled()) { |
| 332 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, | 329 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, |
| 333 entry.restore_type())); | 330 entry.restore_type())); |
| 334 RequestNavigation(frame_tree_node, dest_url, dest_referrer, frame_entry, | 331 RequestNavigation(frame_tree_node, dest_url, dest_referrer, frame_entry, |
| 335 entry, reload_type, lofi_state, | 332 entry, reload_type, lofi_state, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 347 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 344 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
| 348 "navigation", "Navigation timeToNetworkStack", | 345 "navigation", "Navigation timeToNetworkStack", |
| 349 frame_tree_node->navigation_request()->navigation_handle(), | 346 frame_tree_node->navigation_request()->navigation_handle(), |
| 350 navigation_start.ToInternalValue(), | 347 navigation_start.ToInternalValue(), |
| 351 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); | 348 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); |
| 352 } | 349 } |
| 353 | 350 |
| 354 } else { | 351 } else { |
| 355 RenderFrameHostImpl* dest_render_frame_host = | 352 RenderFrameHostImpl* dest_render_frame_host = |
| 356 frame_tree_node->render_manager()->Navigate( | 353 frame_tree_node->render_manager()->Navigate( |
| 357 dest_url, frame_entry, entry, | 354 dest_url, frame_entry, entry, reload_type != ReloadType::NONE); |
| 358 reload_type != NavigationController::NO_RELOAD); | |
| 359 if (!dest_render_frame_host) | 355 if (!dest_render_frame_host) |
| 360 return false; // Unable to create the desired RenderFrameHost. | 356 return false; // Unable to create the desired RenderFrameHost. |
| 361 | 357 |
| 362 // Make sure no code called via RFHM::Navigate clears the pending entry. | 358 // Make sure no code called via RFHM::Navigate clears the pending entry. |
| 363 if (is_pending_entry) | 359 if (is_pending_entry) |
| 364 CHECK_EQ(controller_->GetPendingEntry(), &entry); | 360 CHECK_EQ(controller_->GetPendingEntry(), &entry); |
| 365 | 361 |
| 366 // For security, we should never send non-Web-UI URLs to a Web UI renderer. | 362 // For security, we should never send non-Web-UI URLs to a Web UI renderer. |
| 367 // Double check that here. | 363 // Double check that here. |
| 368 CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url); | 364 CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 // Notify observers about navigation. | 428 // Notify observers about navigation. |
| 433 if (delegate_ && is_pending_entry) | 429 if (delegate_ && is_pending_entry) |
| 434 delegate_->DidStartNavigationToPendingEntry(dest_url, reload_type); | 430 delegate_->DidStartNavigationToPendingEntry(dest_url, reload_type); |
| 435 | 431 |
| 436 return true; | 432 return true; |
| 437 } | 433 } |
| 438 | 434 |
| 439 bool NavigatorImpl::NavigateToPendingEntry( | 435 bool NavigatorImpl::NavigateToPendingEntry( |
| 440 FrameTreeNode* frame_tree_node, | 436 FrameTreeNode* frame_tree_node, |
| 441 const FrameNavigationEntry& frame_entry, | 437 const FrameNavigationEntry& frame_entry, |
| 442 NavigationController::ReloadType reload_type, | 438 ReloadType reload_type, |
| 443 bool is_same_document_history_load) { | 439 bool is_same_document_history_load) { |
| 444 return NavigateToEntry(frame_tree_node, frame_entry, | 440 return NavigateToEntry(frame_tree_node, frame_entry, |
| 445 *controller_->GetPendingEntry(), reload_type, | 441 *controller_->GetPendingEntry(), reload_type, |
| 446 is_same_document_history_load, false, true, nullptr); | 442 is_same_document_history_load, false, true, nullptr); |
| 447 } | 443 } |
| 448 | 444 |
| 449 bool NavigatorImpl::NavigateNewChildFrame( | 445 bool NavigatorImpl::NavigateNewChildFrame( |
| 450 RenderFrameHostImpl* render_frame_host, | 446 RenderFrameHostImpl* render_frame_host, |
| 451 const std::string& unique_name) { | 447 const std::string& unique_name) { |
| 452 NavigationEntryImpl* entry = | 448 NavigationEntryImpl* entry = |
| 453 controller_->GetEntryWithUniqueID(render_frame_host->nav_entry_id()); | 449 controller_->GetEntryWithUniqueID(render_frame_host->nav_entry_id()); |
| 454 if (!entry) | 450 if (!entry) |
| 455 return false; | 451 return false; |
| 456 | 452 |
| 457 // TODO(creis): Remove unique_name from the IPC, now that we can rely on the | 453 // TODO(creis): Remove unique_name from the IPC, now that we can rely on the |
| 458 // replication state. | 454 // replication state. |
| 459 DCHECK_EQ(render_frame_host->frame_tree_node()->unique_name(), unique_name); | 455 DCHECK_EQ(render_frame_host->frame_tree_node()->unique_name(), unique_name); |
| 460 FrameNavigationEntry* frame_entry = | 456 FrameNavigationEntry* frame_entry = |
| 461 entry->GetFrameEntry(render_frame_host->frame_tree_node()); | 457 entry->GetFrameEntry(render_frame_host->frame_tree_node()); |
| 462 if (!frame_entry) | 458 if (!frame_entry) |
| 463 return false; | 459 return false; |
| 464 | 460 |
| 465 return NavigateToEntry(render_frame_host->frame_tree_node(), *frame_entry, | 461 return NavigateToEntry(render_frame_host->frame_tree_node(), *frame_entry, |
| 466 *entry, NavigationControllerImpl::NO_RELOAD, false, | 462 *entry, ReloadType::NONE, false, true, false, nullptr); |
| 467 true, false, nullptr); | |
| 468 } | 463 } |
| 469 | 464 |
| 470 void NavigatorImpl::DidNavigate( | 465 void NavigatorImpl::DidNavigate( |
| 471 RenderFrameHostImpl* render_frame_host, | 466 RenderFrameHostImpl* render_frame_host, |
| 472 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 467 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
| 473 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); | 468 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); |
| 474 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); | 469 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); |
| 475 | 470 |
| 476 bool has_embedded_credentials = | 471 bool has_embedded_credentials = |
| 477 params.url.has_username() || params.url.has_password(); | 472 params.url.has_username() || params.url.has_password(); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 // scratch. This works because we do not depend on |frame_entry| being inside | 852 // scratch. This works because we do not depend on |frame_entry| being inside |
| 858 // |entry| during NavigateToEntry. This will go away when we shortcut this | 853 // |entry| during NavigateToEntry. This will go away when we shortcut this |
| 859 // further in https://crbug.com/536906. | 854 // further in https://crbug.com/536906. |
| 860 scoped_refptr<FrameNavigationEntry> frame_entry(entry->GetFrameEntry(node)); | 855 scoped_refptr<FrameNavigationEntry> frame_entry(entry->GetFrameEntry(node)); |
| 861 if (!frame_entry) { | 856 if (!frame_entry) { |
| 862 frame_entry = new FrameNavigationEntry( | 857 frame_entry = new FrameNavigationEntry( |
| 863 node->unique_name(), -1, -1, nullptr, | 858 node->unique_name(), -1, -1, nullptr, |
| 864 static_cast<SiteInstanceImpl*>(source_site_instance), dest_url, | 859 static_cast<SiteInstanceImpl*>(source_site_instance), dest_url, |
| 865 referrer_to_use, method, -1); | 860 referrer_to_use, method, -1); |
| 866 } | 861 } |
| 867 NavigateToEntry(node, *frame_entry, *entry.get(), | 862 NavigateToEntry(node, *frame_entry, *entry.get(), ReloadType::NONE, false, |
| 868 NavigationController::NO_RELOAD, false, false, false, | 863 false, false, post_body); |
| 869 post_body); | |
| 870 } | 864 } |
| 871 | 865 |
| 872 // PlzNavigate | 866 // PlzNavigate |
| 873 void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node, | 867 void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node, |
| 874 bool proceed) { | 868 bool proceed) { |
| 875 CHECK(IsBrowserSideNavigationEnabled()); | 869 CHECK(IsBrowserSideNavigationEnabled()); |
| 876 DCHECK(frame_tree_node); | 870 DCHECK(frame_tree_node); |
| 877 | 871 |
| 878 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); | 872 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); |
| 879 | 873 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 // Only stores the beforeunload delay if we're tracking a browser initiated | 1001 // Only stores the beforeunload delay if we're tracking a browser initiated |
| 1008 // navigation and it happened later than the navigation request. | 1002 // navigation and it happened later than the navigation request. |
| 1009 if (navigation_data_ && | 1003 if (navigation_data_ && |
| 1010 renderer_before_unload_start_time > navigation_data_->start_time_) { | 1004 renderer_before_unload_start_time > navigation_data_->start_time_) { |
| 1011 navigation_data_->before_unload_delay_ = | 1005 navigation_data_->before_unload_delay_ = |
| 1012 renderer_before_unload_end_time - renderer_before_unload_start_time; | 1006 renderer_before_unload_end_time - renderer_before_unload_start_time; |
| 1013 } | 1007 } |
| 1014 } | 1008 } |
| 1015 | 1009 |
| 1016 // PlzNavigate | 1010 // PlzNavigate |
| 1017 void NavigatorImpl::RequestNavigation( | 1011 void NavigatorImpl::RequestNavigation(FrameTreeNode* frame_tree_node, |
| 1018 FrameTreeNode* frame_tree_node, | 1012 const GURL& dest_url, |
| 1019 const GURL& dest_url, | 1013 const Referrer& dest_referrer, |
| 1020 const Referrer& dest_referrer, | 1014 const FrameNavigationEntry& frame_entry, |
| 1021 const FrameNavigationEntry& frame_entry, | 1015 const NavigationEntryImpl& entry, |
| 1022 const NavigationEntryImpl& entry, | 1016 ReloadType reload_type, |
| 1023 NavigationController::ReloadType reload_type, | 1017 LoFiState lofi_state, |
| 1024 LoFiState lofi_state, | 1018 bool is_same_document_history_load, |
| 1025 bool is_same_document_history_load, | 1019 bool is_history_navigation_in_new_child, |
| 1026 bool is_history_navigation_in_new_child, | 1020 base::TimeTicks navigation_start) { |
| 1027 base::TimeTicks navigation_start) { | |
| 1028 CHECK(IsBrowserSideNavigationEnabled()); | 1021 CHECK(IsBrowserSideNavigationEnabled()); |
| 1029 DCHECK(frame_tree_node); | 1022 DCHECK(frame_tree_node); |
| 1030 | 1023 |
| 1031 // This value must be set here because creating a NavigationRequest might | 1024 // This value must be set here because creating a NavigationRequest might |
| 1032 // change the renderer live/non-live status and change this result. | 1025 // change the renderer live/non-live status and change this result. |
| 1033 bool should_dispatch_beforeunload = | 1026 bool should_dispatch_beforeunload = |
| 1034 frame_tree_node->current_frame_host()->ShouldDispatchBeforeUnload(); | 1027 frame_tree_node->current_frame_host()->ShouldDispatchBeforeUnload(); |
| 1035 FrameMsg_Navigate_Type::Value navigation_type = | 1028 FrameMsg_Navigate_Type::Value navigation_type = |
| 1036 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); | 1029 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); |
| 1037 std::unique_ptr<NavigationRequest> scoped_request = | 1030 std::unique_ptr<NavigationRequest> scoped_request = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1063 | 1056 |
| 1064 // Have the current renderer execute its beforeunload event if needed. If it | 1057 // Have the current renderer execute its beforeunload event if needed. If it |
| 1065 // is not needed (when beforeunload dispatch is not needed or this navigation | 1058 // is not needed (when beforeunload dispatch is not needed or this navigation |
| 1066 // is synchronous and same-site) then NavigationRequest::BeginNavigation | 1059 // is synchronous and same-site) then NavigationRequest::BeginNavigation |
| 1067 // should be directly called instead. | 1060 // should be directly called instead. |
| 1068 if (should_dispatch_beforeunload && | 1061 if (should_dispatch_beforeunload && |
| 1069 ShouldMakeNetworkRequestForURL( | 1062 ShouldMakeNetworkRequestForURL( |
| 1070 navigation_request->common_params().url)) { | 1063 navigation_request->common_params().url)) { |
| 1071 navigation_request->SetWaitingForRendererResponse(); | 1064 navigation_request->SetWaitingForRendererResponse(); |
| 1072 frame_tree_node->current_frame_host()->DispatchBeforeUnload( | 1065 frame_tree_node->current_frame_host()->DispatchBeforeUnload( |
| 1073 true, reload_type != NavigationController::NO_RELOAD); | 1066 true, reload_type != ReloadType::NONE); |
| 1074 } else { | 1067 } else { |
| 1075 navigation_request->BeginNavigation(); | 1068 navigation_request->BeginNavigation(); |
| 1076 } | 1069 } |
| 1077 } | 1070 } |
| 1078 | 1071 |
| 1079 void NavigatorImpl::RecordNavigationMetrics( | 1072 void NavigatorImpl::RecordNavigationMetrics( |
| 1080 const LoadCommittedDetails& details, | 1073 const LoadCommittedDetails& details, |
| 1081 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 1074 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 1082 SiteInstance* site_instance) { | 1075 SiteInstance* site_instance) { |
| 1083 DCHECK(site_instance->HasProcess()); | 1076 DCHECK(site_instance->HasProcess()); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 if (pending_entry != controller_->GetVisibleEntry() || | 1202 if (pending_entry != controller_->GetVisibleEntry() || |
| 1210 !should_preserve_entry) { | 1203 !should_preserve_entry) { |
| 1211 controller_->DiscardPendingEntry(true); | 1204 controller_->DiscardPendingEntry(true); |
| 1212 | 1205 |
| 1213 // Also force the UI to refresh. | 1206 // Also force the UI to refresh. |
| 1214 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1207 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
| 1215 } | 1208 } |
| 1216 } | 1209 } |
| 1217 | 1210 |
| 1218 } // namespace content | 1211 } // namespace content |
| OLD | NEW |