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

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: Addressing review comments. 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..3123eab88c2afb57a6a55eb54b2586e62ce85e95 100644
--- a/content/browser/web_contents/navigation_controller_impl.cc
+++ b/content/browser/web_contents/navigation_controller_impl.cc
@@ -105,18 +105,16 @@ 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) {
Charlie Reis 2013/08/07 16:59:27 This whole file is in the content namespace, so yo
pstanek 2013/08/07 17:37:37 Done.
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;
+ // When going back from the ref URL to the non ref one the navigation type
+ // is typically IN_PAGE which causes the correct value to be returned
Charlie Reis 2013/08/07 16:59:27 nit: drop "typically" (unless you can mention exam
pstanek 2013/08/07 17:37:37 Done.
+ // for that case from this function as well.
+ return navigation_type == content::NAVIGATION_TYPE_IN_PAGE;
}
url_canon::Replacements<char> replacements;
@@ -740,13 +738,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 +954,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)) {
Charlie Reis 2013/08/07 16:59:27 No need for content::
pstanek 2013/08/07 17:37:37 Done.
return NAVIGATION_TYPE_IN_PAGE;
}
@@ -1197,10 +1196,12 @@ 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/07 16:59:27 No need for content::
pstanek 2013/08/07 17:37:37 Done.
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