Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index 2dc96f0797988da8b42fc044b0293e5b8d5b1f88..b1ce22bde6e96f57e4beb52d863f2f2ee12b05ac 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -35,6 +35,8 @@ |
#include "content/browser/host_zoom_map_impl.h" |
#include "content/browser/loader/resource_dispatcher_host_impl.h" |
#include "content/browser/power_save_blocker_impl.h" |
+#include "content/browser/renderer_host/navigator.h" |
+#include "content/browser/renderer_host/render_frame_host_impl.h" |
#include "content/browser/renderer_host/render_process_host_impl.h" |
#include "content/browser/renderer_host/render_view_host_impl.h" |
#include "content/browser/renderer_host/render_widget_host_impl.h" |
@@ -372,6 +374,7 @@ WebContentsImpl::WebContentsImpl( |
fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { |
for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
g_created_callbacks.Get().at(i).Run(this); |
+ frame_tree_.Init(&controller_, this); |
frame_tree_.SetFrameRemoveListener( |
base::Bind(&WebContentsImpl::OnFrameRemoved, |
base::Unretained(this))); |
@@ -2156,58 +2159,32 @@ void WebContentsImpl::SetFocusToLocationBar(bool select_all) { |
delegate_->SetFocusToLocationBar(select_all); |
} |
-void WebContentsImpl::DidStartProvisionalLoadForFrame( |
- RenderViewHost* render_view_host, |
+void WebContentsImpl::DidStartProvisionalLoad( |
int64 frame_id, |
int64 parent_frame_id, |
bool is_main_frame, |
- const GURL& url) { |
- bool is_error_page = (url.spec() == kUnreachableWebDataURL); |
- bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); |
- GURL validated_url(url); |
- RenderProcessHost* render_process_host = |
- render_view_host->GetProcess(); |
- RenderViewHost::FilterURL(render_process_host, false, &validated_url); |
- |
- if (is_main_frame) { |
- DidChangeLoadProgress(0); |
- |
- // If there is no browser-initiated pending entry for this navigation and it |
- // is not for the error URL, create a pending entry using the current |
- // SiteInstance, and ensure the address bar updates accordingly. We don't |
- // know the referrer or extra headers at this point, but the referrer will |
- // be set properly upon commit. |
- NavigationEntry* pending_entry = controller_.GetPendingEntry(); |
- bool has_browser_initiated_pending_entry = pending_entry && |
- !NavigationEntryImpl::FromNavigationEntry(pending_entry)-> |
- is_renderer_initiated(); |
- if (!has_browser_initiated_pending_entry && !is_error_page) { |
- NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
- controller_.CreateNavigationEntry(validated_url, |
- content::Referrer(), |
- content::PAGE_TRANSITION_LINK, |
- true /* is_renderer_initiated */, |
- std::string(), |
- GetBrowserContext())); |
- entry->set_site_instance( |
- static_cast<SiteInstanceImpl*>(GetSiteInstance())); |
- controller_.SetPendingEntry(entry); |
- NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); |
- } |
- } |
- |
- // Notify observers about the start of the provisional load. |
+ const GURL& validated_url, |
+ bool is_error_page, |
+ bool is_iframe_srcdoc, |
+ RenderFrameHost* render_frame_host) { |
+ DidChangeLoadProgress(0); |
+ |
+ RenderFrameHostImpl* rfh = |
+ static_cast<RenderFrameHostImpl*>(render_frame_host); |
FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
DidStartProvisionalLoadForFrame(frame_id, parent_frame_id, |
is_main_frame, validated_url, is_error_page, |
- is_iframe_srcdoc, render_view_host)); |
+ is_iframe_srcdoc, rfh->render_view_host())); |
+} |
- if (is_main_frame) { |
- // Notify observers about the provisional change in the main frame URL. |
- FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
- ProvisionalChangeToMainFrameUrl(validated_url, |
- render_view_host)); |
- } |
+void WebContentsImpl::ProvisionalChangeToMainFrameUrl( |
+ const GURL& url, |
+ RenderFrameHost* render_frame_host) { |
+ RenderFrameHostImpl* rfh = |
+ static_cast<RenderFrameHostImpl*>(render_frame_host); |
+ FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
+ ProvisionalChangeToMainFrameUrl( |
+ url, rfh->render_view_host())); |
} |
void WebContentsImpl::DidRedirectProvisionalLoad( |
@@ -2287,7 +2264,7 @@ void WebContentsImpl::DidFailProvisionalLoadWithError( |
// cases that we don't show the pending entry (e.g., renderer-initiated |
// navigations in an existing tab), we don't keep it around. That prevents |
// spoofs on in-page navigations that don't go through |
- // DidStartProvisionalLoadForFrame. |
+ // DidStartProvisionalLoad. |
// In general, we allow the view to clear the pending entry and typed URL if |
// the user requests (e.g., hitting Escape with focus in the address bar). |
// Note: don't touch the transient entry, since an interstitial may exist. |