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

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

Issue 8142032: Add error description to the DidFailProvisionalLoad callback. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update commit message with BUG and TEST fields 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.h" 5 #include "content/renderer/render_view.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 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 frame->identifier())); 1252 frame->identifier()));
1253 } 1253 }
1254 1254
1255 // WebViewDelegate ------------------------------------------------------------ 1255 // WebViewDelegate ------------------------------------------------------------
1256 1256
1257 void RenderView::LoadNavigationErrorPage(WebFrame* frame, 1257 void RenderView::LoadNavigationErrorPage(WebFrame* frame,
1258 const WebURLRequest& failed_request, 1258 const WebURLRequest& failed_request,
1259 const WebURLError& error, 1259 const WebURLError& error,
1260 const std::string& html, 1260 const std::string& html,
1261 bool replace) { 1261 bool replace) {
1262 std::string alt_html = !html.empty() ? html : 1262 std::string alt_html;
1263 content::GetContentClient()->renderer()->GetNavigationErrorHtml( 1263 const std::string* error_html;
1264 failed_request, error); 1264
1265 frame->loadHTMLString(alt_html, 1265 if (!html.empty()) {
1266 error_html = &html;
1267 } else {
1268 content::GetContentClient()->renderer()->GetNavigationErrorStrings(
1269 failed_request, error, &alt_html, NULL);
1270 error_html = &alt_html;
1271 }
1272
1273 frame->loadHTMLString(*error_html,
1266 GURL(chrome::kUnreachableWebDataURL), 1274 GURL(chrome::kUnreachableWebDataURL),
1267 error.unreachableURL, 1275 error.unreachableURL,
1268 replace); 1276 replace);
1269 } 1277 }
1270 1278
1271 bool RenderView::RunJavaScriptMessage(int type, 1279 bool RenderView::RunJavaScriptMessage(int type,
1272 const string16& message, 1280 const string16& message,
1273 const string16& default_value, 1281 const string16& default_value,
1274 const GURL& frame_url, 1282 const GURL& frame_url,
1275 string16* result) { 1283 string16* result) {
(...skipping 1069 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 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after
4452 pepper_delegate_.OnLockMouseACK(succeeded); 4471 pepper_delegate_.OnLockMouseACK(succeeded);
4453 } 4472 }
4454 4473
4455 void RenderView::OnMouseLockLost() { 4474 void RenderView::OnMouseLockLost() {
4456 pepper_delegate_.OnMouseLockLost(); 4475 pepper_delegate_.OnMouseLockLost();
4457 } 4476 }
4458 4477
4459 bool RenderView::WebWidgetHandlesCompositorScheduling() const { 4478 bool RenderView::WebWidgetHandlesCompositorScheduling() const {
4460 return webview()->settings()->useThreadedCompositor(); 4479 return webview()->settings()->useThreadedCompositor();
4461 } 4480 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698