OLD | NEW |
---|---|
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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1244 routing_id_, url, referrer, NavigationPolicyToDisposition(policy))); | 1244 routing_id_, url, referrer, NavigationPolicyToDisposition(policy))); |
1245 } | 1245 } |
1246 | 1246 |
1247 // WebViewDelegate ------------------------------------------------------------ | 1247 // WebViewDelegate ------------------------------------------------------------ |
1248 | 1248 |
1249 void RenderView::LoadNavigationErrorPage(WebFrame* frame, | 1249 void RenderView::LoadNavigationErrorPage(WebFrame* frame, |
1250 const WebURLRequest& failed_request, | 1250 const WebURLRequest& failed_request, |
1251 const WebURLError& error, | 1251 const WebURLError& error, |
1252 const std::string& html, | 1252 const std::string& html, |
1253 bool replace) { | 1253 bool replace) { |
1254 std::string alt_html = !html.empty() ? html : | 1254 std::string alt_html; |
1255 content::GetContentClient()->renderer()->GetNavigationErrorHtml( | 1255 const std::string* error_html; |
1256 failed_request, error); | 1256 |
1257 frame->loadHTMLString(alt_html, | 1257 if (!html.empty()) |
mmenke
2011/10/07 14:19:44
nit: Use brackets here, too, since you use them w
mkosiba (inactive)
2011/10/07 15:46:11
Done.
| |
1258 error_html = &html; | |
1259 else { | |
1260 content::GetContentClient()->renderer()->GetNavigationErrorStrings( | |
1261 failed_request, error, &alt_html, NULL); | |
1262 error_html = &alt_html; | |
1263 } | |
1264 | |
1265 frame->loadHTMLString(*error_html, | |
1258 GURL(chrome::kUnreachableWebDataURL), | 1266 GURL(chrome::kUnreachableWebDataURL), |
1259 error.unreachableURL, | 1267 error.unreachableURL, |
1260 replace); | 1268 replace); |
1261 } | 1269 } |
1262 | 1270 |
1263 bool RenderView::RunJavaScriptMessage(int type, | 1271 bool RenderView::RunJavaScriptMessage(int type, |
1264 const string16& message, | 1272 const string16& message, |
1265 const string16& default_value, | 1273 const string16& default_value, |
1266 const GURL& frame_url, | 1274 const GURL& frame_url, |
1267 string16* result) { | 1275 string16* result) { |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2333 DCHECK(ds); | 2341 DCHECK(ds); |
2334 | 2342 |
2335 const WebURLRequest& failed_request = ds->request(); | 2343 const WebURLRequest& failed_request = ds->request(); |
2336 | 2344 |
2337 FOR_EACH_OBSERVER( | 2345 FOR_EACH_OBSERVER( |
2338 RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error)); | 2346 RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error)); |
2339 | 2347 |
2340 bool show_repost_interstitial = | 2348 bool show_repost_interstitial = |
2341 (error.reason == net::ERR_CACHE_MISS && | 2349 (error.reason == net::ERR_CACHE_MISS && |
2342 EqualsASCII(failed_request.httpMethod(), "POST")); | 2350 EqualsASCII(failed_request.httpMethod(), "POST")); |
2351 | |
2352 ViewHostMsg_DidFailProvisionalLoadWithError_Params ipc_params; | |
2353 ipc_params.frame_id = frame->identifier(); | |
2354 ipc_params.is_main_frame = !frame->parent(); | |
2355 ipc_params.error_code = error.reason; | |
2356 content::GetContentClient()->renderer()->GetNavigationErrorStrings( | |
2357 failed_request, | |
2358 error, | |
2359 NULL, | |
2360 &ipc_params.error_description); | |
2361 ipc_params.url = error.unreachableURL; | |
2362 ipc_params.showing_repost_interstitial = show_repost_interstitial; | |
2343 Send(new ViewHostMsg_DidFailProvisionalLoadWithError( | 2363 Send(new ViewHostMsg_DidFailProvisionalLoadWithError( |
2344 routing_id_, frame->identifier(), !frame->parent(), error.reason, | 2364 routing_id_, ipc_params)); |
2345 error.unreachableURL, show_repost_interstitial)); | |
2346 | 2365 |
2347 // Don't display an error page if this is simply a cancelled load. Aside | 2366 // Don't display an error page if this is simply a cancelled load. Aside |
2348 // from being dumb, WebCore doesn't expect it and it will cause a crash. | 2367 // from being dumb, WebCore doesn't expect it and it will cause a crash. |
2349 if (error.reason == net::ERR_ABORTED) | 2368 if (error.reason == net::ERR_ABORTED) |
2350 return; | 2369 return; |
2351 | 2370 |
2352 // Make sure we never show errors in view source mode. | 2371 // Make sure we never show errors in view source mode. |
2353 frame->enableViewSourceMode(false); | 2372 frame->enableViewSourceMode(false); |
2354 | 2373 |
2355 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 2374 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4401 main_frame->enableViewSourceMode(true); | 4420 main_frame->enableViewSourceMode(true); |
4402 } | 4421 } |
4403 | 4422 |
4404 void RenderView::OnLockMouseACK(bool succeeded) { | 4423 void RenderView::OnLockMouseACK(bool succeeded) { |
4405 pepper_delegate_.OnLockMouseACK(succeeded); | 4424 pepper_delegate_.OnLockMouseACK(succeeded); |
4406 } | 4425 } |
4407 | 4426 |
4408 void RenderView::OnMouseLockLost() { | 4427 void RenderView::OnMouseLockLost() { |
4409 pepper_delegate_.OnMouseLockLost(); | 4428 pepper_delegate_.OnMouseLockLost(); |
4410 } | 4429 } |
4411 | |
OLD | NEW |