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

Unified Diff: content/browser/web_contents/navigation_controller_impl.cc

Issue 21544005: Take the navigation type into account when checking if the navigation is in page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More generic and brave fix Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/navigation_controller_impl.cc
diff --git a/content/browser/web_contents/navigation_controller_impl.cc b/content/browser/web_contents/navigation_controller_impl.cc
index 6176606cbd44d6bbaeb66e9ee368e57bcd2ac80a..cfcee3a2241f3141c7c8be6f0f0620ffb0f0b692 100644
--- a/content/browser/web_contents/navigation_controller_impl.cc
+++ b/content/browser/web_contents/navigation_controller_impl.cc
@@ -105,18 +105,13 @@ void ConfigureEntriesForRestore(
// See NavigationController::IsURLInPageNavigation for how this works and why.
bool AreURLsInPageNavigation(const GURL& existing_url,
const GURL& new_url,
- bool renderer_says_in_page) {
+ bool renderer_says_in_page,
+ content::NavigationType navigation_type) {
if (existing_url == new_url)
return renderer_says_in_page;
if (!new_url.has_ref()) {
- // TODO(jcampan): what about when navigating back from a ref URL to the top
- // non ref URL? Nothing is loaded in that case but we return false here.
- // The user could also navigate from the ref URL to the non ref URL by
- // entering the non ref URL in the location bar or through a bookmark, in
- // which case there would be a load. I am not sure if the non-load/load
- // scenarios can be differentiated with the TransitionType.
- return false;
+ return navigation_type == content::NAVIGATION_TYPE_IN_PAGE;
Charlie Reis 2013/08/06 18:48:08 Please include a comment about how this is useful
}
url_canon::Replacements<char> replacements;
@@ -740,13 +735,13 @@ bool NavigationControllerImpl::RendererDidNavigate(
details->did_replace_entry =
pending_entry_ && pending_entry_->should_replace_entry();
- // is_in_page must be computed before the entry gets committed.
- details->is_in_page = IsURLInPageNavigation(
- params.url, params.was_within_same_page);
-
// Do navigation-type specific actions. These will make and commit an entry.
details->type = ClassifyNavigation(params);
+ // is_in_page must be computed before the entry gets committed.
+ details->is_in_page = IsURLInPageNavigation(params.url,
+ params.was_within_same_page, details->type);
+
switch (details->type) {
case NAVIGATION_TYPE_NEW_PAGE:
RendererDidNavigateToNewPage(params, details->did_replace_entry);
@@ -956,7 +951,8 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
// navigations that don't actually navigate, but it can happen when there is
// an encoding override (it always sends a navigation request).
if (AreURLsInPageNavigation(existing_entry->GetURL(), params.url,
- params.was_within_same_page)) {
+ params.was_within_same_page,
+ content::NAVIGATION_TYPE_UNKNOWN)) {
return NAVIGATION_TYPE_IN_PAGE;
}
@@ -1197,10 +1193,11 @@ int NavigationControllerImpl::GetIndexOfEntry(
}
bool NavigationControllerImpl::IsURLInPageNavigation(
- const GURL& url, bool renderer_says_in_page) const {
+ const GURL& url, bool renderer_says_in_page,
+ content::NavigationType navigation_type) const {
Charlie Reis 2013/08/06 18:48:08 Style nit: Each argument should be on its own line
NavigationEntry* last_committed = GetLastCommittedEntry();
return last_committed && AreURLsInPageNavigation(
- last_committed->GetURL(), url, renderer_says_in_page);
+ last_committed->GetURL(), url, renderer_says_in_page, navigation_type);
}
void NavigationControllerImpl::CopyStateFrom(

Powered by Google App Engine
This is Rietveld 408576698