| 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 "components/error_page/common/localized_error.h" | 5 #include "components/error_page/common/localized_error.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 // Some error pages have no details. | 44 // Some error pages have no details. |
| 45 const unsigned int kErrorPagesNoDetails = 0; | 45 const unsigned int kErrorPagesNoDetails = 0; |
| 46 | 46 |
| 47 static const char kRedirectLoopLearnMoreUrl[] = | 47 static const char kRedirectLoopLearnMoreUrl[] = |
| 48 "https://support.google.com/chrome?p=rl_error"; | 48 "https://support.google.com/chrome?p=rl_error"; |
| 49 static const char kWeakDHKeyLearnMoreUrl[] = | 49 static const char kWeakDHKeyLearnMoreUrl[] = |
| 50 "https://support.google.com/chrome?p=dh_error"; | 50 "https://support.google.com/chrome?p=dh_error"; |
| 51 static const char kSslInvalidResponseLearnMoreUrl[] = | |
| 52 "https://support.google.com/chrome?p=ir_ssl_error"; | |
| 53 static const int kGoogleCachedCopySuggestionType = 0; | 51 static const int kGoogleCachedCopySuggestionType = 0; |
| 54 | 52 |
| 55 enum NAV_SUGGESTIONS { | 53 enum NAV_SUGGESTIONS { |
| 56 SUGGEST_NONE = 0, | 54 SUGGEST_NONE = 0, |
| 57 SUGGEST_RELOAD = 1 << 0, | 55 SUGGEST_RELOAD = 1 << 0, |
| 58 SUGGEST_CHECK_CONNECTION = 1 << 1, | 56 SUGGEST_CHECK_CONNECTION = 1 << 1, |
| 59 SUGGEST_DNS_CONFIG = 1 << 2, | 57 SUGGEST_DNS_CONFIG = 1 << 2, |
| 60 SUGGEST_FIREWALL_CONFIG = 1 << 3, | 58 SUGGEST_FIREWALL_CONFIG = 1 << 3, |
| 61 SUGGEST_PROXY_CONFIG = 1 << 4, | 59 SUGGEST_PROXY_CONFIG = 1 << 4, |
| 62 SUGGEST_DISABLE_EXTENSION_STANDALONE = 1 << 5, | 60 SUGGEST_DISABLE_EXTENSION_STANDALONE = 1 << 5, |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 IDS_ERRORPAGES_HEADING_PAGE_NOT_WORKING, | 258 IDS_ERRORPAGES_HEADING_PAGE_NOT_WORKING, |
| 261 IDS_ERRORPAGES_SUMMARY_CONNECTION_CLOSED, | 259 IDS_ERRORPAGES_SUMMARY_CONNECTION_CLOSED, |
| 262 IDS_ERRORPAGES_DETAILS_CONNECTION_CLOSED, | 260 IDS_ERRORPAGES_DETAILS_CONNECTION_CLOSED, |
| 263 SUGGEST_RELOAD, | 261 SUGGEST_RELOAD, |
| 264 }, | 262 }, |
| 265 {net::ERR_SSL_PROTOCOL_ERROR, | 263 {net::ERR_SSL_PROTOCOL_ERROR, |
| 266 IDS_ERRORPAGES_TITLE_LOAD_FAILED, | 264 IDS_ERRORPAGES_TITLE_LOAD_FAILED, |
| 267 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, | 265 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, |
| 268 IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE, | 266 IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE, |
| 269 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR, | 267 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR, |
| 270 SUGGEST_RELOAD | SUGGEST_LEARNMORE_STANDALONE, | 268 SUGGEST_RELOAD, |
| 271 }, | 269 }, |
| 272 {net::ERR_BAD_SSL_CLIENT_AUTH_CERT, | 270 {net::ERR_BAD_SSL_CLIENT_AUTH_CERT, |
| 273 IDS_ERRORPAGES_TITLE_LOAD_FAILED, | 271 IDS_ERRORPAGES_TITLE_LOAD_FAILED, |
| 274 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, | 272 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, |
| 275 IDS_ERRORPAGES_SUMMARY_BAD_SSL_CLIENT_AUTH_CERT, | 273 IDS_ERRORPAGES_SUMMARY_BAD_SSL_CLIENT_AUTH_CERT, |
| 276 IDS_ERRORPAGES_DETAILS_BAD_SSL_CLIENT_AUTH_CERT, | 274 IDS_ERRORPAGES_DETAILS_BAD_SSL_CLIENT_AUTH_CERT, |
| 277 SUGGEST_CONTACT_ADMINISTRATOR_STANDALONE, | 275 SUGGEST_CONTACT_ADMINISTRATOR_STANDALONE, |
| 278 }, | 276 }, |
| 279 {net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY, | 277 {net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY, |
| 280 IDS_ERRORPAGES_TITLE_LOAD_FAILED, | 278 IDS_ERRORPAGES_TITLE_LOAD_FAILED, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED, | 321 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED, |
| 324 IDS_ERRORPAGES_SUMMARY_BLOCKED_ENROLLMENT_CHECK_PENDING, | 322 IDS_ERRORPAGES_SUMMARY_BLOCKED_ENROLLMENT_CHECK_PENDING, |
| 325 IDS_ERRORPAGES_DETAILS_BLOCKED_ENROLLMENT_CHECK_PENDING, | 323 IDS_ERRORPAGES_DETAILS_BLOCKED_ENROLLMENT_CHECK_PENDING, |
| 326 SUGGEST_COMPLETE_SETUP_STANDALONE, | 324 SUGGEST_COMPLETE_SETUP_STANDALONE, |
| 327 }, | 325 }, |
| 328 {net::ERR_SSL_FALLBACK_BEYOND_MINIMUM_VERSION, | 326 {net::ERR_SSL_FALLBACK_BEYOND_MINIMUM_VERSION, |
| 329 IDS_ERRORPAGES_TITLE_LOAD_FAILED, | 327 IDS_ERRORPAGES_TITLE_LOAD_FAILED, |
| 330 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, | 328 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, |
| 331 IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE, | 329 IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE, |
| 332 IDS_ERRORPAGES_DETAILS_SSL_FALLBACK_BEYOND_MINIMUM_VERSION, | 330 IDS_ERRORPAGES_DETAILS_SSL_FALLBACK_BEYOND_MINIMUM_VERSION, |
| 333 SUGGEST_LEARNMORE_STANDALONE, | 331 SUGGEST_NONE, |
| 334 }, | 332 }, |
| 335 {net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH, | 333 {net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH, |
| 336 IDS_ERRORPAGES_TITLE_LOAD_FAILED, | 334 IDS_ERRORPAGES_TITLE_LOAD_FAILED, |
| 337 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, | 335 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, |
| 338 IDS_ERRORPAGES_SUMMARY_SSL_VERSION_OR_CIPHER_MISMATCH, | 336 IDS_ERRORPAGES_SUMMARY_SSL_VERSION_OR_CIPHER_MISMATCH, |
| 339 IDS_ERRORPAGES_DETAILS_SSL_VERSION_OR_CIPHER_MISMATCH, | 337 IDS_ERRORPAGES_DETAILS_SSL_VERSION_OR_CIPHER_MISMATCH, |
| 340 SUGGEST_UNSUPPORTED_CIPHER, | 338 SUGGEST_UNSUPPORTED_CIPHER, |
| 341 }, | 339 }, |
| 342 {net::ERR_TEMPORARY_BACKOFF, | 340 {net::ERR_TEMPORARY_BACKOFF, |
| 343 IDS_ERRORPAGES_TITLE_ACCESS_DENIED, | 341 IDS_ERRORPAGES_TITLE_ACCESS_DENIED, |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 base::ListValue* suggestions_summary_list) { | 587 base::ListValue* suggestions_summary_list) { |
| 590 GURL learn_more_url; | 588 GURL learn_more_url; |
| 591 base::string16 suggestion_string; | 589 base::string16 suggestion_string; |
| 592 | 590 |
| 593 switch (error_code) { | 591 switch (error_code) { |
| 594 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: | 592 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: |
| 595 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); | 593 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); |
| 596 suggestion_string = l10n_util::GetStringUTF16( | 594 suggestion_string = l10n_util::GetStringUTF16( |
| 597 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_SUMMARY); | 595 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_SUMMARY); |
| 598 break; | 596 break; |
| 599 case net::ERR_SSL_FALLBACK_BEYOND_MINIMUM_VERSION: | |
| 600 learn_more_url = GURL(kSslInvalidResponseLearnMoreUrl); | |
| 601 suggestion_string = l10n_util::GetStringUTF16( | |
| 602 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_SUMMARY); | |
| 603 break; | |
| 604 case net::ERR_TOO_MANY_REDIRECTS: | 597 case net::ERR_TOO_MANY_REDIRECTS: |
| 605 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); | 598 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); |
| 606 suggestion_string = l10n_util::GetStringUTF16( | 599 suggestion_string = l10n_util::GetStringUTF16( |
| 607 IDS_ERRORPAGES_SUGGESTION_CLEAR_COOKIES_SUMMARY); | 600 IDS_ERRORPAGES_SUGGESTION_CLEAR_COOKIES_SUMMARY); |
| 608 break; | 601 break; |
| 609 case net::ERR_SSL_PROTOCOL_ERROR: | |
| 610 learn_more_url = GURL(kSslInvalidResponseLearnMoreUrl); | |
| 611 suggestion_string = l10n_util::GetStringUTF16( | |
| 612 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_SUMMARY); | |
| 613 break; | |
| 614 default: | 602 default: |
| 615 NOTREACHED(); | 603 NOTREACHED(); |
| 616 break; | 604 break; |
| 617 } | 605 } |
| 618 | 606 |
| 619 DCHECK(learn_more_url.is_valid()); | 607 DCHECK(learn_more_url.is_valid()); |
| 620 // Add the language parameter to the URL. | 608 // Add the language parameter to the URL. |
| 621 std::string query = learn_more_url.query() + "&hl=" + locale; | 609 std::string query = learn_more_url.query() + "&hl=" + locale; |
| 622 GURL::Replacements repl; | 610 GURL::Replacements repl; |
| 623 repl.SetQueryStr(query); | 611 repl.SetQueryStr(query); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 | 1074 |
| 1087 bool LocalizedError::HasStrings(const std::string& error_domain, | 1075 bool LocalizedError::HasStrings(const std::string& error_domain, |
| 1088 int error_code) { | 1076 int error_code) { |
| 1089 // Whether or not the there are strings for an error does not depend on | 1077 // Whether or not the there are strings for an error does not depend on |
| 1090 // whether or not the page was be generated by a POST, so just claim it was | 1078 // whether or not the page was be generated by a POST, so just claim it was |
| 1091 // not. | 1079 // not. |
| 1092 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; | 1080 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; |
| 1093 } | 1081 } |
| 1094 | 1082 |
| 1095 } // namespace error_page | 1083 } // namespace error_page |
| OLD | NEW |