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

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

Issue 13270005: Display DNS probe results. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Don't break DnsProbe histograms 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
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 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 if (!LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain, 844 if (!LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain,
845 http_status_code)) { 845 http_status_code)) {
846 return false; 846 return false;
847 } 847 }
848 848
849 *error_domain = LocalizedError::kHttpErrorDomain; 849 *error_domain = LocalizedError::kHttpErrorDomain;
850 return true; 850 return true;
851 } 851 }
852 852
853 void ChromeContentRendererClient::GetNavigationErrorStrings( 853 void ChromeContentRendererClient::GetNavigationErrorStrings(
854 WebKit::WebFrame* /* frame */, 854 WebKit::WebFrame* frame,
855 const WebKit::WebURLRequest& failed_request, 855 const WebKit::WebURLRequest& failed_request,
856 const WebKit::WebURLError& error, 856 const WebKit::WebURLError& error,
857 std::string* error_html, 857 std::string* error_html,
858 string16* error_description) { 858 string16* error_description) {
859 const GURL failed_url = error.unreachableURL; 859 const GURL failed_url = error.unreachableURL;
860 const Extension* extension = NULL; 860 const Extension* extension = NULL;
861 861
862 if (failed_url.is_valid() && 862 if (failed_url.is_valid() &&
863 !failed_url.SchemeIs(extensions::kExtensionScheme)) { 863 !failed_url.SchemeIs(extensions::kExtensionScheme)) {
864 extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL( 864 extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL(
865 ExtensionURLInfo(failed_url)); 865 ExtensionURLInfo(failed_url));
866 } 866 }
867 867
868 bool is_post = EqualsASCII(failed_request.httpMethod(), "POST"); 868 bool is_post = EqualsASCII(failed_request.httpMethod(), "POST");
869 869
870 if (error_html) { 870 if (error_html) {
871 // Use a local error page. 871 // Use a local error page.
872 int resource_id; 872 int resource_id;
873 base::DictionaryValue error_strings; 873 base::DictionaryValue error_strings;
874 if (extension && !extension->from_bookmark()) { 874 if (extension && !extension->from_bookmark()) {
875 LocalizedError::GetAppErrorStrings(error, failed_url, extension, 875 LocalizedError::GetAppErrorStrings(error, failed_url, extension,
876 &error_strings); 876 &error_strings);
877 877
878 // TODO(erikkay): Should we use a different template for different 878 // TODO(erikkay): Should we use a different template for different
879 // error messages? 879 // error messages?
880 resource_id = IDR_ERROR_APP_HTML; 880 resource_id = IDR_ERROR_APP_HTML;
881 } else { 881 } else {
882 LocalizedError::GetStrings( 882 const std::string locale = RenderThread::Get()->GetLocale();
883 error, 883 if (!NetErrorHelper::GetErrorStringsForDnsProbe(
884 is_post, 884 frame, error, is_post, locale, &error_strings)) {
885 RenderThread::Get()->GetLocale(), 885 // In most cases, the NetErrorHelper won't provide DNS-probe-specific
886 &error_strings); 886 // error pages, so fall back to LocalizedError.
887 LocalizedError::GetStrings(error, is_post, locale, &error_strings);
888 }
887 resource_id = IDR_NET_ERROR_HTML; 889 resource_id = IDR_NET_ERROR_HTML;
888 } 890 }
889 891
890 const base::StringPiece template_html( 892 const base::StringPiece template_html(
891 ResourceBundle::GetSharedInstance().GetRawDataResource( 893 ResourceBundle::GetSharedInstance().GetRawDataResource(
892 resource_id)); 894 resource_id));
893 if (template_html.empty()) { 895 if (template_html.empty()) {
894 NOTREACHED() << "unable to load template. ID: " << resource_id; 896 NOTREACHED() << "unable to load template. ID: " << resource_id;
895 } else { 897 } else {
896 // "t" is the id of the templates root node. 898 // "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( 1281 if (CommandLine::ForCurrentProcess()->HasSwitch(
1280 switches::kEnablePepperTesting)) { 1282 switches::kEnablePepperTesting)) {
1281 return true; 1283 return true;
1282 } 1284 }
1283 #endif // !defined(OS_ANDROID) 1285 #endif // !defined(OS_ANDROID)
1284 return false; 1286 return false;
1285 } 1287 }
1286 1288
1287 1289
1288 } // namespace chrome 1290 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698