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

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: Clean up NavigationControllerImpl::IsURLInPageNavigation 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,
776 bool is_navigation_within_page) {
776 is_initial_navigation_ = false; 777 is_initial_navigation_ = false;
777 778
778 // Save the previous state before we clobber it. 779 // Save the previous state before we clobber it.
779 if (GetLastCommittedEntry()) { 780 if (GetLastCommittedEntry()) {
780 details->previous_url = GetLastCommittedEntry()->GetURL(); 781 details->previous_url = GetLastCommittedEntry()->GetURL();
781 details->previous_entry_index = GetLastCommittedEntryIndex(); 782 details->previous_entry_index = GetLastCommittedEntryIndex();
782 } else { 783 } else {
783 details->previous_url = GURL(); 784 details->previous_url = GURL();
784 details->previous_entry_index = -1; 785 details->previous_entry_index = -1;
785 } 786 }
786 787
787 // If there is a pending entry at this point, it should have a SiteInstance, 788 // If there is a pending entry at this point, it should have a SiteInstance,
788 // except for restored entries. 789 // except for restored entries.
789 DCHECK(pending_entry_index_ == -1 || pending_entry_->site_instance() || 790 DCHECK(pending_entry_index_ == -1 || pending_entry_->site_instance() ||
790 pending_entry_->restore_type() != RestoreType::NONE); 791 pending_entry_->restore_type() != RestoreType::NONE);
791 if (pending_entry_ && pending_entry_->restore_type() != RestoreType::NONE) { 792 if (pending_entry_ && pending_entry_->restore_type() != RestoreType::NONE) {
792 pending_entry_->set_restore_type(RestoreType::NONE); 793 pending_entry_->set_restore_type(RestoreType::NONE);
793 } 794 }
794 795
795 // The renderer tells us whether the navigation replaces the current entry. 796 // The renderer tells us whether the navigation replaces the current entry.
796 details->did_replace_entry = params.should_replace_current_entry; 797 details->did_replace_entry = params.should_replace_current_entry;
797 798
798 // Do navigation-type specific actions. These will make and commit an entry. 799 // Do navigation-type specific actions. These will make and commit an entry.
799 details->type = ClassifyNavigation(rfh, params); 800 details->type = ClassifyNavigation(rfh, params);
800 801
801 // is_in_page must be computed before the entry gets committed. 802 // is_in_page must be computed before the entry gets committed.
802 details->is_in_page = IsURLInPageNavigation(params.url, params.origin, 803 details->is_in_page = is_navigation_within_page;
803 params.was_within_same_page, rfh);
804 804
805 switch (details->type) { 805 switch (details->type) {
806 case NAVIGATION_TYPE_NEW_PAGE: 806 case NAVIGATION_TYPE_NEW_PAGE:
807 RendererDidNavigateToNewPage(rfh, params, details->is_in_page, 807 RendererDidNavigateToNewPage(rfh, params, details->is_in_page,
808 details->did_replace_entry); 808 details->did_replace_entry);
809 break; 809 break;
810 case NAVIGATION_TYPE_EXISTING_PAGE: 810 case NAVIGATION_TYPE_EXISTING_PAGE:
811 details->did_replace_entry = details->is_in_page; 811 details->did_replace_entry = details->is_in_page;
812 RendererDidNavigateToExistingPage(rfh, params, details->is_in_page); 812 RendererDidNavigateToExistingPage(rfh, params, details->is_in_page);
813 break; 813 break;
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 } 2104 }
2105 } 2105 }
2106 } 2106 }
2107 2107
2108 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2108 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2109 const base::Callback<base::Time()>& get_timestamp_callback) { 2109 const base::Callback<base::Time()>& get_timestamp_callback) {
2110 get_timestamp_callback_ = get_timestamp_callback; 2110 get_timestamp_callback_ = get_timestamp_callback;
2111 } 2111 }
2112 2112
2113 } // namespace content 2113 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.h ('k') | content/browser/frame_host/navigator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698