Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/common/localized_error.h" | 5 #include "chrome/common/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/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 using blink::WebURLError; | 31 using blink::WebURLError; |
| 32 | 32 |
| 33 // Some error pages have no details. | 33 // Some error pages have no details. |
| 34 const unsigned int kErrorPagesNoDetails = 0; | 34 const unsigned int kErrorPagesNoDetails = 0; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 static const char kRedirectLoopLearnMoreUrl[] = | 38 static const char kRedirectLoopLearnMoreUrl[] = |
| 39 "https://www.google.com/support/chrome/bin/answer.py?answer=95626"; | 39 "https://www.google.com/support/chrome/bin/answer.py?answer=95626"; |
| 40 static const char kWeakDHKeyLearnMoreUrl[] = | 40 static const char kWeakDHKeyLearnMoreUrl[] = |
| 41 "http://sites.google.com/a/chromium.org/dev/" | 41 "http://sites.google.com/a/chromium.org/dev/" |
|
felt
2014/10/01 02:22:18
^ while you're here, can you make that https?
| |
| 42 "err_ssl_weak_server_ephemeral_dh_key"; | 42 "err_ssl_weak_server_ephemeral_dh_key"; |
| 43 static const char kSSLv3FallbackUrl[] = | |
| 44 "https://code.google.com/p/chromium/issues/detail?id=418848"; | |
| 43 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
| 44 static const char kAppWarningLearnMoreUrl[] = | 46 static const char kAppWarningLearnMoreUrl[] = |
| 45 "chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html" | 47 "chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html" |
| 46 "?answer=1721911"; | 48 "?answer=1721911"; |
| 47 #endif // defined(OS_CHROMEOS) | 49 #endif // defined(OS_CHROMEOS) |
| 48 | 50 |
| 49 enum NAV_SUGGESTIONS { | 51 enum NAV_SUGGESTIONS { |
| 50 SUGGEST_NONE = 0, | 52 SUGGEST_NONE = 0, |
| 51 SUGGEST_RELOAD = 1 << 0, | 53 SUGGEST_RELOAD = 1 << 0, |
| 52 SUGGEST_CHECK_CONNECTION = 1 << 1, | 54 SUGGEST_CHECK_CONNECTION = 1 << 1, |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 IDS_ERRORPAGES_DETAILS_BLOCKED_BY_ADMINISTRATOR, | 296 IDS_ERRORPAGES_DETAILS_BLOCKED_BY_ADMINISTRATOR, |
| 295 SUGGEST_VIEW_POLICIES | SUGGEST_CONTACT_ADMINISTRATOR, | 297 SUGGEST_VIEW_POLICIES | SUGGEST_CONTACT_ADMINISTRATOR, |
| 296 }, | 298 }, |
| 297 {net::ERR_BLOCKED_ENROLLMENT_CHECK_PENDING, | 299 {net::ERR_BLOCKED_ENROLLMENT_CHECK_PENDING, |
| 298 IDS_ERRORPAGES_TITLE_BLOCKED, | 300 IDS_ERRORPAGES_TITLE_BLOCKED, |
| 299 IDS_ERRORPAGES_HEADING_BLOCKED_BY_ADMINISTRATOR, | 301 IDS_ERRORPAGES_HEADING_BLOCKED_BY_ADMINISTRATOR, |
| 300 IDS_ERRORPAGES_SUMMARY_BLOCKED_ENROLLMENT_CHECK_PENDING, | 302 IDS_ERRORPAGES_SUMMARY_BLOCKED_ENROLLMENT_CHECK_PENDING, |
| 301 IDS_ERRORPAGES_DETAILS_BLOCKED_ENROLLMENT_CHECK_PENDING, | 303 IDS_ERRORPAGES_DETAILS_BLOCKED_ENROLLMENT_CHECK_PENDING, |
| 302 SUGGEST_CHECK_CONNECTION, | 304 SUGGEST_CHECK_CONNECTION, |
| 303 }, | 305 }, |
| 306 {net::ERR_SSL_NEEDS_MORE_FALLBACK, | |
| 307 IDS_ERRORPAGES_TITLE_LOAD_FAILED, | |
| 308 IDS_ERRORPAGES_HEADING_SSL_NEEDS_MORE_FALLBACK, | |
| 309 IDS_ERRORPAGES_SUMMARY_SSL_NEEDS_MORE_FALLBACK, | |
| 310 IDS_ERRORPAGES_DETAILS_SSL_NEEDS_MORE_FALLBACK, | |
| 311 SUGGEST_LEARNMORE, | |
| 312 }, | |
| 304 }; | 313 }; |
| 305 | 314 |
| 306 // Special error page to be used in the case of navigating back to a page | 315 // Special error page to be used in the case of navigating back to a page |
| 307 // generated by a POST. LocalizedError::HasStrings expects this net error code | 316 // generated by a POST. LocalizedError::HasStrings expects this net error code |
| 308 // to also appear in the array above. | 317 // to also appear in the array above. |
| 309 const LocalizedErrorMap repost_error = { | 318 const LocalizedErrorMap repost_error = { |
| 310 net::ERR_CACHE_MISS, | 319 net::ERR_CACHE_MISS, |
| 311 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, | 320 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, |
| 312 IDS_HTTP_POST_WARNING_TITLE, | 321 IDS_HTTP_POST_WARNING_TITLE, |
| 313 IDS_ERRORPAGES_HTTP_POST_WARNING, | 322 IDS_ERRORPAGES_HTTP_POST_WARNING, |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 797 | 806 |
| 798 if (options.suggestions & SUGGEST_LEARNMORE) { | 807 if (options.suggestions & SUGGEST_LEARNMORE) { |
| 799 GURL learn_more_url; | 808 GURL learn_more_url; |
| 800 switch (options.error_code) { | 809 switch (options.error_code) { |
| 801 case net::ERR_TOO_MANY_REDIRECTS: | 810 case net::ERR_TOO_MANY_REDIRECTS: |
| 802 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); | 811 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); |
| 803 break; | 812 break; |
| 804 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: | 813 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: |
| 805 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); | 814 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); |
| 806 break; | 815 break; |
| 816 case net::ERR_SSL_NEEDS_MORE_FALLBACK: | |
| 817 learn_more_url = GURL(kSSLv3FallbackUrl); | |
| 818 break; | |
| 807 default: | 819 default: |
| 808 break; | 820 break; |
| 809 } | 821 } |
| 810 | 822 |
| 811 if (learn_more_url.is_valid()) { | 823 if (learn_more_url.is_valid()) { |
| 812 // Add the language parameter to the URL. | 824 // Add the language parameter to the URL. |
| 813 std::string query = learn_more_url.query() + "&hl=" + locale; | 825 std::string query = learn_more_url.query() + "&hl=" + locale; |
| 814 GURL::Replacements repl; | 826 GURL::Replacements repl; |
| 815 repl.SetQueryStr(query); | 827 repl.SetQueryStr(query); |
| 816 learn_more_url = learn_more_url.ReplaceComponents(repl); | 828 learn_more_url = learn_more_url.ReplaceComponents(repl); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 #if defined(OS_CHROMEOS) | 887 #if defined(OS_CHROMEOS) |
| 876 GURL learn_more_url(kAppWarningLearnMoreUrl); | 888 GURL learn_more_url(kAppWarningLearnMoreUrl); |
| 877 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); | 889 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); |
| 878 suggest_learn_more->SetString("msg", | 890 suggest_learn_more->SetString("msg", |
| 879 l10n_util::GetStringUTF16( | 891 l10n_util::GetStringUTF16( |
| 880 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); | 892 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); |
| 881 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 893 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
| 882 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 894 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
| 883 #endif // defined(OS_CHROMEOS) | 895 #endif // defined(OS_CHROMEOS) |
| 884 } | 896 } |
| OLD | NEW |