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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 std::unique_ptr<NavigationHandleImpl> navigation_handle) { | 545 std::unique_ptr<NavigationHandleImpl> navigation_handle) { |
| 546 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); | 546 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); |
| 547 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); | 547 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); |
| 548 | 548 |
| 549 bool has_embedded_credentials = | 549 bool has_embedded_credentials = |
| 550 params.url.has_username() || params.url.has_password(); | 550 params.url.has_username() || params.url.has_password(); |
| 551 UMA_HISTOGRAM_BOOLEAN("Navigation.FrameHasEmbeddedCredentials", | 551 UMA_HISTOGRAM_BOOLEAN("Navigation.FrameHasEmbeddedCredentials", |
| 552 has_embedded_credentials); | 552 has_embedded_credentials); |
| 553 | 553 |
| 554 bool is_navigation_within_page = controller_->IsURLInPageNavigation( | 554 bool is_navigation_within_page = controller_->IsURLInPageNavigation( |
| 555 params.url, params.origin, params.was_within_same_page, | 555 params.url, params.origin, params.was_within_same_document, |
| 556 render_frame_host); | 556 render_frame_host); |
| 557 | 557 |
| 558 // If a frame claims it navigated within page, it must be the current frame, | 558 // If a frame claims it navigated within page, it must be the current frame, |
| 559 // not a pending one. | 559 // not a pending one. |
| 560 if (is_navigation_within_page && | 560 if (is_navigation_within_page && |
| 561 render_frame_host != | 561 render_frame_host != |
| 562 render_frame_host->frame_tree_node() | 562 render_frame_host->frame_tree_node() |
| 563 ->render_manager() | 563 ->render_manager() |
| 564 ->current_frame_host()) { | 564 ->current_frame_host()) { |
| 565 bad_message::ReceivedBadMessage(render_frame_host->GetProcess(), | 565 bad_message::ReceivedBadMessage(render_frame_host->GetProcess(), |
| 566 bad_message::NI_IN_PAGE_NAVIGATION); | 566 bad_message::NI_IN_PAGE_NAVIGATION); |
| 567 is_navigation_within_page = false; | 567 is_navigation_within_page = false; |
| 568 } | 568 } |
| 569 | 569 |
| 570 if (ui::PageTransitionIsMainFrame(params.transition)) { | 570 if (ui::PageTransitionIsMainFrame(params.transition)) { |
| 571 if (delegate_) { | 571 if (delegate_) { |
| 572 // When overscroll navigation gesture is enabled, a screenshot of the page | 572 // When overscroll navigation gesture is enabled, a screenshot of the page |
| 573 // in its current state is taken so that it can be used during the | 573 // in its current state is taken so that it can be used during the |
| 574 // nav-gesture. It is necessary to take the screenshot here, before | 574 // nav-gesture. It is necessary to take the screenshot here, before |
| 575 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can | 575 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can |
| 576 // change WebContents::GetRenderViewHost to return the new host, instead | 576 // change WebContents::GetRenderViewHost to return the new host, instead |
| 577 // of the one that may have just been swapped out. | 577 // of the one that may have just been swapped out. |
| 578 if (delegate_->CanOverscrollContent()) { | 578 if (delegate_->CanOverscrollContent()) { |
| 579 // Don't take screenshots if we are staying on the same page. We want | 579 // Don't take screenshots if we are staying on the same page. We want |
|
Charlie Reis
2017/03/15 02:43:10
s/page/document/
Eugene But (OOO till 7-30)
2017/03/15 16:16:16
Done.
| |
| 580 // in-page navigations to be super fast, and taking a screenshot | 580 // in-page navigations to be super fast, and taking a screenshot |
|
Charlie Reis
2017/03/15 02:43:10
s/in-page/same-document/
Eugene But (OOO till 7-30)
2017/03/15 16:16:17
Done.
| |
| 581 // currently blocks GPU for a longer time than we are willing to | 581 // currently blocks GPU for a longer time than we are willing to |
| 582 // tolerate in this use case. | 582 // tolerate in this use case. |
| 583 if (!params.was_within_same_page) | 583 if (!params.was_within_same_document) |
| 584 controller_->TakeScreenshot(); | 584 controller_->TakeScreenshot(); |
| 585 } | 585 } |
| 586 | 586 |
| 587 // Run tasks that must execute just before the commit. | 587 // Run tasks that must execute just before the commit. |
| 588 delegate_->DidNavigateMainFramePreCommit(is_navigation_within_page); | 588 delegate_->DidNavigateMainFramePreCommit(is_navigation_within_page); |
| 589 | 589 |
| 590 UMA_HISTOGRAM_BOOLEAN("Navigation.MainFrameHasEmbeddedCredentials", | 590 UMA_HISTOGRAM_BOOLEAN("Navigation.MainFrameHasEmbeddedCredentials", |
| 591 has_embedded_credentials); | 591 has_embedded_credentials); |
| 592 } | 592 } |
| 593 | 593 |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1288 if (navigation_handle) | 1288 if (navigation_handle) |
| 1289 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1289 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
| 1290 | 1290 |
| 1291 controller_->SetPendingEntry(std::move(entry)); | 1291 controller_->SetPendingEntry(std::move(entry)); |
| 1292 if (delegate_) | 1292 if (delegate_) |
| 1293 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1293 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
| 1294 } | 1294 } |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 } // namespace content | 1297 } // namespace content |
| OLD | NEW |