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

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: nav id hack for data navs with base url 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
Charlie Reis 2016/02/10 00:25:42 Glad we're adding this! Can you add a mention of
Charlie Harrison 2016/02/11 20:23:05 Done.
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 unreleated,
Charlie Reis 2016/02/10 00:25:42 nit: unrelated
Charlie Harrison 2016/02/11 20:23:05 Done.
1094 // renderer-initiated navigation.
1095 NavigationHandleImpl* handle = rfh->navigation_handle();
1096 if (pending_entry_ && handle &&
1097 handle->pending_nav_entry_id() == pending_entry_->GetUniqueID() &&
1098 pending_entry_index_ == -1 &&
1093 (!pending_entry_->site_instance() || 1099 (!pending_entry_->site_instance() ||
1094 pending_entry_->site_instance() == rfh->GetSiteInstance())) { 1100 pending_entry_->site_instance() == rfh->GetSiteInstance())) {
Charlie Reis 2016/02/10 00:25:42 Side note: I'm not sure if the SiteInstances can d
Charlie Harrison 2016/02/11 20:23:05 I wanted to leave them in to be sure. I'm happy to
1095 new_entry = pending_entry_->Clone(); 1101 new_entry = pending_entry_->Clone();
1096 1102
1097 update_virtual_url = new_entry->update_virtual_url_with_url(); 1103 update_virtual_url = new_entry->update_virtual_url_with_url();
1098 } else { 1104 } else {
1099 new_entry = make_scoped_ptr(new NavigationEntryImpl); 1105 new_entry = make_scoped_ptr(new NavigationEntryImpl);
1100 1106
1101 // Find out whether the new entry needs to update its virtual URL on URL 1107 // 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 1108 // change and set up the entry accordingly. This is needed to correctly
1103 // update the virtual URL when replaceState is called after a pushState. 1109 // update the virtual URL when replaceState is called after a pushState.
1104 GURL url = params.url; 1110 GURL url = params.url;
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 } 2050 }
2045 } 2051 }
2046 } 2052 }
2047 2053
2048 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2054 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2049 const base::Callback<base::Time()>& get_timestamp_callback) { 2055 const base::Callback<base::Time()>& get_timestamp_callback) {
2050 get_timestamp_callback_ = get_timestamp_callback; 2056 get_timestamp_callback_ = get_timestamp_callback;
2051 } 2057 }
2052 2058
2053 } // namespace content 2059 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698