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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 bool is_navigation_within_page = controller_->IsURLInPageNavigation( | 458 bool is_navigation_within_page = controller_->IsURLInPageNavigation( |
459 params.url, params.was_within_same_page, render_frame_host); | 459 params.url, params.was_within_same_page, render_frame_host); |
| 460 |
| 461 // If a frame claims it navigated within page, it must be the current frame, |
| 462 // not a pending one. |
| 463 if (is_navigation_within_page && |
| 464 render_frame_host != |
| 465 render_frame_host->frame_tree_node() |
| 466 ->render_manager() |
| 467 ->current_frame_host()) { |
| 468 bad_message::ReceivedBadMessage(render_frame_host->GetProcess(), |
| 469 bad_message::NC_IN_PAGE_NAVIGATION); |
| 470 is_navigation_within_page = false; |
| 471 } |
| 472 |
460 if (ui::PageTransitionIsMainFrame(params.transition)) { | 473 if (ui::PageTransitionIsMainFrame(params.transition)) { |
461 if (delegate_) { | 474 if (delegate_) { |
462 // When overscroll navigation gesture is enabled, a screenshot of the page | 475 // 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 | 476 // 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 | 477 // nav-gesture. It is necessary to take the screenshot here, before |
465 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can | 478 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can |
466 // change WebContents::GetRenderViewHost to return the new host, instead | 479 // change WebContents::GetRenderViewHost to return the new host, instead |
467 // of the one that may have just been swapped out. | 480 // of the one that may have just been swapped out. |
468 if (delegate_->CanOverscrollContent()) { | 481 if (delegate_->CanOverscrollContent()) { |
469 // Don't take screenshots if we are staying on the same page. We want | 482 // Don't take screenshots if we are staying on the same page. We want |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 1078 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
1066 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 1079 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
1067 } | 1080 } |
1068 controller_->SetPendingEntry(std::move(entry)); | 1081 controller_->SetPendingEntry(std::move(entry)); |
1069 if (delegate_) | 1082 if (delegate_) |
1070 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1083 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1071 } | 1084 } |
1072 } | 1085 } |
1073 | 1086 |
1074 } // namespace content | 1087 } // namespace content |
OLD | NEW |