| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 return false; // Unable to create the desired RenderFrameHost. | 337 return false; // Unable to create the desired RenderFrameHost. |
| 338 | 338 |
| 339 // Make sure no code called via RFHM::Navigate clears the pending entry. | 339 // Make sure no code called via RFHM::Navigate clears the pending entry. |
| 340 if (is_pending_entry) | 340 if (is_pending_entry) |
| 341 CHECK_EQ(controller_->GetPendingEntry(), &entry); | 341 CHECK_EQ(controller_->GetPendingEntry(), &entry); |
| 342 | 342 |
| 343 // For security, we should never send non-Web-UI URLs to a Web UI renderer. | 343 // For security, we should never send non-Web-UI URLs to a Web UI renderer. |
| 344 // Double check that here. | 344 // Double check that here. |
| 345 CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url); | 345 CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url); |
| 346 | 346 |
| 347 // In the case of a transfer navigation, set the destination RenderFrameHost |
| 348 // as loading. This ensures that the RenderFrameHost gets in a loading state |
| 349 // without emitting a spurious DidStartLoading notification at the |
| 350 // FrameTreeNode level (since the FrameTreeNode was already loading). Note |
| 351 // that this works both for a transfer to a different RenderFrameHost and in |
| 352 // the rare case where the navigation is transferred back to the same |
| 353 // RenderFrameHost. |
| 354 bool is_transfer = entry.transferred_global_request_id().child_id != -1; |
| 355 if (is_transfer) |
| 356 dest_render_frame_host->set_is_loading(true); |
| 357 |
| 347 // Navigate in the desired RenderFrameHost. | 358 // Navigate in the desired RenderFrameHost. |
| 348 // We can skip this step in the rare case that this is a transfer navigation | 359 // We can skip this step in the rare case that this is a transfer navigation |
| 349 // which began in the chosen RenderFrameHost, since the request has already | 360 // which began in the chosen RenderFrameHost, since the request has already |
| 350 // been issued. In that case, simply resume the response. | 361 // been issued. In that case, simply resume the response. |
| 351 bool is_transfer_to_same = | 362 bool is_transfer_to_same = is_transfer && |
| 352 entry.transferred_global_request_id().child_id != -1 && | 363 entry.transferred_global_request_id().child_id == |
| 353 entry.transferred_global_request_id().child_id == | 364 dest_render_frame_host->GetProcess()->GetID(); |
| 354 dest_render_frame_host->GetProcess()->GetID(); | |
| 355 if (!is_transfer_to_same) { | 365 if (!is_transfer_to_same) { |
| 356 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, | 366 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, |
| 357 entry.restore_type())); | 367 entry.restore_type())); |
| 358 // Create the navigation parameters. | 368 // Create the navigation parameters. |
| 359 FrameMsg_Navigate_Type::Value navigation_type = | 369 FrameMsg_Navigate_Type::Value navigation_type = |
| 360 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); | 370 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); |
| 361 dest_render_frame_host->Navigate( | 371 dest_render_frame_host->Navigate( |
| 362 entry.ConstructCommonNavigationParams(dest_url, dest_referrer, | 372 entry.ConstructCommonNavigationParams(dest_url, dest_referrer, |
| 363 navigation_type, lofi_state, | 373 navigation_type, lofi_state, |
| 364 navigation_start), | 374 navigation_start), |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 1053 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
| 1044 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 1054 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
| 1045 } | 1055 } |
| 1046 controller_->SetPendingEntry(std::move(entry)); | 1056 controller_->SetPendingEntry(std::move(entry)); |
| 1047 if (delegate_) | 1057 if (delegate_) |
| 1048 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1058 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
| 1049 } | 1059 } |
| 1050 } | 1060 } |
| 1051 | 1061 |
| 1052 } // namespace content | 1062 } // namespace content |
| OLD | NEW |