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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 8142032: Add error description to the DidFailProvisionalLoad callback. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase Created 9 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 } 1245 }
1246 1246
1247 // WebViewDelegate ------------------------------------------------------------ 1247 // WebViewDelegate ------------------------------------------------------------
1248 1248
1249 void RenderViewImpl::LoadNavigationErrorPage( 1249 void RenderViewImpl::LoadNavigationErrorPage(
1250 WebFrame* frame, 1250 WebFrame* frame,
1251 const WebURLRequest& failed_request, 1251 const WebURLRequest& failed_request,
1252 const WebURLError& error, 1252 const WebURLError& error,
1253 const std::string& html, 1253 const std::string& html,
1254 bool replace) { 1254 bool replace) {
1255 std::string alt_html = !html.empty() ? html : 1255 std::string alt_html;
1256 content::GetContentClient()->renderer()->GetNavigationErrorHtml( 1256 const std::string* error_html;
1257 failed_request, error); 1257
1258 frame->loadHTMLString(alt_html, 1258 if (!html.empty()) {
1259 error_html = &html;
1260 } else {
1261 content::GetContentClient()->renderer()->GetNavigationErrorStrings(
1262 failed_request, error, &alt_html, NULL);
1263 error_html = &alt_html;
1264 }
1265
1266 frame->loadHTMLString(*error_html,
1259 GURL(chrome::kUnreachableWebDataURL), 1267 GURL(chrome::kUnreachableWebDataURL),
1260 error.unreachableURL, 1268 error.unreachableURL,
1261 replace); 1269 replace);
1262 } 1270 }
1263 1271
1264 bool RenderViewImpl::RunJavaScriptMessage(int type, 1272 bool RenderViewImpl::RunJavaScriptMessage(int type,
1265 const string16& message, 1273 const string16& message,
1266 const string16& default_value, 1274 const string16& default_value,
1267 const GURL& frame_url, 1275 const GURL& frame_url,
1268 string16* result) { 1276 string16* result) {
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
2345 DCHECK(ds); 2353 DCHECK(ds);
2346 2354
2347 const WebURLRequest& failed_request = ds->request(); 2355 const WebURLRequest& failed_request = ds->request();
2348 2356
2349 FOR_EACH_OBSERVER( 2357 FOR_EACH_OBSERVER(
2350 RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error)); 2358 RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error));
2351 2359
2352 bool show_repost_interstitial = 2360 bool show_repost_interstitial =
2353 (error.reason == net::ERR_CACHE_MISS && 2361 (error.reason == net::ERR_CACHE_MISS &&
2354 EqualsASCII(failed_request.httpMethod(), "POST")); 2362 EqualsASCII(failed_request.httpMethod(), "POST"));
2363
2364 ViewHostMsg_DidFailProvisionalLoadWithError_Params params;
2365 params.frame_id = frame->identifier();
2366 params.is_main_frame = !frame->parent();
2367 params.error_code = error.reason;
2368 content::GetContentClient()->renderer()->GetNavigationErrorStrings(
2369 failed_request,
2370 error,
2371 NULL,
2372 &params.error_description);
2373 params.url = error.unreachableURL;
2374 params.showing_repost_interstitial = show_repost_interstitial;
2355 Send(new ViewHostMsg_DidFailProvisionalLoadWithError( 2375 Send(new ViewHostMsg_DidFailProvisionalLoadWithError(
2356 routing_id_, frame->identifier(), !frame->parent(), error.reason, 2376 routing_id_, params));
2357 error.unreachableURL, show_repost_interstitial));
2358 2377
2359 // Don't display an error page if this is simply a cancelled load. Aside 2378 // Don't display an error page if this is simply a cancelled load. Aside
2360 // from being dumb, WebCore doesn't expect it and it will cause a crash. 2379 // from being dumb, WebCore doesn't expect it and it will cause a crash.
2361 if (error.reason == net::ERR_ABORTED) 2380 if (error.reason == net::ERR_ABORTED)
2362 return; 2381 return;
2363 2382
2364 // Make sure we never show errors in view source mode. 2383 // Make sure we never show errors in view source mode.
2365 frame->enableViewSourceMode(false); 2384 frame->enableViewSourceMode(false);
2366 2385
2367 NavigationState* navigation_state = NavigationState::FromDataSource(ds); 2386 NavigationState* navigation_state = NavigationState::FromDataSource(ds);
(...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after
4559 pepper_delegate_.OnLockMouseACK(succeeded); 4578 pepper_delegate_.OnLockMouseACK(succeeded);
4560 } 4579 }
4561 4580
4562 void RenderViewImpl::OnMouseLockLost() { 4581 void RenderViewImpl::OnMouseLockLost() {
4563 pepper_delegate_.OnMouseLockLost(); 4582 pepper_delegate_.OnMouseLockLost();
4564 } 4583 }
4565 4584
4566 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 4585 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
4567 return webview()->settings()->useThreadedCompositor(); 4586 return webview()->settings()->useThreadedCompositor();
4568 } 4587 }
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | content/shell/shell_content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698