Chromium Code Reviews| 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..df3c7d25f8090a005318a5bf02db6a9cd71ee0e9 100644 |
| --- a/content/browser/web_contents/navigation_controller_impl.cc |
| +++ b/content/browser/web_contents/navigation_controller_impl.cc |
| @@ -105,18 +105,15 @@ 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, |
| + 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; |
| + // When going back from the ref URL to the non ref one the navigation type |
| + // is IN_PAGE. |
| + return navigation_type == NAVIGATION_TYPE_IN_PAGE; |
| } |
| url_canon::Replacements<char> replacements; |
| @@ -740,13 +737,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, |
|
Charlie Reis
2013/08/07 17:49:56
Style nit: This is fine, but might as well move pa
pstanek
2013/08/07 18:05:56
Done.
|
| + params.was_within_same_page, details->type); |
| + |
| switch (details->type) { |
| case NAVIGATION_TYPE_NEW_PAGE: |
| RendererDidNavigateToNewPage(params, details->did_replace_entry); |
| @@ -956,7 +953,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, |
| + NAVIGATION_TYPE_UNKNOWN)) { |
| return NAVIGATION_TYPE_IN_PAGE; |
| } |
| @@ -1197,10 +1195,12 @@ int NavigationControllerImpl::GetIndexOfEntry( |
| } |
| bool NavigationControllerImpl::IsURLInPageNavigation( |
| - const GURL& url, bool renderer_says_in_page) const { |
| + const GURL& url, |
| + bool renderer_says_in_page, |
| + NavigationType navigation_type) const { |
| 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( |