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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 19777002: Revert 211950 "Display DNS probe results." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1568/src/
Patch Set: Created 7 years, 5 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
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/net/net_error_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 if (!LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain, 842 if (!LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain,
843 http_status_code)) { 843 http_status_code)) {
844 return false; 844 return false;
845 } 845 }
846 846
847 *error_domain = LocalizedError::kHttpErrorDomain; 847 *error_domain = LocalizedError::kHttpErrorDomain;
848 return true; 848 return true;
849 } 849 }
850 850
851 void ChromeContentRendererClient::GetNavigationErrorStrings( 851 void ChromeContentRendererClient::GetNavigationErrorStrings(
852 WebKit::WebFrame* frame, 852 WebKit::WebFrame* /* frame */,
853 const WebKit::WebURLRequest& failed_request, 853 const WebKit::WebURLRequest& failed_request,
854 const WebKit::WebURLError& error, 854 const WebKit::WebURLError& error,
855 std::string* error_html, 855 std::string* error_html,
856 string16* error_description) { 856 string16* error_description) {
857 const GURL failed_url = error.unreachableURL; 857 const GURL failed_url = error.unreachableURL;
858 const Extension* extension = NULL; 858 const Extension* extension = NULL;
859 859
860 if (failed_url.is_valid() && 860 if (failed_url.is_valid() &&
861 !failed_url.SchemeIs(extensions::kExtensionScheme)) { 861 !failed_url.SchemeIs(extensions::kExtensionScheme)) {
862 extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL( 862 extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL(
863 ExtensionURLInfo(failed_url)); 863 ExtensionURLInfo(failed_url));
864 } 864 }
865 865
866 bool is_post = EqualsASCII(failed_request.httpMethod(), "POST"); 866 bool is_post = EqualsASCII(failed_request.httpMethod(), "POST");
867 867
868 if (error_html) { 868 if (error_html) {
869 // Use a local error page. 869 // Use a local error page.
870 int resource_id; 870 int resource_id;
871 base::DictionaryValue error_strings; 871 base::DictionaryValue error_strings;
872 if (extension && !extension->from_bookmark()) { 872 if (extension && !extension->from_bookmark()) {
873 LocalizedError::GetAppErrorStrings(error, failed_url, extension, 873 LocalizedError::GetAppErrorStrings(error, failed_url, extension,
874 &error_strings); 874 &error_strings);
875 875
876 // TODO(erikkay): Should we use a different template for different 876 // TODO(erikkay): Should we use a different template for different
877 // error messages? 877 // error messages?
878 resource_id = IDR_ERROR_APP_HTML; 878 resource_id = IDR_ERROR_APP_HTML;
879 } else { 879 } else {
880 const std::string locale = RenderThread::Get()->GetLocale(); 880 LocalizedError::GetStrings(
881 if (!NetErrorHelper::GetErrorStringsForDnsProbe( 881 error,
882 frame, error, is_post, locale, &error_strings)) { 882 is_post,
883 // In most cases, the NetErrorHelper won't provide DNS-probe-specific 883 RenderThread::Get()->GetLocale(),
884 // error pages, so fall back to LocalizedError. 884 &error_strings);
885 LocalizedError::GetStrings(error, is_post, locale, &error_strings);
886 }
887 resource_id = IDR_NET_ERROR_HTML; 885 resource_id = IDR_NET_ERROR_HTML;
888 } 886 }
889 887
890 const base::StringPiece template_html( 888 const base::StringPiece template_html(
891 ResourceBundle::GetSharedInstance().GetRawDataResource( 889 ResourceBundle::GetSharedInstance().GetRawDataResource(
892 resource_id)); 890 resource_id));
893 if (template_html.empty()) { 891 if (template_html.empty()) {
894 NOTREACHED() << "unable to load template. ID: " << resource_id; 892 NOTREACHED() << "unable to load template. ID: " << resource_id;
895 } else { 893 } else {
896 // "t" is the id of the templates root node. 894 // "t" is the id of the templates root node.
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 if (CommandLine::ForCurrentProcess()->HasSwitch( 1277 if (CommandLine::ForCurrentProcess()->HasSwitch(
1280 switches::kEnablePepperTesting)) { 1278 switches::kEnablePepperTesting)) {
1281 return true; 1279 return true;
1282 } 1280 }
1283 #endif // !defined(OS_ANDROID) 1281 #endif // !defined(OS_ANDROID)
1284 return false; 1282 return false;
1285 } 1283 }
1286 1284
1287 1285
1288 } // namespace chrome 1286 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/net/net_error_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698