| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 struct LocalizedErrorMap { | 77 struct LocalizedErrorMap { |
| 78 int error_code; | 78 int error_code; |
| 79 unsigned int heading_resource_id; | 79 unsigned int heading_resource_id; |
| 80 // Detailed summary used when the error is in the main frame and shown on | 80 // Detailed summary used when the error is in the main frame and shown on |
| 81 // mouse over when the error is in a frame. | 81 // mouse over when the error is in a frame. |
| 82 unsigned int summary_resource_id; | 82 unsigned int summary_resource_id; |
| 83 int suggestions; // Bitmap of SUGGEST_* values. | 83 int suggestions; // Bitmap of SUGGEST_* values. |
| 84 int buttons; // Which buttons if any to show. | 84 int buttons; // Which buttons if any to show. |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 // clang-format off |
| 87 const LocalizedErrorMap net_error_options[] = { | 88 const LocalizedErrorMap net_error_options[] = { |
| 88 {net::ERR_TIMED_OUT, | 89 {net::ERR_TIMED_OUT, |
| 89 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, | 90 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, |
| 90 IDS_ERRORPAGES_SUMMARY_TIMED_OUT, | 91 IDS_ERRORPAGES_SUMMARY_TIMED_OUT, |
| 91 SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG | SUGGEST_PROXY_CONFIG | | 92 SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG | SUGGEST_PROXY_CONFIG | |
| 92 SUGGEST_DIAGNOSE_TOOL, | 93 SUGGEST_DIAGNOSE_TOOL, |
| 93 SHOW_BUTTON_RELOAD, | 94 SHOW_BUTTON_RELOAD, |
| 94 }, | 95 }, |
| 95 {net::ERR_CONNECTION_TIMED_OUT, | 96 {net::ERR_CONNECTION_TIMED_OUT, |
| 96 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, | 97 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 IDS_ERRORPAGES_SUMMARY_SSL_VERSION_OR_CIPHER_MISMATCH, | 307 IDS_ERRORPAGES_SUMMARY_SSL_VERSION_OR_CIPHER_MISMATCH, |
| 307 SUGGEST_UNSUPPORTED_CIPHER, | 308 SUGGEST_UNSUPPORTED_CIPHER, |
| 308 SHOW_NO_BUTTONS, | 309 SHOW_NO_BUTTONS, |
| 309 }, | 310 }, |
| 310 {net::ERR_SSL_SERVER_CERT_BAD_FORMAT, | 311 {net::ERR_SSL_SERVER_CERT_BAD_FORMAT, |
| 311 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, | 312 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, |
| 312 IDS_ERRORPAGES_SUMMARY_SSL_SECURITY_ERROR, | 313 IDS_ERRORPAGES_SUMMARY_SSL_SECURITY_ERROR, |
| 313 SUGGEST_NONE, | 314 SUGGEST_NONE, |
| 314 SHOW_NO_BUTTONS, | 315 SHOW_NO_BUTTONS, |
| 315 }, | 316 }, |
| 317 {net::ERR_BLOCKED_BY_RESPONSE, |
| 318 IDS_ERRORPAGES_HEADING_BLOCKED, |
| 319 IDS_ERRORPAGES_SUMMARY_CONNECTION_REFUSED, |
| 320 SUGGEST_NONE, |
| 321 SHOW_NO_BUTTONS |
| 322 }, |
| 316 }; | 323 }; |
| 324 // clang-format on |
| 317 | 325 |
| 318 // Special error page to be used in the case of navigating back to a page | 326 // Special error page to be used in the case of navigating back to a page |
| 319 // generated by a POST. LocalizedError::HasStrings expects this net error code | 327 // generated by a POST. LocalizedError::HasStrings expects this net error code |
| 320 // to also appear in the array above. | 328 // to also appear in the array above. |
| 321 const LocalizedErrorMap repost_error = { | 329 const LocalizedErrorMap repost_error = { |
| 322 net::ERR_CACHE_MISS, | 330 net::ERR_CACHE_MISS, |
| 323 IDS_HTTP_POST_WARNING_TITLE, | 331 IDS_HTTP_POST_WARNING_TITLE, |
| 324 IDS_ERRORPAGES_HTTP_POST_WARNING, | 332 IDS_ERRORPAGES_HTTP_POST_WARNING, |
| 325 SUGGEST_REPOST_RELOAD, | 333 SUGGEST_REPOST_RELOAD, |
| 326 SHOW_NO_BUTTONS, | 334 SHOW_NO_BUTTONS, |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 | 1066 |
| 1059 bool LocalizedError::HasStrings(const std::string& error_domain, | 1067 bool LocalizedError::HasStrings(const std::string& error_domain, |
| 1060 int error_code) { | 1068 int error_code) { |
| 1061 // Whether or not the there are strings for an error does not depend on | 1069 // Whether or not the there are strings for an error does not depend on |
| 1062 // whether or not the page was be generated by a POST, so just claim it was | 1070 // whether or not the page was be generated by a POST, so just claim it was |
| 1063 // not. | 1071 // not. |
| 1064 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; | 1072 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; |
| 1065 } | 1073 } |
| 1066 | 1074 |
| 1067 } // namespace error_page | 1075 } // namespace error_page |
| OLD | NEW |