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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 unsigned int title_resource_id; | 85 unsigned int title_resource_id; |
86 unsigned int heading_resource_id; | 86 unsigned int heading_resource_id; |
87 // Detailed summary used when the error is in the main frame. | 87 // Detailed summary used when the error is in the main frame. |
88 unsigned int summary_resource_id; | 88 unsigned int summary_resource_id; |
89 // Short one sentence description shown on mouse over when the error is in | 89 // Short one sentence description shown on mouse over when the error is in |
90 // a frame. | 90 // a frame. |
91 unsigned int details_resource_id; | 91 unsigned int details_resource_id; |
92 int suggestions; // Bitmap of SUGGEST_* values. | 92 int suggestions; // Bitmap of SUGGEST_* values. |
93 }; | 93 }; |
94 | 94 |
| 95 // clang-format off |
95 const LocalizedErrorMap net_error_options[] = { | 96 const LocalizedErrorMap net_error_options[] = { |
96 {net::ERR_TIMED_OUT, | 97 {net::ERR_TIMED_OUT, |
97 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, | 98 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, |
98 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, | 99 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, |
99 IDS_ERRORPAGES_SUMMARY_TIMED_OUT, | 100 IDS_ERRORPAGES_SUMMARY_TIMED_OUT, |
100 IDS_ERRORPAGES_DETAILS_TIMED_OUT, | 101 IDS_ERRORPAGES_DETAILS_TIMED_OUT, |
101 SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG | | 102 SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG | |
102 SUGGEST_PROXY_CONFIG, | 103 SUGGEST_PROXY_CONFIG, |
103 }, | 104 }, |
104 {net::ERR_CONNECTION_TIMED_OUT, | 105 {net::ERR_CONNECTION_TIMED_OUT, |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 IDS_ERRORPAGES_DETAILS_TEMPORARY_BACKOFF, | 346 IDS_ERRORPAGES_DETAILS_TEMPORARY_BACKOFF, |
346 SUGGEST_NONE, | 347 SUGGEST_NONE, |
347 }, | 348 }, |
348 {net::ERR_SSL_SERVER_CERT_BAD_FORMAT, | 349 {net::ERR_SSL_SERVER_CERT_BAD_FORMAT, |
349 IDS_ERRORPAGES_TITLE_LOAD_FAILED, | 350 IDS_ERRORPAGES_TITLE_LOAD_FAILED, |
350 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, | 351 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, |
351 IDS_ERRORPAGES_SUMMARY_SSL_SECURITY_ERROR, | 352 IDS_ERRORPAGES_SUMMARY_SSL_SECURITY_ERROR, |
352 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR, | 353 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR, |
353 SUGGEST_NONE, | 354 SUGGEST_NONE, |
354 }, | 355 }, |
| 356 {net::ERR_BLOCKED_BY_RESPONSE, |
| 357 IDS_ERRORPAGES_TITLE_BLOCKED, |
| 358 IDS_ERRORPAGES_HEADING_BLOCKED, |
| 359 IDS_ERRORPAGES_SUMMARY_BLOCKED_BY_RESPONSE, |
| 360 IDS_ERRORPAGES_DETAILS_BLOCKED_BY_RESPONSE, |
| 361 SUGGEST_NONE, |
| 362 }, |
355 }; | 363 }; |
| 364 // clang-format on |
356 | 365 |
357 // Special error page to be used in the case of navigating back to a page | 366 // Special error page to be used in the case of navigating back to a page |
358 // generated by a POST. LocalizedError::HasStrings expects this net error code | 367 // generated by a POST. LocalizedError::HasStrings expects this net error code |
359 // to also appear in the array above. | 368 // to also appear in the array above. |
360 const LocalizedErrorMap repost_error = { | 369 const LocalizedErrorMap repost_error = { |
361 net::ERR_CACHE_MISS, | 370 net::ERR_CACHE_MISS, |
362 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, | 371 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, |
363 IDS_HTTP_POST_WARNING_TITLE, | 372 IDS_HTTP_POST_WARNING_TITLE, |
364 IDS_ERRORPAGES_HTTP_POST_WARNING, | 373 IDS_ERRORPAGES_HTTP_POST_WARNING, |
365 IDS_ERRORPAGES_DETAILS_CACHE_READ_FAILURE, | 374 IDS_ERRORPAGES_DETAILS_CACHE_READ_FAILURE, |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 | 1086 |
1078 bool LocalizedError::HasStrings(const std::string& error_domain, | 1087 bool LocalizedError::HasStrings(const std::string& error_domain, |
1079 int error_code) { | 1088 int error_code) { |
1080 // Whether or not the there are strings for an error does not depend on | 1089 // Whether or not the there are strings for an error does not depend on |
1081 // whether or not the page was be generated by a POST, so just claim it was | 1090 // whether or not the page was be generated by a POST, so just claim it was |
1082 // not. | 1091 // not. |
1083 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; | 1092 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; |
1084 } | 1093 } |
1085 | 1094 |
1086 } // namespace error_page | 1095 } // namespace error_page |
OLD | NEW |