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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 entry->SetCanLoadLocalResources(params.can_load_local_resources); | 823 entry->SetCanLoadLocalResources(params.can_load_local_resources); |
824 break; | 824 break; |
825 default: | 825 default: |
826 NOTREACHED(); | 826 NOTREACHED(); |
827 break; | 827 break; |
828 }; | 828 }; |
829 | 829 |
830 LoadEntry(std::move(entry)); | 830 LoadEntry(std::move(entry)); |
831 } | 831 } |
832 | 832 |
| 833 bool NavigationControllerImpl::PendingEntryMatchesHandle( |
| 834 NavigationHandleImpl* handle) const { |
| 835 return pending_entry_ && |
| 836 pending_entry_->GetUniqueID() == handle->pending_nav_entry_id(); |
| 837 } |
| 838 |
833 bool NavigationControllerImpl::RendererDidNavigate( | 839 bool NavigationControllerImpl::RendererDidNavigate( |
834 RenderFrameHostImpl* rfh, | 840 RenderFrameHostImpl* rfh, |
835 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 841 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
836 LoadCommittedDetails* details) { | 842 LoadCommittedDetails* details) { |
837 is_initial_navigation_ = false; | 843 is_initial_navigation_ = false; |
838 | 844 |
839 // Save the previous state before we clobber it. | 845 // Save the previous state before we clobber it. |
840 if (GetLastCommittedEntry()) { | 846 if (GetLastCommittedEntry()) { |
841 details->previous_url = GetLastCommittedEntry()->GetURL(); | 847 details->previous_url = GetLastCommittedEntry()->GetURL(); |
842 details->previous_entry_index = GetLastCommittedEntryIndex(); | 848 details->previous_entry_index = GetLastCommittedEntryIndex(); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 // that was just loaded. Verify this by checking if the entry corresponds | 1108 // that was just loaded. Verify this by checking if the entry corresponds |
1103 // to the current navigation handle. Note that in some tests the render frame | 1109 // to the current navigation handle. Note that in some tests the render frame |
1104 // host does not have a valid handle. Additionally, coarsely check that: | 1110 // host does not have a valid handle. Additionally, coarsely check that: |
1105 // 1. The SiteInstance hasn't been assigned to something else. | 1111 // 1. The SiteInstance hasn't been assigned to something else. |
1106 // 2. The pending entry was intended as a new entry, rather than being a | 1112 // 2. The pending entry was intended as a new entry, rather than being a |
1107 // history navigation that was interrupted by an unrelated, | 1113 // history navigation that was interrupted by an unrelated, |
1108 // renderer-initiated navigation. | 1114 // renderer-initiated navigation. |
1109 // TODO(csharrison): Investigate whether we can remove some of the coarser | 1115 // TODO(csharrison): Investigate whether we can remove some of the coarser |
1110 // checks. | 1116 // checks. |
1111 NavigationHandleImpl* handle = rfh->navigation_handle(); | 1117 NavigationHandleImpl* handle = rfh->navigation_handle(); |
1112 if (pending_entry_ && handle && | 1118 DCHECK(handle); |
1113 handle->pending_nav_entry_id() == pending_entry_->GetUniqueID() && | 1119 if (PendingEntryMatchesHandle(handle) && pending_entry_index_ == -1 && |
1114 pending_entry_index_ == -1 && | |
1115 (!pending_entry_->site_instance() || | 1120 (!pending_entry_->site_instance() || |
1116 pending_entry_->site_instance() == rfh->GetSiteInstance())) { | 1121 pending_entry_->site_instance() == rfh->GetSiteInstance())) { |
1117 new_entry = pending_entry_->Clone(); | 1122 new_entry = pending_entry_->Clone(); |
1118 | 1123 |
1119 update_virtual_url = new_entry->update_virtual_url_with_url(); | 1124 update_virtual_url = new_entry->update_virtual_url_with_url(); |
1120 } else { | 1125 } else { |
1121 new_entry = make_scoped_ptr(new NavigationEntryImpl); | 1126 new_entry = make_scoped_ptr(new NavigationEntryImpl); |
1122 | 1127 |
1123 // Find out whether the new entry needs to update its virtual URL on URL | 1128 // Find out whether the new entry needs to update its virtual URL on URL |
1124 // change and set up the entry accordingly. This is needed to correctly | 1129 // change and set up the entry accordingly. This is needed to correctly |
(...skipping 946 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 |