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

Unified Diff: chrome/common/localized_error.cc

Issue 13270005: Display DNS probe results. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Round two. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/localized_error.cc
diff --git a/chrome/common/localized_error.cc b/chrome/common/localized_error.cc
index a7ae089dee8f9c3f6930f926d01e3fa9a556d603..74758ee8728e4db19860dcc999842c5ef79c7236 100644
--- a/chrome/common/localized_error.cc
+++ b/chrome/common/localized_error.cc
@@ -15,6 +15,7 @@
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_icon_set.h"
#include "chrome/common/extensions/extension_set.h"
+#include "chrome/common/net/net_error_info.h"
#include "googleurl/src/gurl.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -355,6 +356,61 @@ const LocalizedErrorMap http_error_options[] = {
},
};
+const LocalizedErrorMap dns_probe_error_options[] = {
+ {chrome_common_net::DNS_PROBE_POSSIBLE,
+ IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
+ IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
+ IDS_ERRORPAGES_SUMMARY_DNS_PROBE_RUNNING,
+ IDS_ERRORPAGES_DETAILS_DNS_PROBE_RUNNING,
+ SUGGEST_NONE,
mmenke 2013/04/10 16:56:58 All the other results have "SUGGEST_RELOAD", and i
Deprecated (see juliatuttle) 2013/04/10 23:42:32 Done.
+ },
+
+ // DNS_PROBE_NOT_RUN is not here; NetErrorHelper will restore the original
+ // error, which might be one of several DNS-related errors.
+
+ {chrome_common_net::DNS_PROBE_STARTED,
+ IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
+ IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
+ IDS_ERRORPAGES_SUMMARY_DNS_PROBE_RUNNING,
+ IDS_ERRORPAGES_DETAILS_DNS_PROBE_RUNNING,
+ // Include SUGGEST_RELOAD so the More button doesn't jump when we update.
+ SUGGEST_RELOAD | SUGGEST_NONE,
mmenke 2013/04/10 16:56:58 "| SUGGEST_NONE" doesn't make any sense. :)
mmenke 2013/04/10 16:56:58 Do we need a PROBE_STARTED page? I don't think we
Deprecated (see juliatuttle) 2013/04/10 23:42:32 Done.
Deprecated (see juliatuttle) 2013/04/10 23:42:32 It's there in case we want to show a spinner or di
+ },
+
+ // DNS_PROBE_FINISHED_UNKNOWN is not here; NetErrorHelper will restore the
+ // original error, which might be one of several DNS-related errors.
mmenke 2013/04/10 16:56:58 Erm.... DNS_PROBE_FINISHED_UNKNOWN is here.
Deprecated (see juliatuttle) 2013/04/10 23:42:32 Done.
+
+ {chrome_common_net::DNS_PROBE_FINISHED_UNKNOWN,
+ IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
+ IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
+ IDS_ERRORPAGES_SUMMARY_NAME_NOT_RESOLVED,
+ IDS_ERRORPAGES_DETAILS_NAME_NOT_RESOLVED,
+ SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION | SUGGEST_DNS_CONFIG |
+ SUGGEST_FIREWALL_CONFIG | SUGGEST_PROXY_CONFIG,
+ },
+ {chrome_common_net::DNS_PROBE_FINISHED_NO_INTERNET,
+ IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
+ IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
+ IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED,
+ IDS_ERRORPAGES_DETAILS_INTERNET_DISCONNECTED,
+ SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG,
+ },
+ {chrome_common_net::DNS_PROBE_FINISHED_BAD_CONFIG,
+ IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
+ IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
+ IDS_ERRORPAGES_SUMMARY_NAME_NOT_RESOLVED,
+ IDS_ERRORPAGES_DETAILS_NAME_NOT_RESOLVED,
+ SUGGEST_RELOAD | SUGGEST_DNS_CONFIG | SUGGEST_FIREWALL_CONFIG,
+ },
+ {chrome_common_net::DNS_PROBE_FINISHED_NXDOMAIN,
+ IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
+ IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
+ IDS_ERRORPAGES_SUMMARY_NAME_NOT_RESOLVED,
+ IDS_ERRORPAGES_DETAILS_NAME_NOT_RESOLVED,
+ SUGGEST_RELOAD | SUGGEST_HOSTNAME,
+ },
+};
+
const LocalizedErrorMap* FindErrorMapInArray(const LocalizedErrorMap* maps,
size_t num_maps,
int error_code) {
@@ -375,6 +431,10 @@ const LocalizedErrorMap* LookupErrorMap(const std::string& error_domain,
return FindErrorMapInArray(http_error_options,
arraysize(http_error_options),
error_code);
+ } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) {
+ return FindErrorMapInArray(dns_probe_error_options,
+ arraysize(dns_probe_error_options),
+ error_code);
} else {
NOTREACHED();
return NULL;
@@ -491,6 +551,10 @@ void LocalizedError::GetStrings(const WebKit::WebURLError& error,
// Remove the leading "net::" from the returned string.
RemoveChars(ascii_error_string, "net:", &ascii_error_string);
error_string = ASCIIToUTF16(ascii_error_string);
+ } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) {
+ std::string ascii_error_string =
+ chrome_common_net::DnsProbeStatusToString(error_code);
+ error_string = ASCIIToUTF16(ascii_error_string);
mmenke 2013/04/10 16:56:58 Per other comment, we may just want to use the ERR
Deprecated (see juliatuttle) 2013/04/10 23:42:32 I'd rather have the detail, in case things break.
} else {
DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain);
error_string = base::IntToString16(error_code);

Powered by Google App Engine
This is Rietveld 408576698