| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 SUGGEST_PROXY_CONFIG = 1 << 4, | 58 SUGGEST_PROXY_CONFIG = 1 << 4, |
| 59 SUGGEST_DISABLE_EXTENSION = 1 << 5, | 59 SUGGEST_DISABLE_EXTENSION = 1 << 5, |
| 60 SUGGEST_LEARNMORE = 1 << 6, | 60 SUGGEST_LEARNMORE = 1 << 6, |
| 61 SUGGEST_CONTACT_ADMINISTRATOR = 1 << 7, | 61 SUGGEST_CONTACT_ADMINISTRATOR = 1 << 7, |
| 62 SUGGEST_UNSUPPORTED_CIPHER = 1 << 8, | 62 SUGGEST_UNSUPPORTED_CIPHER = 1 << 8, |
| 63 SUGGEST_ANTIVIRUS_CONFIG = 1 << 9, | 63 SUGGEST_ANTIVIRUS_CONFIG = 1 << 9, |
| 64 SUGGEST_OFFLINE_CHECKS = 1 << 10, | 64 SUGGEST_OFFLINE_CHECKS = 1 << 10, |
| 65 SUGGEST_COMPLETE_SETUP = 1 << 11, | 65 SUGGEST_COMPLETE_SETUP = 1 << 11, |
| 66 // Reload page suggestion for pages created by a post. | 66 // Reload page suggestion for pages created by a post. |
| 67 SUGGEST_REPOST_RELOAD = 1 << 12, | 67 SUGGEST_REPOST_RELOAD = 1 << 12, |
| 68 SUGGEST_CLIENT_CERTIFICATE = 1 << 13, |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 enum SHOW_BUTTONS { | 71 enum SHOW_BUTTONS { |
| 71 SHOW_NO_BUTTONS = 0, | 72 SHOW_NO_BUTTONS = 0, |
| 72 SHOW_BUTTON_RELOAD = 1, | 73 SHOW_BUTTON_RELOAD = 1, |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 struct LocalizedErrorMap { | 76 struct LocalizedErrorMap { |
| 76 int error_code; | 77 int error_code; |
| 77 unsigned int heading_resource_id; | 78 unsigned int heading_resource_id; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 }, | 236 }, |
| 236 {net::ERR_SSL_PROTOCOL_ERROR, | 237 {net::ERR_SSL_PROTOCOL_ERROR, |
| 237 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, | 238 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, |
| 238 IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE, | 239 IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE, |
| 239 SUGGEST_DIAGNOSE_TOOL, | 240 SUGGEST_DIAGNOSE_TOOL, |
| 240 SHOW_BUTTON_RELOAD, | 241 SHOW_BUTTON_RELOAD, |
| 241 }, | 242 }, |
| 242 {net::ERR_BAD_SSL_CLIENT_AUTH_CERT, | 243 {net::ERR_BAD_SSL_CLIENT_AUTH_CERT, |
| 243 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, | 244 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, |
| 244 IDS_ERRORPAGES_SUMMARY_BAD_SSL_CLIENT_AUTH_CERT, | 245 IDS_ERRORPAGES_SUMMARY_BAD_SSL_CLIENT_AUTH_CERT, |
| 245 SUGGEST_CONTACT_ADMINISTRATOR, | 246 SUGGEST_CONTACT_ADMINISTRATOR | SUGGEST_CLIENT_CERTIFICATE, |
| 246 SHOW_NO_BUTTONS, | 247 SHOW_BUTTON_RELOAD, |
| 247 }, | 248 }, |
| 248 {net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY, | 249 {net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY, |
| 249 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, | 250 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, |
| 250 IDS_ERRORPAGES_SUMMARY_SSL_SECURITY_ERROR, | 251 IDS_ERRORPAGES_SUMMARY_SSL_SECURITY_ERROR, |
| 251 SUGGEST_LEARNMORE, | 252 SUGGEST_LEARNMORE, |
| 252 SHOW_NO_BUTTONS, | 253 SHOW_NO_BUTTONS, |
| 253 }, | 254 }, |
| 254 {net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN, | 255 {net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN, |
| 255 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, | 256 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, |
| 256 IDS_CERT_ERROR_SUMMARY_PINNING_FAILURE_DETAILS, | 257 IDS_CERT_ERROR_SUMMARY_PINNING_FAILURE_DETAILS, |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION_SUMMARY, false); | 639 IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION_SUMMARY, false); |
| 639 return; | 640 return; |
| 640 } | 641 } |
| 641 DCHECK(!IsSuggested(suggestions, SUGGEST_DISABLE_EXTENSION)); | 642 DCHECK(!IsSuggested(suggestions, SUGGEST_DISABLE_EXTENSION)); |
| 642 | 643 |
| 643 if (suggestions & SUGGEST_CHECK_CONNECTION) { | 644 if (suggestions & SUGGEST_CHECK_CONNECTION) { |
| 644 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 645 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
| 645 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_SUMMARY, false); | 646 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_SUMMARY, false); |
| 646 } | 647 } |
| 647 | 648 |
| 649 if (suggestions & SUGGEST_CLIENT_CERTIFICATE) { |
| 650 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
| 651 IDS_ERRORPAGES_SUGGESTION_CLIENT_CERTIFICATE, |
| 652 false); |
| 653 } |
| 654 |
| 648 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 655 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 649 if (IsSuggested(suggestions, SUGGEST_DNS_CONFIG) && | 656 if (IsSuggested(suggestions, SUGGEST_DNS_CONFIG) && |
| 650 IsSuggested(suggestions, SUGGEST_FIREWALL_CONFIG) && | 657 IsSuggested(suggestions, SUGGEST_FIREWALL_CONFIG) && |
| 651 IsSuggested(suggestions, SUGGEST_PROXY_CONFIG)) { | 658 IsSuggested(suggestions, SUGGEST_PROXY_CONFIG)) { |
| 652 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 659 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
| 653 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_FIREWALL_DNS_SUMMARY, false); | 660 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_FIREWALL_DNS_SUMMARY, false); |
| 654 } else if (IsSuggested(suggestions, SUGGEST_FIREWALL_CONFIG) && | 661 } else if (IsSuggested(suggestions, SUGGEST_FIREWALL_CONFIG) && |
| 655 IsSuggested(suggestions, SUGGEST_ANTIVIRUS_CONFIG)) { | 662 IsSuggested(suggestions, SUGGEST_ANTIVIRUS_CONFIG)) { |
| 656 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 663 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
| 657 IDS_ERRORPAGES_SUGGESTION_CHECK_FIREWALL_ANTIVIRUS_SUMMARY, false); | 664 IDS_ERRORPAGES_SUGGESTION_CHECK_FIREWALL_ANTIVIRUS_SUMMARY, false); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 | 1025 |
| 1019 bool LocalizedError::HasStrings(const std::string& error_domain, | 1026 bool LocalizedError::HasStrings(const std::string& error_domain, |
| 1020 int error_code) { | 1027 int error_code) { |
| 1021 // Whether or not the there are strings for an error does not depend on | 1028 // Whether or not the there are strings for an error does not depend on |
| 1022 // whether or not the page was be generated by a POST, so just claim it was | 1029 // whether or not the page was be generated by a POST, so just claim it was |
| 1023 // not. | 1030 // not. |
| 1024 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; | 1031 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; |
| 1025 } | 1032 } |
| 1026 | 1033 |
| 1027 } // namespace error_page | 1034 } // namespace error_page |
| OLD | NEW |