OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 return false; | 977 return false; |
978 } | 978 } |
979 | 979 |
980 *error_domain = LocalizedError::kHttpErrorDomain; | 980 *error_domain = LocalizedError::kHttpErrorDomain; |
981 return true; | 981 return true; |
982 } | 982 } |
983 | 983 |
984 bool ChromeContentRendererClient::ShouldSuppressErrorPage( | 984 bool ChromeContentRendererClient::ShouldSuppressErrorPage( |
985 content::RenderFrame* render_frame, | 985 content::RenderFrame* render_frame, |
986 const GURL& url) { | 986 const GURL& url) { |
| 987 // Unit tests for ChromeContentRendererClient pass a NULL RenderFrame here. |
| 988 // Unfortunately it's very difficult to construct a mock RenderView, so skip |
| 989 // this functionality in this case. |
| 990 if (render_frame) { |
| 991 content::RenderView* render_view = render_frame->GetRenderView(); |
| 992 content::RenderFrame* main_render_frame = render_view->GetMainRenderFrame(); |
| 993 blink::WebFrame* web_frame = render_frame->GetWebFrame(); |
| 994 NetErrorHelper* net_error_helper = NetErrorHelper::Get(main_render_frame); |
| 995 if (net_error_helper->ShouldSuppressErrorPage(web_frame, url)) |
| 996 return true; |
| 997 } |
987 // Do not flash an error page if the Instant new tab page fails to load. | 998 // Do not flash an error page if the Instant new tab page fails to load. |
988 return search_bouncer_.get() && search_bouncer_->IsNewTabPage(url); | 999 return search_bouncer_.get() && search_bouncer_->IsNewTabPage(url); |
989 } | 1000 } |
990 | 1001 |
991 void ChromeContentRendererClient::GetNavigationErrorStrings( | 1002 void ChromeContentRendererClient::GetNavigationErrorStrings( |
992 content::RenderView* render_view, | 1003 content::RenderView* render_view, |
993 blink::WebFrame* frame, | 1004 blink::WebFrame* frame, |
994 const blink::WebURLRequest& failed_request, | 1005 const blink::WebURLRequest& failed_request, |
995 const blink::WebURLError& error, | 1006 const blink::WebURLError& error, |
996 std::string* error_html, | 1007 std::string* error_html, |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1432 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1422 return !command_line->HasSwitch(extensions::switches::kExtensionProcess); | 1433 return !command_line->HasSwitch(extensions::switches::kExtensionProcess); |
1423 } | 1434 } |
1424 | 1435 |
1425 blink::WebWorkerPermissionClientProxy* | 1436 blink::WebWorkerPermissionClientProxy* |
1426 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1437 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
1427 content::RenderFrame* render_frame, | 1438 content::RenderFrame* render_frame, |
1428 blink::WebFrame* frame) { | 1439 blink::WebFrame* frame) { |
1429 return new WorkerPermissionClientProxy(render_frame, frame); | 1440 return new WorkerPermissionClientProxy(render_frame, frame); |
1430 } | 1441 } |
OLD | NEW |