Chromium Code Reviews| 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 unique_name.size()); | 504 unique_name.size()); |
| 505 } | 505 } |
| 506 } | 506 } |
| 507 | 507 |
| 508 return NavigateToEntry(render_frame_host->frame_tree_node(), *frame_entry, | 508 return NavigateToEntry(render_frame_host->frame_tree_node(), *frame_entry, |
| 509 *entry, ReloadType::NONE, false, true, false, nullptr); | 509 *entry, ReloadType::NONE, false, true, false, nullptr); |
| 510 } | 510 } |
| 511 | 511 |
| 512 void NavigatorImpl::DidNavigate( | 512 void NavigatorImpl::DidNavigate( |
| 513 RenderFrameHostImpl* render_frame_host, | 513 RenderFrameHostImpl* render_frame_host, |
| 514 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 514 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 515 std::unique_ptr<NavigationHandleImpl> navigation_handle) { | |
| 515 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); | 516 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); |
| 516 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); | 517 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); |
| 517 | 518 |
| 518 bool has_embedded_credentials = | 519 bool has_embedded_credentials = |
| 519 params.url.has_username() || params.url.has_password(); | 520 params.url.has_username() || params.url.has_password(); |
| 520 UMA_HISTOGRAM_BOOLEAN("Navigation.FrameHasEmbeddedCredentials", | 521 UMA_HISTOGRAM_BOOLEAN("Navigation.FrameHasEmbeddedCredentials", |
| 521 has_embedded_credentials); | 522 has_embedded_credentials); |
| 522 | 523 |
| 523 bool is_navigation_within_page = controller_->IsURLInPageNavigation( | 524 bool is_navigation_within_page = controller_->IsURLInPageNavigation( |
| 524 params.url, params.origin, params.was_within_same_page, | 525 params.url, params.origin, params.was_within_same_page, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 // regressing it again. | 612 // regressing it again. |
| 612 // TODO(nasko): Verify the correctness of the above comment, since some of the | 613 // TODO(nasko): Verify the correctness of the above comment, since some of the |
| 613 // code doesn't exist anymore. Also, move this code in the | 614 // code doesn't exist anymore. Also, move this code in the |
| 614 // PageTransitionIsMainFrame code block above. | 615 // PageTransitionIsMainFrame code block above. |
| 615 if (ui::PageTransitionIsMainFrame(params.transition) && delegate_) | 616 if (ui::PageTransitionIsMainFrame(params.transition) && delegate_) |
| 616 delegate_->SetMainFrameMimeType(params.contents_mime_type); | 617 delegate_->SetMainFrameMimeType(params.contents_mime_type); |
| 617 | 618 |
| 618 int old_entry_count = controller_->GetEntryCount(); | 619 int old_entry_count = controller_->GetEntryCount(); |
| 619 LoadCommittedDetails details; | 620 LoadCommittedDetails details; |
| 620 bool did_navigate = controller_->RendererDidNavigate( | 621 bool did_navigate = controller_->RendererDidNavigate( |
| 621 render_frame_host, params, &details, is_navigation_within_page); | 622 render_frame_host, params, &details, is_navigation_within_page, |
| 623 navigation_handle.get()); | |
| 622 | 624 |
| 623 // If the history length and/or offset changed, update other renderers in the | 625 // If the history length and/or offset changed, update other renderers in the |
| 624 // FrameTree. | 626 // FrameTree. |
| 625 if (old_entry_count != controller_->GetEntryCount() || | 627 if (old_entry_count != controller_->GetEntryCount() || |
| 626 details.previous_entry_index != | 628 details.previous_entry_index != |
| 627 controller_->GetLastCommittedEntryIndex()) { | 629 controller_->GetLastCommittedEntryIndex()) { |
| 628 frame_tree->root()->render_manager()->SendPageMessage( | 630 frame_tree->root()->render_manager()->SendPageMessage( |
| 629 new PageMsg_SetHistoryOffsetAndLength( | 631 new PageMsg_SetHistoryOffsetAndLength( |
| 630 MSG_ROUTING_NONE, controller_->GetLastCommittedEntryIndex(), | 632 MSG_ROUTING_NONE, controller_->GetLastCommittedEntryIndex(), |
| 631 controller_->GetEntryCount()), | 633 controller_->GetEntryCount()), |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 660 if (did_navigate && | 662 if (did_navigate && |
| 661 (controller_->GetLastCommittedEntry()->GetTransitionType() & | 663 (controller_->GetLastCommittedEntry()->GetTransitionType() & |
| 662 ui::PAGE_TRANSITION_FORWARD_BACK)) { | 664 ui::PAGE_TRANSITION_FORWARD_BACK)) { |
| 663 transition_type = ui::PageTransitionFromInt( | 665 transition_type = ui::PageTransitionFromInt( |
| 664 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK); | 666 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK); |
| 665 } | 667 } |
| 666 | 668 |
| 667 delegate_->DidCommitProvisionalLoad(render_frame_host, | 669 delegate_->DidCommitProvisionalLoad(render_frame_host, |
| 668 params.url, | 670 params.url, |
| 669 transition_type); | 671 transition_type); |
| 670 render_frame_host->navigation_handle()->DidCommitNavigation( | 672 navigation_handle->DidCommitNavigation(params, is_navigation_within_page, |
| 671 params, is_navigation_within_page, render_frame_host); | 673 render_frame_host); |
| 672 render_frame_host->SetNavigationHandle(nullptr); | 674 navigation_handle.reset(); |
|
Charlie Reis
2016/11/03 22:02:22
Sanity check: This is handled by FindNavigationHan
clamy
2016/11/04 14:18:21
Yes in the cases where we need to reset it. FindNa
| |
| 673 } | 675 } |
| 674 | 676 |
| 675 if (!did_navigate) | 677 if (!did_navigate) |
| 676 return; // No navigation happened. | 678 return; // No navigation happened. |
| 677 | 679 |
| 678 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen | 680 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen |
| 679 // for the appropriate notification (best) or you can add it to | 681 // for the appropriate notification (best) or you can add it to |
| 680 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if | 682 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if |
| 681 // necessary, please). | 683 // necessary, please). |
| 682 | 684 |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1261 if (navigation_handle) | 1263 if (navigation_handle) |
| 1262 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1264 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
| 1263 | 1265 |
| 1264 controller_->SetPendingEntry(std::move(entry)); | 1266 controller_->SetPendingEntry(std::move(entry)); |
| 1265 if (delegate_) | 1267 if (delegate_) |
| 1266 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1268 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
| 1267 } | 1269 } |
| 1268 } | 1270 } |
| 1269 | 1271 |
| 1270 } // namespace content | 1272 } // namespace content |
| OLD | NEW |