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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 1661423002: Solidify Entry discarding logic (NavigationHandle keeps its ID) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + creis review Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "cc/base/switches.h" 50 #include "cc/base/switches.h"
51 #include "components/mime_util/mime_util.h" 51 #include "components/mime_util/mime_util.h"
52 #include "content/browser/bad_message.h" 52 #include "content/browser/bad_message.h"
53 #include "content/browser/browser_url_handler_impl.h" 53 #include "content/browser/browser_url_handler_impl.h"
54 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" 54 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
55 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 55 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
56 #include "content/browser/frame_host/debug_urls.h" 56 #include "content/browser/frame_host/debug_urls.h"
57 #include "content/browser/frame_host/interstitial_page_impl.h" 57 #include "content/browser/frame_host/interstitial_page_impl.h"
58 #include "content/browser/frame_host/navigation_entry_impl.h" 58 #include "content/browser/frame_host/navigation_entry_impl.h"
59 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" 59 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h"
60 #include "content/browser/frame_host/navigation_handle_impl.h"
60 #include "content/browser/frame_host/navigator.h" 61 #include "content/browser/frame_host/navigator.h"
61 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary 62 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary
62 #include "content/browser/site_instance_impl.h" 63 #include "content/browser/site_instance_impl.h"
63 #include "content/common/frame_messages.h" 64 #include "content/common/frame_messages.h"
64 #include "content/common/site_isolation_policy.h" 65 #include "content/common/site_isolation_policy.h"
65 #include "content/common/ssl_status_serialization.h" 66 #include "content/common/ssl_status_serialization.h"
66 #include "content/common/view_messages.h" 67 #include "content/common/view_messages.h"
67 #include "content/public/browser/browser_context.h" 68 #include "content/public/browser/browser_context.h"
68 #include "content/public/browser/content_browser_client.h" 69 #include "content/public/browser/content_browser_client.h"
69 #include "content/public/browser/invalidate_type.h" 70 #include "content/public/browser/invalidate_type.h"
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 return NAVIGATION_TYPE_EXISTING_PAGE; 1078 return NAVIGATION_TYPE_EXISTING_PAGE;
1078 } 1079 }
1079 1080
1080 void NavigationControllerImpl::RendererDidNavigateToNewPage( 1081 void NavigationControllerImpl::RendererDidNavigateToNewPage(
1081 RenderFrameHostImpl* rfh, 1082 RenderFrameHostImpl* rfh,
1082 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 1083 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
1083 bool replace_entry) { 1084 bool replace_entry) {
1084 scoped_ptr<NavigationEntryImpl> new_entry; 1085 scoped_ptr<NavigationEntryImpl> new_entry;
1085 bool update_virtual_url; 1086 bool update_virtual_url;
1086 // Only make a copy of the pending entry if it is appropriate for the new page 1087 // Only make a copy of the pending entry if it is appropriate for the new page
1087 // that was just loaded. We verify this at a coarse grain by checking that 1088 // that was just loaded. Verify this by checking if the entry corresponds
1088 // the SiteInstance hasn't been assigned to something else, and by making sure 1089 // to the current navigation handle. Note that in some tests the render frame
1089 // that the pending entry was intended as a new entry (rather than being a 1090 // host does not have a valid handle. Additionally, coarsely check that:
1090 // history navigation that was interrupted by an unrelated, renderer-initiated 1091 // 1. The SiteInstance hasn't been assigned to something else.
1091 // navigation). 1092 // 2. The pending entry was intended as a new entry, rather than being a
1092 if (pending_entry_ && pending_entry_index_ == -1 && 1093 // history navigation that was interrupted by an unrelated,
1094 // renderer-initiated navigation.
1095 // TODO(csharrison): Investigate whether we can remove some of the coarser
1096 // checks.
1097 NavigationHandleImpl* handle = rfh->navigation_handle();
1098 if (pending_entry_ && handle &&
1099 handle->pending_nav_entry_id() == pending_entry_->GetUniqueID() &&
1100 pending_entry_index_ == -1 &&
1093 (!pending_entry_->site_instance() || 1101 (!pending_entry_->site_instance() ||
1094 pending_entry_->site_instance() == rfh->GetSiteInstance())) { 1102 pending_entry_->site_instance() == rfh->GetSiteInstance())) {
1095 new_entry = pending_entry_->Clone(); 1103 new_entry = pending_entry_->Clone();
1096 1104
1097 update_virtual_url = new_entry->update_virtual_url_with_url(); 1105 update_virtual_url = new_entry->update_virtual_url_with_url();
1098 } else { 1106 } else {
1099 new_entry = make_scoped_ptr(new NavigationEntryImpl); 1107 new_entry = make_scoped_ptr(new NavigationEntryImpl);
1100 1108
1101 // Find out whether the new entry needs to update its virtual URL on URL 1109 // Find out whether the new entry needs to update its virtual URL on URL
1102 // change and set up the entry accordingly. This is needed to correctly 1110 // change and set up the entry accordingly. This is needed to correctly
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 } 2056 }
2049 } 2057 }
2050 } 2058 }
2051 2059
2052 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2060 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2053 const base::Callback<base::Time()>& get_timestamp_callback) { 2061 const base::Callback<base::Time()>& get_timestamp_callback) {
2054 get_timestamp_callback_ = get_timestamp_callback; 2062 get_timestamp_callback_ = get_timestamp_callback;
2055 } 2063 }
2056 2064
2057 } // namespace content 2065 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698