Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/localized_error.h" | 5 #include "chrome/renderer/localized_error.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/sys_info.h" | |
| 12 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 12 #include "base/values.h" |
| 14 #include "chrome/common/extensions/extension_set.h" | 13 #include "chrome/common/extensions/extension_set.h" |
| 15 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 16 #include "grit/chromium_strings.h" | 15 #include "grit/chromium_strings.h" |
| 17 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 18 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
| 19 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "webkit/glue/webkit_glue.h" | 21 #include "webkit/glue/webkit_glue.h" |
| 23 | 22 |
| 23 #if defined(OS_WIN) | |
| 24 #include "base/win/windows_version.h" | |
| 25 #endif | |
| 26 | |
| 24 using WebKit::WebURLError; | 27 using WebKit::WebURLError; |
| 25 | 28 |
| 26 namespace { | 29 namespace { |
| 27 | 30 |
| 28 static const char kRedirectLoopLearnMoreUrl[] = | 31 static const char kRedirectLoopLearnMoreUrl[] = |
| 29 "https://www.google.com/support/chrome/bin/answer.py?answer=95626"; | 32 "https://www.google.com/support/chrome/bin/answer.py?answer=95626"; |
| 30 static const char kWeakDHKeyLearnMoreUrl[] = | 33 static const char kWeakDHKeyLearnMoreUrl[] = |
| 31 "http://sites.google.com/a/chromium.org/dev/err_ssl_weak_server_ephemeral_dh _key"; | 34 "http://sites.google.com/a/chromium.org/dev/err_ssl_weak_server_ephemeral_dh _key"; |
| 32 static const char kESETLearnMoreUrl[] = | 35 static const char kESETLearnMoreUrl[] = |
| 33 "http://kb.eset.com/esetkb/index?page=content&id=SOLN2588"; | 36 "http://kb.eset.com/esetkb/index?page=content&id=SOLN2588"; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 | 438 |
| 436 // Platform specific instructions for diagnosing network issues on OSX and | 439 // Platform specific instructions for diagnosing network issues on OSX and |
| 437 // Windows. | 440 // Windows. |
| 438 #if defined(OS_MACOSX) || defined(OS_WIN) | 441 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 439 if (error_domain == net::kErrorDomain && | 442 if (error_domain == net::kErrorDomain && |
| 440 error_code == net::ERR_INTERNET_DISCONNECTED) { | 443 error_code == net::ERR_INTERNET_DISCONNECTED) { |
| 441 int platform_string_id = | 444 int platform_string_id = |
| 442 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM; | 445 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM; |
| 443 #if defined(OS_WIN) | 446 #if defined(OS_WIN) |
| 444 // Different versions of Windows have different instructions. | 447 // Different versions of Windows have different instructions. |
| 445 int32 major_version, minor_version, bugfix_version; | 448 base::win::Version windows_version = base::win::GetVersion(); |
| 446 base::SysInfo::OperatingSystemVersionNumbers( | 449 if (windows_version < base::win::VERSION_VISTA) { |
| 447 &major_version, &minor_version, &bugfix_version); | |
| 448 if (major_version < 6) { | |
| 449 // XP, XP64, and Server 2003. | 450 // XP, XP64, and Server 2003. |
| 450 platform_string_id = | 451 platform_string_id = |
| 451 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM_XP; | 452 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM_XP; |
| 452 } else if (major_version == 6 && minor_version == 0) { | 453 } else if (windows_version == base::win::VERSION_VISTA) { |
| 453 // Vista | 454 // Vista |
| 454 platform_string_id = | 455 platform_string_id = |
| 455 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM_VISTA; | 456 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM_VISTA; |
| 456 } | 457 } |
|
wtc
2011/06/14 18:35:30
It seems that we should also have a custom string
Mark Mentovai
2011/06/14 19:22:07
wtc wrote:
| |
| 457 #endif // defined(OS_WIN) | 458 #endif // defined(OS_WIN) |
| 458 // Lead with the general error description, and suffix with the platform | 459 // Lead with the general error description, and suffix with the platform |
| 459 // dependent portion of the summary section. | 460 // dependent portion of the summary section. |
| 460 summary->SetString("msg", | 461 summary->SetString("msg", |
| 461 l10n_util::GetStringFUTF16( | 462 l10n_util::GetStringFUTF16( |
| 462 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_INSTRUCTIONS_TEMPLATE, | 463 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_INSTRUCTIONS_TEMPLATE, |
| 463 l10n_util::GetStringUTF16(options.summary_resource_id), | 464 l10n_util::GetStringUTF16(options.summary_resource_id), |
| 464 l10n_util::GetStringUTF16(platform_string_id))); | 465 l10n_util::GetStringUTF16(platform_string_id))); |
| 465 } | 466 } |
| 466 #endif // defined(OS_MACOSX) || defined(OS_WIN) | 467 #endif // defined(OS_MACOSX) || defined(OS_WIN) |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 failed_url.c_str())); | 613 failed_url.c_str())); |
| 613 | 614 |
| 614 error_strings->SetString("title", app->name()); | 615 error_strings->SetString("title", app->name()); |
| 615 error_strings->SetString("icon", | 616 error_strings->SetString("icon", |
| 616 app->GetIconURL(Extension::EXTENSION_ICON_LARGE, | 617 app->GetIconURL(Extension::EXTENSION_ICON_LARGE, |
| 617 ExtensionIconSet::MATCH_SMALLER).spec()); | 618 ExtensionIconSet::MATCH_SMALLER).spec()); |
| 618 error_strings->SetString("name", app->name()); | 619 error_strings->SetString("name", app->name()); |
| 619 error_strings->SetString("msg", | 620 error_strings->SetString("msg", |
| 620 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); | 621 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); |
| 621 } | 622 } |
| OLD | NEW |