Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1025 // entry list, we're guaranteed to have a last committed entry. | 1025 // entry list, we're guaranteed to have a last committed entry. |
| 1026 DCHECK(GetLastCommittedEntry()); | 1026 DCHECK(GetLastCommittedEntry()); |
| 1027 return NAVIGATION_TYPE_AUTO_SUBFRAME; | 1027 return NAVIGATION_TYPE_AUTO_SUBFRAME; |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 // Anything below here we know is a main frame navigation. | 1030 // Anything below here we know is a main frame navigation. |
| 1031 if (pending_entry_ && | 1031 if (pending_entry_ && |
| 1032 !pending_entry_->is_renderer_initiated() && | 1032 !pending_entry_->is_renderer_initiated() && |
| 1033 existing_entry != pending_entry_ && | 1033 existing_entry != pending_entry_ && |
| 1034 pending_entry_->GetPageID() == -1 && | 1034 pending_entry_->GetPageID() == -1 && |
| 1035 existing_entry == GetLastCommittedEntry()) { | 1035 existing_entry == GetLastCommittedEntry() && |
| 1036 const std::vector<GURL>& existing_redirect_chain = | 1036 !params.was_within_same_page && |
|
Charlie Reis
2015/05/01 21:37:09
And just for posterity, this looks correct to me b
Avi (use Gerrit)
2015/05/01 21:41:55
This line is what allows NavigationTypeClassificat
| |
| 1037 existing_entry->GetRedirectChain(); | 1037 (params.url == existing_entry->GetURL() || |
| 1038 | 1038 (params.redirects.size() && |
| 1039 if (existing_entry->GetURL() == pending_entry_->GetURL() || | 1039 params.redirects[0] == existing_entry->GetURL()))) { |
| 1040 (existing_redirect_chain.size() && | 1040 // In this case, we have a pending entry for a URL but Blink didn't do a new |
| 1041 existing_redirect_chain[0] == pending_entry_->GetURL())) { | 1041 // navigation. This happens when you press enter in the URL bar to reload. |
| 1042 // In this case, we have a pending entry for a URL but WebCore didn't do a | 1042 // We will create a pending entry, but Blink will convert it to a reload |
| 1043 // new navigation. This happens when you press enter in the URL bar to | 1043 // since it's the same page and not create a new entry for it (the user |
| 1044 // reload. We will create a pending entry, but WebKit will convert it to | 1044 // doesn't want to have a new back/forward entry when they do this). If this |
| 1045 // a reload since it's the same page and not create a new entry for it | 1045 // matches the last committed entry, we want to just ignore the pending |
| 1046 // (the user doesn't want to have a new back/forward entry when they do | 1046 // entry and go back to where we were (the "existing entry"). |
| 1047 // this). If this matches the last committed entry, we want to just ignore | 1047 return NAVIGATION_TYPE_SAME_PAGE; |
| 1048 // the pending entry and go back to where we were (the "existing entry"). | |
| 1049 return NAVIGATION_TYPE_SAME_PAGE; | |
| 1050 } | |
| 1051 } | 1048 } |
| 1052 | 1049 |
| 1053 // Any toplevel navigations with the same base (minus the reference fragment) | 1050 // Any toplevel navigations with the same base (minus the reference fragment) |
| 1054 // are in-page navigations. We weeded out subframe navigations above. Most of | 1051 // are in-page navigations. We weeded out subframe navigations above. Most of |
| 1055 // the time this doesn't matter since WebKit doesn't tell us about subframe | 1052 // the time this doesn't matter since WebKit doesn't tell us about subframe |
| 1056 // navigations that don't actually navigate, but it can happen when there is | 1053 // navigations that don't actually navigate, but it can happen when there is |
| 1057 // an encoding override (it always sends a navigation request). | 1054 // an encoding override (it always sends a navigation request). |
| 1058 if (AreURLsInPageNavigation(existing_entry->GetURL(), params.url, | 1055 if (AreURLsInPageNavigation(existing_entry->GetURL(), params.url, |
| 1059 params.was_within_same_page, rfh)) { | 1056 params.was_within_same_page, rfh)) { |
| 1060 return NAVIGATION_TYPE_IN_PAGE; | 1057 return NAVIGATION_TYPE_IN_PAGE; |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1869 } | 1866 } |
| 1870 } | 1867 } |
| 1871 } | 1868 } |
| 1872 | 1869 |
| 1873 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1870 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 1874 const base::Callback<base::Time()>& get_timestamp_callback) { | 1871 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 1875 get_timestamp_callback_ = get_timestamp_callback; | 1872 get_timestamp_callback_ = get_timestamp_callback; |
| 1876 } | 1873 } |
| 1877 | 1874 |
| 1878 } // namespace content | 1875 } // namespace content |
| OLD | NEW |