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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 22622003: Ensure that renderer-initiated pending entries can be replaced when a new navigation is started. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflicts. Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/web_contents/navigation_controller_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 int64 parent_frame_id, 2126 int64 parent_frame_id,
2127 bool is_main_frame, 2127 bool is_main_frame,
2128 const GURL& url) { 2128 const GURL& url) {
2129 bool is_error_page = (url.spec() == kUnreachableWebDataURL); 2129 bool is_error_page = (url.spec() == kUnreachableWebDataURL);
2130 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); 2130 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL);
2131 GURL validated_url(url); 2131 GURL validated_url(url);
2132 RenderProcessHost* render_process_host = 2132 RenderProcessHost* render_process_host =
2133 render_view_host->GetProcess(); 2133 render_view_host->GetProcess();
2134 RenderViewHost::FilterURL(render_process_host, false, &validated_url); 2134 RenderViewHost::FilterURL(render_process_host, false, &validated_url);
2135 2135
2136 if (is_main_frame) 2136 if (is_main_frame) {
2137 DidChangeLoadProgress(0); 2137 DidChangeLoadProgress(0);
2138 2138
2139 // Create a pending entry for this provisional load (if none exists) using the 2139 // If there is no browser-initiated pending entry for this navigation and it
2140 // current SiteInstance, and ensure the address bar updates accordingly. 2140 // is not for the error URL, create a pending entry using the current
2141 // We don't know the referrer or extra headers at this point, but the referrer 2141 // SiteInstance, and ensure the address bar updates accordingly. We don't
2142 // will be set properly upon commit. 2142 // know the referrer or extra headers at this point, but the referrer will
2143 if (is_main_frame && !controller_.GetPendingEntry()) { 2143 // be set properly upon commit.
2144 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( 2144 NavigationEntry* pending_entry = controller_.GetPendingEntry();
2145 controller_.CreateNavigationEntry(validated_url, 2145 bool has_browser_initiated_pending_entry = pending_entry &&
2146 content::Referrer(), 2146 !NavigationEntryImpl::FromNavigationEntry(pending_entry)->
2147 content::PAGE_TRANSITION_LINK, 2147 is_renderer_initiated();
2148 true /* is_renderer_initiated */, 2148 if (!has_browser_initiated_pending_entry && !is_error_page) {
2149 std::string(), GetBrowserContext())); 2149 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
2150 entry->set_site_instance( 2150 controller_.CreateNavigationEntry(validated_url,
2151 static_cast<SiteInstanceImpl*>(GetSiteInstance())); 2151 content::Referrer(),
2152 controller_.SetPendingEntry(entry); 2152 content::PAGE_TRANSITION_LINK,
2153 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); 2153 true /* is_renderer_initiated */,
2154 std::string(),
2155 GetBrowserContext()));
2156 entry->set_site_instance(
2157 static_cast<SiteInstanceImpl*>(GetSiteInstance()));
2158 controller_.SetPendingEntry(entry);
2159 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL);
2160 }
2154 } 2161 }
2155 2162
2156 // Notify observers about the start of the provisional load. 2163 // Notify observers about the start of the provisional load.
2157 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2164 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2158 DidStartProvisionalLoadForFrame(frame_id, parent_frame_id, 2165 DidStartProvisionalLoadForFrame(frame_id, parent_frame_id,
2159 is_main_frame, validated_url, is_error_page, 2166 is_main_frame, validated_url, is_error_page,
2160 is_iframe_srcdoc, render_view_host)); 2167 is_iframe_srcdoc, render_view_host));
2161 2168
2162 if (is_main_frame) { 2169 if (is_main_frame) {
2163 // Notify observers about the provisional change in the main frame URL. 2170 // Notify observers about the provisional change in the main frame URL.
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after
3708 } 3715 }
3709 3716
3710 void WebContentsImpl::ClearAllPowerSaveBlockers() { 3717 void WebContentsImpl::ClearAllPowerSaveBlockers() {
3711 for (PowerSaveBlockerMap::iterator i(power_save_blockers_.begin()); 3718 for (PowerSaveBlockerMap::iterator i(power_save_blockers_.begin());
3712 i != power_save_blockers_.end(); ++i) 3719 i != power_save_blockers_.end(); ++i)
3713 STLDeleteValues(&power_save_blockers_[i->first]); 3720 STLDeleteValues(&power_save_blockers_[i->first]);
3714 power_save_blockers_.clear(); 3721 power_save_blockers_.clear();
3715 } 3722 }
3716 3723
3717 } // namespace content 3724 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/navigation_controller_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698