summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-30 15:54:27 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-30 15:54:27 +0000
commit457736d616063332e3bebe52631f819180cc3e24 (patch)
tree1079bfb49cc74f288a3f28932ae49fc4e3c80ae9 /content/renderer
parent80e23f42c4bb136c0907ce217a956aae3a05951a (diff)
downloadchromium_src-457736d616063332e3bebe52631f819180cc3e24.zip
chromium_src-457736d616063332e3bebe52631f819180cc3e24.tar.gz
chromium_src-457736d616063332e3bebe52631f819180cc3e24.tar.bz2
Move didFinishResourceLoad to RenderFrameHost.
BUG=361761 TEST=no visible change Review URL: https://codereview.chromium.org/262493002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267230 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/render_frame_impl.cc43
-rw-r--r--content/renderer/render_frame_impl.h5
-rw-r--r--content/renderer/render_view_impl.cc41
-rw-r--r--content/renderer/render_view_impl.h8
4 files changed, 41 insertions, 56 deletions
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index f7f77fa..2a9f733 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -48,6 +48,7 @@
#include "content/renderer/browser_plugin/browser_plugin_manager.h"
#include "content/renderer/child_frame_compositing_helper.h"
#include "content/renderer/context_menu_params_builder.h"
+#include "content/renderer/devtools/devtools_agent.h"
#include "content/renderer/dom_automation_controller.h"
#include "content/renderer/history_controller.h"
#include "content/renderer/history_serialization.h"
@@ -1145,6 +1146,20 @@ bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type,
return success;
}
+void RenderFrameImpl::LoadNavigationErrorPage(
+ const WebURLRequest& failed_request,
+ const WebURLError& error,
+ bool replace) {
+ std::string error_html;
+ GetContentClient()->renderer()->GetNavigationErrorStrings(
+ render_view(), frame_, failed_request, error, &error_html, NULL);
+
+ frame_->loadHTMLString(error_html,
+ GURL(kUnreachableWebDataURL),
+ error.unreachableURL,
+ replace);
+}
+
void RenderFrameImpl::DidCommitCompositorFrame() {
if (compositing_helper_)
compositing_helper_->DidCommitCompositorFrame();
@@ -1774,8 +1789,7 @@ void RenderFrameImpl::didFailProvisionalLoad(blink::WebLocalFrame* frame,
}
// Load an error page.
- render_view_->LoadNavigationErrorPage(
- frame, failed_request, error, replace);
+ LoadNavigationErrorPage(failed_request, error, replace);
}
void RenderFrameImpl::didCommitProvisionalLoad(
@@ -2401,11 +2415,26 @@ void RenderFrameImpl::didReceiveResponse(
void RenderFrameImpl::didFinishResourceLoad(blink::WebLocalFrame* frame,
unsigned identifier) {
DCHECK(!frame_ || frame_ == frame);
- // TODO(nasko): Move implementation here. Needed state:
- // * devtools_agent_
- // Needed methods:
- // * LoadNavigationErrorPage
- render_view_->didFinishResourceLoad(frame, identifier);
+ InternalDocumentStateData* internal_data =
+ InternalDocumentStateData::FromDataSource(frame->dataSource());
+ if (!internal_data->use_error_page())
+ return;
+
+ // Do not show error page when DevTools is attached.
+ if (render_view_->devtools_agent_->IsAttached())
+ return;
+
+ // Display error page, if appropriate.
+ std::string error_domain = "http";
+ int http_status_code = internal_data->http_status_code();
+ if (GetContentClient()->renderer()->HasErrorPage(
+ http_status_code, &error_domain)) {
+ WebURLError error;
+ error.unreachableURL = frame->document().url();
+ error.domain = WebString::fromUTF8(error_domain);
+ error.reason = http_status_code;
+ LoadNavigationErrorPage(frame->dataSource()->request(), error, true);
+ }
}
void RenderFrameImpl::didLoadResourceFromMemoryCache(
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 5d8f9bc..fcd8e52 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -468,6 +468,11 @@ class CONTENT_EXPORT RenderFrameImpl
const GURL& frame_url,
base::string16* result);
+ // Loads the appropriate error page for the specified failure into the frame.
+ void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
+ const blink::WebURLError& error,
+ bool replace);
+
// Stores the WebLocalFrame we are associated with.
blink::WebLocalFrame* frame_;
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index e66d313..d2745ee 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1402,23 +1402,6 @@ void RenderViewImpl::SendUpdateState(const WebHistoryItem& item) {
routing_id_, page_id_, HistoryItemToPageState(item)));
}
-// WebViewDelegate ------------------------------------------------------------
-
-void RenderViewImpl::LoadNavigationErrorPage(
- WebFrame* frame,
- const WebURLRequest& failed_request,
- const WebURLError& error,
- bool replace) {
- std::string error_html;
- GetContentClient()->renderer()->GetNavigationErrorStrings(
- this, frame, failed_request, error, &error_html, NULL);
-
- frame->loadHTMLString(error_html,
- GURL(kUnreachableWebDataURL),
- error.unreachableURL,
- replace);
-}
-
bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) {
// Before WebKit asks us to show an alert (etc.), it takes care of doing the
// equivalent of WebView::willEnterModalLoop. In the case of showModalDialog
@@ -2369,30 +2352,6 @@ void RenderViewImpl::didUpdateCurrentHistoryItem(WebLocalFrame* frame) {
StartNavStateSyncTimerIfNecessary();
}
-void RenderViewImpl::didFinishResourceLoad(WebLocalFrame* frame,
- unsigned identifier) {
- InternalDocumentStateData* internal_data =
- InternalDocumentStateData::FromDataSource(frame->dataSource());
- if (!internal_data->use_error_page())
- return;
-
- // Do not show error page when DevTools is attached.
- if (devtools_agent_->IsAttached())
- return;
-
- // Display error page, if appropriate.
- std::string error_domain = "http";
- int http_status_code = internal_data->http_status_code();
- if (GetContentClient()->renderer()->HasErrorPage(
- http_status_code, &error_domain)) {
- WebURLError error;
- error.unreachableURL = frame->document().url();
- error.domain = WebString::fromUTF8(error_domain);
- error.reason = http_status_code;
- LoadNavigationErrorPage(frame, frame->dataSource()->request(), error, true);
- }
-}
-
void RenderViewImpl::CheckPreferredSize() {
// We don't always want to send the change messages over IPC, only if we've
// been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode|
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index e33baaa..676f12c 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -272,12 +272,6 @@ class CONTENT_EXPORT RenderViewImpl
bool ScheduleFileChooser(const FileChooserParams& params,
blink::WebFileChooserCompletion* completion);
- void LoadNavigationErrorPage(
- blink::WebFrame* frame,
- const blink::WebURLRequest& failed_request,
- const blink::WebURLError& error,
- bool replace);
-
#if defined(OS_ANDROID)
void DismissDateTimeDialog();
#endif
@@ -693,8 +687,6 @@ class CONTENT_EXPORT RenderViewImpl
void didChangeIcon(blink::WebLocalFrame*, blink::WebIconURL::Type);
void didHandleOnloadEvents(blink::WebLocalFrame* frame);
void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
- void didFinishResourceLoad(blink::WebLocalFrame* frame,
- unsigned identifier);
void didChangeScrollOffset(blink::WebLocalFrame* frame);
void didFirstVisuallyNonEmptyLayout(blink::WebLocalFrame*);
void didChangeContentsSize(blink::WebLocalFrame* frame,