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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 RenderFrameHostImpl* render_frame_host, | 448 RenderFrameHostImpl* render_frame_host, |
449 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 449 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
450 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); | 450 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); |
451 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); | 451 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); |
452 | 452 |
453 bool has_embedded_credentials = | 453 bool has_embedded_credentials = |
454 params.url.has_username() || params.url.has_password(); | 454 params.url.has_username() || params.url.has_password(); |
455 UMA_HISTOGRAM_BOOLEAN("Navigation.FrameHasEmbeddedCredentials", | 455 UMA_HISTOGRAM_BOOLEAN("Navigation.FrameHasEmbeddedCredentials", |
456 has_embedded_credentials); | 456 has_embedded_credentials); |
457 | 457 |
458 RenderFrameHostManager* manager = NULL; | |
459 if (oopifs_possible) | |
460 manager = render_frame_host->frame_tree_node()->render_manager(); | |
461 else if (ui::PageTransitionIsMainFrame(params.transition)) | |
462 manager = frame_tree->root()->render_manager(); | |
463 bool will_swap = manager && | |
464 (render_frame_host == manager->pending_frame_host() || | |
465 render_frame_host == manager->speculative_frame_host()); | |
466 | |
458 bool is_navigation_within_page = controller_->IsURLInPageNavigation( | 467 bool is_navigation_within_page = controller_->IsURLInPageNavigation( |
459 params.url, params.was_within_same_page, render_frame_host); | 468 params.url, params.was_within_same_page, render_frame_host, will_swap); |
Charlie Reis
2016/02/26 20:11:58
What if we left IsURLInPageNavigation as is and ju
gzobqq
2016/02/29 13:36:28
I agree, this is cleaner.
| |
460 if (ui::PageTransitionIsMainFrame(params.transition)) { | 469 if (ui::PageTransitionIsMainFrame(params.transition)) { |
461 if (delegate_) { | 470 if (delegate_) { |
462 // When overscroll navigation gesture is enabled, a screenshot of the page | 471 // When overscroll navigation gesture is enabled, a screenshot of the page |
463 // in its current state is taken so that it can be used during the | 472 // in its current state is taken so that it can be used during the |
464 // nav-gesture. It is necessary to take the screenshot here, before | 473 // nav-gesture. It is necessary to take the screenshot here, before |
465 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can | 474 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can |
466 // change WebContents::GetRenderViewHost to return the new host, instead | 475 // change WebContents::GetRenderViewHost to return the new host, instead |
467 // of the one that may have just been swapped out. | 476 // of the one that may have just been swapped out. |
468 if (delegate_->CanOverscrollContent()) { | 477 if (delegate_->CanOverscrollContent()) { |
469 // Don't take screenshots if we are staying on the same page. We want | 478 // Don't take screenshots if we are staying on the same page. We want |
(...skipping 26 matching lines...) Expand all Loading... | |
496 | 505 |
497 render_frame_host->frame_tree_node()->SetEnforceStrictMixedContentChecking( | 506 render_frame_host->frame_tree_node()->SetEnforceStrictMixedContentChecking( |
498 params.should_enforce_strict_mixed_content_checking); | 507 params.should_enforce_strict_mixed_content_checking); |
499 | 508 |
500 // When using --site-per-process, we notify the RFHM for all navigations, | 509 // When using --site-per-process, we notify the RFHM for all navigations, |
501 // not just main frame navigations. | 510 // not just main frame navigations. |
502 if (oopifs_possible) { | 511 if (oopifs_possible) { |
503 FrameTreeNode* frame = render_frame_host->frame_tree_node(); | 512 FrameTreeNode* frame = render_frame_host->frame_tree_node(); |
504 frame->render_manager()->DidNavigateFrame( | 513 frame->render_manager()->DidNavigateFrame( |
505 render_frame_host, params.gesture == NavigationGestureUser); | 514 render_frame_host, params.gesture == NavigationGestureUser); |
506 } | 515 } |
Charlie Reis
2016/02/26 20:11:58
Should we also verify that |render_frame_host| is
gzobqq
2016/02/29 13:36:28
From my reading of DidNavigateFrame, it doesn't se
| |
507 | 516 |
508 // Update the site of the SiteInstance if it doesn't have one yet, unless | 517 // Update the site of the SiteInstance if it doesn't have one yet, unless |
509 // assigning a site is not necessary for this URL. In that case, the | 518 // assigning a site is not necessary for this URL. In that case, the |
510 // SiteInstance can still be considered unused until a navigation to a real | 519 // SiteInstance can still be considered unused until a navigation to a real |
511 // page. | 520 // page. |
512 SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance(); | 521 SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance(); |
513 if (!site_instance->HasSite() && | 522 if (!site_instance->HasSite() && |
514 ShouldAssignSiteForURL(params.url)) { | 523 ShouldAssignSiteForURL(params.url)) { |
515 site_instance->SetSite(params.url); | 524 site_instance->SetSite(params.url); |
516 } | 525 } |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1065 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 1074 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
1066 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 1075 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
1067 } | 1076 } |
1068 controller_->SetPendingEntry(std::move(entry)); | 1077 controller_->SetPendingEntry(std::move(entry)); |
1069 if (delegate_) | 1078 if (delegate_) |
1070 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1079 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1071 } | 1080 } |
1072 } | 1081 } |
1073 | 1082 |
1074 } // namespace content | 1083 } // namespace content |
OLD | NEW |