diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-11 20:20:17 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-11 20:20:17 +0000 |
commit | aa87edec590fca9920265198b1c77b93a20c043d (patch) | |
tree | 490d6ca95e093ceaf9d4d60d83cf29b27a9594dd /chrome/renderer/localized_error.cc | |
parent | 5d9419f52626a371326cbb70d08763c53147db82 (diff) | |
download | chromium_src-aa87edec590fca9920265198b1c77b93a20c043d.zip chromium_src-aa87edec590fca9920265198b1c77b93a20c043d.tar.gz chromium_src-aa87edec590fca9920265198b1c77b93a20c043d.tar.bz2 |
Adds better error text for case where there is no network connection (ERR_INTERNET_DISCONNECTED)
on Windows and Mac.
BUG=56457
TEST=manual
Review URL: http://codereview.chromium.org/3714001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/localized_error.cc')
-rw-r--r-- | chrome/renderer/localized_error.cc | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/chrome/renderer/localized_error.cc b/chrome/renderer/localized_error.cc index fa6b70c..203f7b5 100644 --- a/chrome/renderer/localized_error.cc +++ b/chrome/renderer/localized_error.cc @@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/string16.h" #include "base/string_number_conversions.h" +#include "base/sys_info.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/renderer/extensions/extension_renderer_info.h" @@ -74,13 +75,6 @@ const LocalizedErrorMap net_error_options[] = { IDS_ERRORPAGES_DETAILS_NAME_NOT_RESOLVED, SUGGEST_RELOAD, }, - {net::ERR_INTERNET_DISCONNECTED, - IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, - IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, - IDS_ERRORPAGES_SUMMARY_NOT_AVAILABLE, - IDS_ERRORPAGES_DETAILS_DISCONNECTED, - SUGGEST_RELOAD, - }, {net::ERR_FILE_NOT_FOUND, IDS_ERRORPAGES_TITLE_NOT_FOUND, IDS_ERRORPAGES_HEADING_NOT_FOUND, @@ -130,6 +124,25 @@ const LocalizedErrorMap net_error_options[] = { IDS_ERRORPAGES_DETAILS_PROXY_CONNECTION_FAILED, SUGGEST_NONE, }, + // TODO(mmenke): Once Linux-specific instructions are added, remove this + // conditional, and the one further down as well. +#if defined(OS_MACOSX) || defined(OS_WIN) + {net::ERR_INTERNET_DISCONNECTED, + IDS_ERRORPAGES_TITLE_INTERNET_DISCONNECTED, + IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED, + IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED, + IDS_ERRORPAGES_DETAILS_INTERNET_DISCONNECTED, + SUGGEST_NONE, + }, +#else + {net::ERR_INTERNET_DISCONNECTED, + IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, + IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, + IDS_ERRORPAGES_SUMMARY_NOT_AVAILABLE, + IDS_ERRORPAGES_DETAILS_INTERNET_DISCONNECTED, + SUGGEST_NONE, + }, +#endif }; const LocalizedErrorMap http_error_options[] = { @@ -348,6 +361,33 @@ void LocalizedError::GetStrings(const WebKit::WebURLError& error, IDS_ERRORPAGES_SUMMARY_PROXY_CONNECTION_FAILED_PLATFORM))); } +#if defined(OS_MACOSX) || defined(OS_WIN) + if (error_domain == net::kErrorDomain && + error_code == net::ERR_INTERNET_DISCONNECTED) { + int platform_string_id = + IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM; +#if defined(OS_WIN) + // Different versions of Windows have different instructions. + int32 major_version, minor_version, bugfix_version; + base::SysInfo::OperatingSystemVersionNumbers( + &major_version, &minor_version, &bugfix_version); + if (major_version < 6) { + // XP, XP64, and Server 2003. + platform_string_id = + IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM_XP; + } else if (major_version == 6 && minor_version == 0) { + // Vista + platform_string_id = + IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM_VISTA; + } +#endif // defined(OS_WIN) + // Suffix the platform dependent portion of the summary section. + summary->SetString("msg", + l10n_util::GetStringFUTF16(options.summary_resource_id, + l10n_util::GetStringUTF16(platform_string_id))); + } +#endif // defined(OS_MACOSX) || defined(OS_WIN) + if (options.suggestions & SUGGEST_RELOAD) { DictionaryValue* suggest_reload = new DictionaryValue; suggest_reload->SetString("msg", |