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 /* | 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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 847 | 847 |
| 848 // If there is a pending entry at this point, it should have a SiteInstance, | 848 // If there is a pending entry at this point, it should have a SiteInstance, |
| 849 // except for restored entries. | 849 // except for restored entries. |
| 850 DCHECK(pending_entry_index_ == -1 || | 850 DCHECK(pending_entry_index_ == -1 || |
| 851 pending_entry_->site_instance() || | 851 pending_entry_->site_instance() || |
| 852 pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE); | 852 pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE); |
| 853 if (pending_entry_ && | 853 if (pending_entry_ && |
| 854 pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE) | 854 pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE) |
| 855 pending_entry_->set_restore_type(NavigationEntryImpl::RESTORE_NONE); | 855 pending_entry_->set_restore_type(NavigationEntryImpl::RESTORE_NONE); |
| 856 | 856 |
| 857 // If we are doing a cross-site reload, we need to replace the existing | 857 // If the pending entry matches this commit, check if it says to replace the |
| 858 // navigation entry, not add another entry to the history. This has the side | 858 // current entry (which preserves forward history). This is used for things |
| 859 // effect of removing forward browsing history, if such existed. Or if we are | 859 // like cross-process client redirects or cross-process reloads. |
|
Charlie Harrison
2016/03/11 15:15:14
Maybe reference location.replace(<cross-site>). I
Charlie Reis
2016/03/11 20:12:48
Done.
| |
| 860 // doing a cross-site redirect navigation, we will do a similar thing. | |
| 861 // | 860 // |
| 862 // If this is an error load, we may have already removed the pending entry | 861 // If this is an error load, we may have already removed the pending entry |
| 863 // when we got the notice of the load failure. If so, look at the copy of the | 862 // when we got the notice of the load failure. If so, look at the copy of the |
| 864 // pending parameters that were saved. | 863 // pending parameters that were saved and see if they match the handle. |
| 865 if (params.url_is_unreachable && failed_pending_entry_id_ != 0) { | 864 NavigationHandleImpl* handle = rfh->navigation_handle(); |
| 865 DCHECK(handle); | |
| 866 if (params.url_is_unreachable && failed_pending_entry_id_ != 0 && | |
| 867 handle->pending_nav_entry_id() == failed_pending_entry_id_) { | |
| 866 details->did_replace_entry = failed_pending_entry_should_replace_; | 868 details->did_replace_entry = failed_pending_entry_should_replace_; |
| 869 } else if (pending_entry_ && | |
| 870 pending_entry_->GetUniqueID() == handle->pending_nav_entry_id() && | |
|
Charlie Harrison
2016/03/11 15:15:14
Suggestion: This logic is duplicated in a bunch of
Charlie Reis
2016/03/11 20:12:48
Good idea. I wrote a helper function for it.
We
| |
| 871 pending_entry_->should_replace_entry()) { | |
| 872 details->did_replace_entry = pending_entry_->should_replace_entry(); | |
| 867 } else { | 873 } else { |
| 868 details->did_replace_entry = pending_entry_ && | 874 details->did_replace_entry = false; |
| 869 pending_entry_->should_replace_entry(); | |
| 870 } | 875 } |
| 871 | 876 |
| 872 // Do navigation-type specific actions. These will make and commit an entry. | 877 // Do navigation-type specific actions. These will make and commit an entry. |
| 873 details->type = ClassifyNavigation(rfh, params); | 878 details->type = ClassifyNavigation(rfh, params); |
| 874 | 879 |
| 875 // is_in_page must be computed before the entry gets committed. | 880 // is_in_page must be computed before the entry gets committed. |
| 876 details->is_in_page = IsURLInPageNavigation( | 881 details->is_in_page = IsURLInPageNavigation( |
| 877 params.url, params.was_within_same_page, rfh); | 882 params.url, params.was_within_same_page, rfh); |
| 878 | 883 |
| 879 switch (details->type) { | 884 switch (details->type) { |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2071 } | 2076 } |
| 2072 } | 2077 } |
| 2073 } | 2078 } |
| 2074 | 2079 |
| 2075 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2080 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2076 const base::Callback<base::Time()>& get_timestamp_callback) { | 2081 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2077 get_timestamp_callback_ = get_timestamp_callback; | 2082 get_timestamp_callback_ = get_timestamp_callback; |
| 2078 } | 2083 } |
| 2079 | 2084 |
| 2080 } // namespace content | 2085 } // namespace content |
| OLD | NEW |