Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 2376643002: Clean up NavigationControllerImpl::IsURLInPageNavigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 /* 5 /*
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 765
766 bool NavigationControllerImpl::PendingEntryMatchesHandle( 766 bool NavigationControllerImpl::PendingEntryMatchesHandle(
767 NavigationHandleImpl* handle) const { 767 NavigationHandleImpl* handle) const {
768 return pending_entry_ && 768 return pending_entry_ &&
769 pending_entry_->GetUniqueID() == handle->pending_nav_entry_id(); 769 pending_entry_->GetUniqueID() == handle->pending_nav_entry_id();
770 } 770 }
771 771
772 bool NavigationControllerImpl::RendererDidNavigate( 772 bool NavigationControllerImpl::RendererDidNavigate(
773 RenderFrameHostImpl* rfh, 773 RenderFrameHostImpl* rfh,
774 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 774 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
775 LoadCommittedDetails* details) { 775 LoadCommittedDetails* details, bool is_navigation_within_page) {
Charlie Reis 2016/09/27 18:51:43 Style nit: Move to next line.
776 is_initial_navigation_ = false; 776 is_initial_navigation_ = false;
777 777
778 // Save the previous state before we clobber it. 778 // Save the previous state before we clobber it.
779 if (GetLastCommittedEntry()) { 779 if (GetLastCommittedEntry()) {
780 details->previous_url = GetLastCommittedEntry()->GetURL(); 780 details->previous_url = GetLastCommittedEntry()->GetURL();
781 details->previous_entry_index = GetLastCommittedEntryIndex(); 781 details->previous_entry_index = GetLastCommittedEntryIndex();
782 } else { 782 } else {
783 details->previous_url = GURL(); 783 details->previous_url = GURL();
784 details->previous_entry_index = -1; 784 details->previous_entry_index = -1;
785 } 785 }
786 786
787 // If there is a pending entry at this point, it should have a SiteInstance, 787 // If there is a pending entry at this point, it should have a SiteInstance,
788 // except for restored entries. 788 // except for restored entries.
789 DCHECK(pending_entry_index_ == -1 || pending_entry_->site_instance() || 789 DCHECK(pending_entry_index_ == -1 || pending_entry_->site_instance() ||
790 pending_entry_->restore_type() != RestoreType::NONE); 790 pending_entry_->restore_type() != RestoreType::NONE);
791 if (pending_entry_ && pending_entry_->restore_type() != RestoreType::NONE) { 791 if (pending_entry_ && pending_entry_->restore_type() != RestoreType::NONE) {
792 pending_entry_->set_restore_type(RestoreType::NONE); 792 pending_entry_->set_restore_type(RestoreType::NONE);
793 } 793 }
794 794
795 // The renderer tells us whether the navigation replaces the current entry. 795 // The renderer tells us whether the navigation replaces the current entry.
796 details->did_replace_entry = params.should_replace_current_entry; 796 details->did_replace_entry = params.should_replace_current_entry;
797 797
798 // Do navigation-type specific actions. These will make and commit an entry. 798 // Do navigation-type specific actions. These will make and commit an entry.
799 details->type = ClassifyNavigation(rfh, params); 799 details->type = ClassifyNavigation(rfh, params);
800 800
801 // is_in_page must be computed before the entry gets committed. 801 // is_in_page must be computed before the entry gets committed.
802 details->is_in_page = IsURLInPageNavigation(params.url, params.origin, 802 details->is_in_page = is_navigation_within_page;
803 params.was_within_same_page, rfh);
804 803
805 switch (details->type) { 804 switch (details->type) {
806 case NAVIGATION_TYPE_NEW_PAGE: 805 case NAVIGATION_TYPE_NEW_PAGE:
807 RendererDidNavigateToNewPage(rfh, params, details->is_in_page, 806 RendererDidNavigateToNewPage(rfh, params, details->is_in_page,
808 details->did_replace_entry); 807 details->did_replace_entry);
809 break; 808 break;
810 case NAVIGATION_TYPE_EXISTING_PAGE: 809 case NAVIGATION_TYPE_EXISTING_PAGE:
811 details->did_replace_entry = details->is_in_page; 810 details->did_replace_entry = details->is_in_page;
812 RendererDidNavigateToExistingPage(rfh, params, details->is_in_page); 811 RendererDidNavigateToExistingPage(rfh, params, details->is_in_page);
813 break; 812 break;
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 } 2103 }
2105 } 2104 }
2106 } 2105 }
2107 2106
2108 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2107 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2109 const base::Callback<base::Time()>& get_timestamp_callback) { 2108 const base::Callback<base::Time()>& get_timestamp_callback) {
2110 get_timestamp_callback_ = get_timestamp_callback; 2109 get_timestamp_callback_ = get_timestamp_callback;
2111 } 2110 }
2112 2111
2113 } // namespace content 2112 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698