summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc29
-rw-r--r--content/browser/renderer_host/render_view_host_impl.h11
-rw-r--r--content/browser/web_contents/web_contents_impl.cc80
-rw-r--r--content/browser/web_contents/web_contents_impl.h27
-rw-r--r--content/public/browser/render_view_host_delegate.h26
5 files changed, 127 insertions, 46 deletions
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 2e38aa2..fd4e26c 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -906,6 +906,12 @@ bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnMsgRunModal)
IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady)
IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame,
+ OnMsgDidStartProvisionalLoadForFrame)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad,
+ OnMsgDidRedirectProvisionalLoad)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailProvisionalLoadWithError,
+ OnMsgDidFailProvisionalLoadWithError)
IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FrameNavigate, OnMsgNavigate(msg))
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnMsgUpdateState)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle)
@@ -1085,6 +1091,29 @@ void RenderViewHostImpl::OnMsgRenderViewGone(int status, int exit_code) {
exit_code);
}
+void RenderViewHostImpl::OnMsgDidStartProvisionalLoadForFrame(
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& opener_url,
+ const GURL& url) {
+ delegate_->DidStartProvisionalLoadForFrame(
+ this, frame_id, is_main_frame, opener_url, url);
+}
+
+void RenderViewHostImpl::OnMsgDidRedirectProvisionalLoad(
+ int32 page_id,
+ const GURL& opener_url,
+ const GURL& source_url,
+ const GURL& target_url) {
+ delegate_->DidRedirectProvisionalLoad(
+ this, page_id, opener_url, source_url, target_url);
+}
+
+void RenderViewHostImpl::OnMsgDidFailProvisionalLoadWithError(
+ const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) {
+ delegate_->DidFailProvisionalLoadWithError(this, params);
+}
+
// Called when the renderer navigates. For every frame loaded, we'll get this
// notification containing parameters identifying the navigation.
//
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index 6f3ccf0..1bac85b 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -35,6 +35,7 @@ class ViewMsg_Navigate;
struct AccessibilityHostMsg_NotificationParams;
struct MediaPlayerAction;
struct ViewHostMsg_CreateWindow_Params;
+struct ViewHostMsg_DidFailProvisionalLoadWithError_Params;
struct ViewHostMsg_ShowPopup_Params;
struct ViewMsg_Navigate_Params;
struct ViewMsg_StopFinding_Params;
@@ -441,6 +442,16 @@ class CONTENT_EXPORT RenderViewHostImpl
void OnMsgRunModal(IPC::Message* reply_msg);
void OnMsgRenderViewReady();
void OnMsgRenderViewGone(int status, int error_code);
+ void OnMsgDidStartProvisionalLoadForFrame(int64 frame_id,
+ bool main_frame,
+ const GURL& opener_url,
+ const GURL& url);
+ void OnMsgDidRedirectProvisionalLoad(int32 page_id,
+ const GURL& opener_url,
+ const GURL& source_url,
+ const GURL& target_url);
+ void OnMsgDidFailProvisionalLoadWithError(
+ const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params);
void OnMsgNavigate(const IPC::Message& msg);
void OnMsgUpdateState(int32 page_id,
const std::string& state);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 2bdb987..2aba4bc 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -568,12 +568,6 @@ bool WebContentsImpl::OnMessageReceived(const IPC::Message& message) {
OnRegisterIntentService)
IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentDispatch,
OnWebIntentDispatch)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame,
- OnDidStartProvisionalLoadForFrame)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad,
- OnDidRedirectProvisionalLoad)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailProvisionalLoadWithError,
- OnDidFailProvisionalLoadWithError)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache,
OnDidLoadResourceFromMemoryCache)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent,
@@ -1488,31 +1482,34 @@ void WebContentsImpl::OnWebIntentDispatch(
delegate_->WebIntentDispatch(this, intents_dispatcher);
}
-void WebContentsImpl::OnDidStartProvisionalLoadForFrame(int64 frame_id,
- bool is_main_frame,
- const GURL& opener_url,
- const GURL& url) {
+void WebContentsImpl::DidStartProvisionalLoadForFrame(
+ content::RenderViewHost* render_view_host,
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& opener_url,
+ const GURL& url) {
bool is_error_page = (url.spec() == content::kUnreachableWebDataURL);
GURL validated_url(url);
GURL validated_opener_url(opener_url);
- GetRenderViewHostImpl()->FilterURL(
+ RenderViewHostImpl* render_view_host_impl =
+ static_cast<RenderViewHostImpl*>(render_view_host);
+ content::RenderProcessHost* render_process_host =
+ render_view_host->GetProcess();
+ render_view_host_impl->FilterURL(
ChildProcessSecurityPolicyImpl::GetInstance(),
- GetRenderProcessHost()->GetID(),
+ render_process_host->GetID(),
false,
&validated_url);
- GetRenderViewHostImpl()->FilterURL(
+ render_view_host_impl->FilterURL(
ChildProcessSecurityPolicyImpl::GetInstance(),
- GetRenderProcessHost()->GetID(),
+ render_process_host->GetID(),
true,
&validated_opener_url);
- RenderViewHost* rvh =
- render_manager_.pending_render_view_host() ?
- render_manager_.pending_render_view_host() : GetRenderViewHost();
// Notify observers about the start of the provisional load.
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
DidStartProvisionalLoadForFrame(frame_id, is_main_frame,
- validated_url, is_error_page, rvh));
+ validated_url, is_error_page, render_view_host));
if (is_main_frame) {
// Notify observers about the provisional change in the main frame URL.
@@ -1522,36 +1519,44 @@ void WebContentsImpl::OnDidStartProvisionalLoadForFrame(int64 frame_id,
}
}
-void WebContentsImpl::OnDidRedirectProvisionalLoad(int32 page_id,
- const GURL& opener_url,
- const GURL& source_url,
- const GURL& target_url) {
+void WebContentsImpl::DidRedirectProvisionalLoad(
+ content::RenderViewHost* render_view_host,
+ int32 page_id,
+ const GURL& opener_url,
+ const GURL& source_url,
+ const GURL& target_url) {
// TODO(creis): Remove this method and have the pre-rendering code listen to
// the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification
// instead. See http://crbug.com/78512.
GURL validated_source_url(source_url);
GURL validated_target_url(target_url);
GURL validated_opener_url(opener_url);
- GetRenderViewHostImpl()->FilterURL(
+ RenderViewHostImpl* render_view_host_impl =
+ static_cast<RenderViewHostImpl*>(render_view_host);
+ content::RenderProcessHost* render_process_host =
+ render_view_host->GetProcess();
+ render_view_host_impl->FilterURL(
ChildProcessSecurityPolicyImpl::GetInstance(),
- GetRenderProcessHost()->GetID(),
+ render_process_host->GetID(),
false,
&validated_source_url);
- GetRenderViewHostImpl()->FilterURL(
+ render_view_host_impl->FilterURL(
ChildProcessSecurityPolicyImpl::GetInstance(),
- GetRenderProcessHost()->GetID(),
+ render_process_host->GetID(),
false,
&validated_target_url);
- GetRenderViewHostImpl()->FilterURL(
+ render_view_host_impl->FilterURL(
ChildProcessSecurityPolicyImpl::GetInstance(),
- GetRenderProcessHost()->GetID(),
+ render_process_host->GetID(),
true,
&validated_opener_url);
NavigationEntry* entry;
- if (page_id == -1)
+ if (page_id == -1) {
entry = controller_.GetPendingEntry();
- else
- entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id);
+ } else {
+ entry = controller_.GetEntryWithPageID(render_view_host->GetSiteInstance(),
+ page_id);
+ }
if (!entry || entry->GetURL() != validated_source_url)
return;
@@ -1561,7 +1566,8 @@ void WebContentsImpl::OnDidRedirectProvisionalLoad(int32 page_id,
validated_opener_url));
}
-void WebContentsImpl::OnDidFailProvisionalLoadWithError(
+void WebContentsImpl::DidFailProvisionalLoadWithError(
+ content::RenderViewHost* render_view_host,
const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) {
VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec()
<< ", error_code: " << params.error_code
@@ -1571,9 +1577,13 @@ void WebContentsImpl::OnDidFailProvisionalLoadWithError(
params.showing_repost_interstitial
<< ", frame_id: " << params.frame_id;
GURL validated_url(params.url);
- GetRenderViewHostImpl()->FilterURL(
+ RenderViewHostImpl* render_view_host_impl =
+ static_cast<RenderViewHostImpl*>(render_view_host);
+ content::RenderProcessHost* render_process_host =
+ render_view_host->GetProcess();
+ render_view_host_impl->FilterURL(
ChildProcessSecurityPolicyImpl::GetInstance(),
- GetRenderProcessHost()->GetID(),
+ render_process_host->GetID(),
false,
&validated_url);
@@ -1612,7 +1622,7 @@ void WebContentsImpl::OnDidFailProvisionalLoadWithError(
if (controller_.GetPendingEntry())
DidCancelLoading();
- render_manager_.RendererAbortedProvisionalLoad(GetRenderViewHost());
+ render_manager_.RendererAbortedProvisionalLoad(render_view_host);
}
FOR_EACH_OBSERVER(WebContentsObserver,
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 07d0dcd..934ad7a5 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -35,7 +35,6 @@
class InterstitialPageImpl;
class SavePackage;
class SessionStorageNamespaceImpl;
-struct ViewHostMsg_DidFailProvisionalLoadWithError_Params;
namespace content {
class ColorChooser;
@@ -257,6 +256,22 @@ class CONTENT_EXPORT WebContentsImpl
int error_code) OVERRIDE;
virtual void RenderViewDeleted(
content::RenderViewHost* render_view_host) OVERRIDE;
+ virtual void DidStartProvisionalLoadForFrame(
+ content::RenderViewHost* render_view_host,
+ int64 frame_id,
+ bool main_frame,
+ const GURL& opener_url,
+ const GURL& url) OVERRIDE;
+ virtual void DidRedirectProvisionalLoad(
+ content::RenderViewHost* render_view_host,
+ int32 page_id,
+ const GURL& opener_url,
+ const GURL& source_url,
+ const GURL& target_url) OVERRIDE;
+ virtual void DidFailProvisionalLoadWithError(
+ content::RenderViewHost* render_view_host,
+ const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params)
+ OVERRIDE;
virtual void DidNavigate(
content::RenderViewHost* render_view_host,
const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
@@ -413,16 +428,6 @@ class CONTENT_EXPORT WebContentsImpl
const string16& disposition);
void OnWebIntentDispatch(const webkit_glue::WebIntentData& intent,
int intent_id);
- void OnDidStartProvisionalLoadForFrame(int64 frame_id,
- bool main_frame,
- const GURL& opener_url,
- const GURL& url);
- void OnDidRedirectProvisionalLoad(int32 page_id,
- const GURL& opener_url,
- const GURL& source_url,
- const GURL& target_url);
- void OnDidFailProvisionalLoadWithError(
- const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params);
void OnDidLoadResourceFromMemoryCache(const GURL& url,
const std::string& security_info,
const std::string& http_request,
diff --git a/content/public/browser/render_view_host_delegate.h b/content/public/browser/render_view_host_delegate.h
index 3750266..4d43760 100644
--- a/content/public/browser/render_view_host_delegate.h
+++ b/content/public/browser/render_view_host_delegate.h
@@ -28,6 +28,7 @@ class WebContentsImpl;
class WebKeyboardEvent;
struct NativeWebKeyboardEvent;
struct ViewHostMsg_CreateWindow_Params;
+struct ViewHostMsg_DidFailProvisionalLoadWithError_Params;
struct ViewHostMsg_FrameNavigate_Params;
struct WebDropData;
struct WebMenuItem;
@@ -227,6 +228,31 @@ class CONTENT_EXPORT RenderViewHostDelegate : public IPC::Channel::Listener {
// RenderView is going to be destroyed
virtual void RenderViewDeleted(RenderViewHost* render_view_host) {}
+ // The RenderView started a provisional load for a given frame.
+ virtual void DidStartProvisionalLoadForFrame(
+ content::RenderViewHost* render_view_host,
+ int64 frame_id,
+ bool main_frame,
+ const GURL& opener_url,
+ const GURL& url) {}
+
+ // The RenderView processed a redirect during a provisional load.
+ //
+ // TODO(creis): Remove this method and have the pre-rendering code listen to
+ // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification
+ // instead. See http://crbug.com/78512.
+ virtual void DidRedirectProvisionalLoad(
+ content::RenderViewHost* render_view_host,
+ int32 page_id,
+ const GURL& opener_url,
+ const GURL& source_url,
+ const GURL& target_url) {}
+
+ // A provisional load in the RenderView failed.
+ virtual void DidFailProvisionalLoadWithError(
+ content::RenderViewHost* render_view_host,
+ const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) {}
+
// The RenderView was navigated to a different page.
virtual void DidNavigate(RenderViewHost* render_view_host,
const ViewHostMsg_FrameNavigate_Params& params) {}