OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/renderer/localized_error.h" | 5 #include "chrome/renderer/localized_error.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "webkit/glue/webkit_glue.h" | 21 #include "webkit/glue/webkit_glue.h" |
22 | 22 |
23 using WebKit::WebURLError; | 23 using WebKit::WebURLError; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 static const char kRedirectLoopLearnMoreUrl[] = | 27 static const char kRedirectLoopLearnMoreUrl[] = |
28 "http://www.google.com/support/chrome/bin/answer.py?answer=95626"; | 28 "http://www.google.com/support/chrome/bin/answer.py?answer=95626"; |
29 static const char kWeakDHKeyLearnMoreUrl[] = | 29 static const char kWeakDHKeyLearnMoreUrl[] = |
30 "http://sites.google.com/a/chromium.org/dev/err_ssl_weak_server_ephemeral_dh
_key"; | 30 "http://sites.google.com/a/chromium.org/dev/err_ssl_weak_server_ephemeral_dh
_key"; |
| 31 static const char kESETLearnMoreUrl[] = |
| 32 "http://sites.google.com/a/chromium.org/dev/err_eset_anti_virus_ssl_intercep
tion"; |
| 33 static const char kNetNannyLearnMoreUrl[] = |
| 34 "http://sites.google.com/a/chromium.org/dev/err_netnanny_ssl_interception"; |
31 | 35 |
32 enum NAV_SUGGESTIONS { | 36 enum NAV_SUGGESTIONS { |
33 SUGGEST_NONE = 0, | 37 SUGGEST_NONE = 0, |
34 SUGGEST_RELOAD = 1 << 0, | 38 SUGGEST_RELOAD = 1 << 0, |
35 SUGGEST_HOSTNAME = 1 << 1, | 39 SUGGEST_HOSTNAME = 1 << 1, |
36 SUGGEST_LEARNMORE = 1 << 2, | 40 SUGGEST_LEARNMORE = 1 << 2, |
37 }; | 41 }; |
38 | 42 |
39 struct LocalizedErrorMap { | 43 struct LocalizedErrorMap { |
40 int error_code; | 44 int error_code; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 }, | 115 }, |
112 {net::ERR_BAD_SSL_CLIENT_AUTH_CERT, | 116 {net::ERR_BAD_SSL_CLIENT_AUTH_CERT, |
113 IDS_ERRORPAGES_TITLE_LOAD_FAILED, | 117 IDS_ERRORPAGES_TITLE_LOAD_FAILED, |
114 IDS_ERRORPAGES_HEADING_BAD_SSL_CLIENT_AUTH_CERT, | 118 IDS_ERRORPAGES_HEADING_BAD_SSL_CLIENT_AUTH_CERT, |
115 IDS_ERRORPAGES_SUMMARY_BAD_SSL_CLIENT_AUTH_CERT, | 119 IDS_ERRORPAGES_SUMMARY_BAD_SSL_CLIENT_AUTH_CERT, |
116 IDS_ERRORPAGES_DETAILS_BAD_SSL_CLIENT_AUTH_CERT, | 120 IDS_ERRORPAGES_DETAILS_BAD_SSL_CLIENT_AUTH_CERT, |
117 SUGGEST_NONE, | 121 SUGGEST_NONE, |
118 }, | 122 }, |
119 {net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY, | 123 {net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY, |
120 IDS_ERRORPAGES_TITLE_LOAD_FAILED, | 124 IDS_ERRORPAGES_TITLE_LOAD_FAILED, |
121 IDS_ERRORPAGES_HEADING_SSL_PROTOCOL_ERROR, | 125 IDS_ERRORPAGES_HEADING_WEAK_SERVER_EPHEMERAL_DH_KEY, |
122 IDS_ERRORPAGES_SUMMARY_SSL_PROTOCOL_ERROR, | 126 IDS_ERRORPAGES_SUMMARY_WEAK_SERVER_EPHEMERAL_DH_KEY, |
123 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR, | 127 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR, |
124 SUGGEST_LEARNMORE, | 128 SUGGEST_LEARNMORE, |
125 }, | 129 }, |
126 {net::ERR_PROXY_CONNECTION_FAILED, | 130 {net::ERR_PROXY_CONNECTION_FAILED, |
127 IDS_ERRORPAGES_TITLE_PROXY_CONNECTION_FAILED, | 131 IDS_ERRORPAGES_TITLE_PROXY_CONNECTION_FAILED, |
128 IDS_ERRORPAGES_HEADING_PROXY_CONNECTION_FAILED, | 132 IDS_ERRORPAGES_HEADING_PROXY_CONNECTION_FAILED, |
129 IDS_ERRORPAGES_SUMMARY_PROXY_CONNECTION_FAILED, | 133 IDS_ERRORPAGES_SUMMARY_PROXY_CONNECTION_FAILED, |
130 IDS_ERRORPAGES_DETAILS_PROXY_CONNECTION_FAILED, | 134 IDS_ERRORPAGES_DETAILS_PROXY_CONNECTION_FAILED, |
131 SUGGEST_NONE, | 135 SUGGEST_NONE, |
132 }, | 136 }, |
| 137 {net::ERR_ESET_ANTI_VIRUS_SSL_INTERCEPTION, |
| 138 IDS_ERRORPAGES_TITLE_LOAD_FAILED, |
| 139 IDS_ERRORPAGES_HEADING_ESET_ANTI_VIRUS_SSL_INTERCEPTION, |
| 140 IDS_ERRORPAGES_SUMMARY_ESET_ANTI_VIRUS_SSL_INTERCEPTION, |
| 141 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR, |
| 142 SUGGEST_LEARNMORE, |
| 143 }, |
| 144 {net::ERR_NETNANNY_SSL_INTERCEPTION, |
| 145 IDS_ERRORPAGES_TITLE_LOAD_FAILED, |
| 146 IDS_ERRORPAGES_HEADING_NETNANNY_SSL_INTERCEPTION, |
| 147 IDS_ERRORPAGES_SUMMARY_NETNANNY_SSL_INTERCEPTION, |
| 148 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR, |
| 149 SUGGEST_LEARNMORE, |
| 150 }, |
133 }; | 151 }; |
134 | 152 |
135 const LocalizedErrorMap http_error_options[] = { | 153 const LocalizedErrorMap http_error_options[] = { |
136 {403, | 154 {403, |
137 IDS_ERRORPAGES_TITLE_ACCESS_DENIED, | 155 IDS_ERRORPAGES_TITLE_ACCESS_DENIED, |
138 IDS_ERRORPAGES_HEADING_ACCESS_DENIED, | 156 IDS_ERRORPAGES_HEADING_ACCESS_DENIED, |
139 IDS_ERRORPAGES_SUMMARY_FORBIDDEN, | 157 IDS_ERRORPAGES_SUMMARY_FORBIDDEN, |
140 IDS_ERRORPAGES_DETAILS_FORBIDDEN, | 158 IDS_ERRORPAGES_DETAILS_FORBIDDEN, |
141 SUGGEST_NONE, | 159 SUGGEST_NONE, |
142 }, | 160 }, |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 394 |
377 if (options.suggestions & SUGGEST_LEARNMORE) { | 395 if (options.suggestions & SUGGEST_LEARNMORE) { |
378 GURL learn_more_url; | 396 GURL learn_more_url; |
379 switch (options.error_code) { | 397 switch (options.error_code) { |
380 case net::ERR_TOO_MANY_REDIRECTS: | 398 case net::ERR_TOO_MANY_REDIRECTS: |
381 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); | 399 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); |
382 break; | 400 break; |
383 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: | 401 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: |
384 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); | 402 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); |
385 break; | 403 break; |
| 404 case net::ERR_ESET_ANTI_VIRUS_SSL_INTERCEPTION: |
| 405 learn_more_url = GURL(kESETLearnMoreUrl); |
| 406 break; |
| 407 case net::ERR_NETNANNY_SSL_INTERCEPTION: |
| 408 learn_more_url = GURL(kNetNannyLearnMoreUrl); |
| 409 break; |
386 default: | 410 default: |
387 break; | 411 break; |
388 } | 412 } |
389 | 413 |
390 if (learn_more_url.is_valid()) { | 414 if (learn_more_url.is_valid()) { |
391 // Add the language parameter to the URL. | 415 // Add the language parameter to the URL. |
392 std::string query = learn_more_url.query() + "&hl=" + | 416 std::string query = learn_more_url.query() + "&hl=" + |
393 webkit_glue::GetWebKitLocale(); | 417 webkit_glue::GetWebKitLocale(); |
394 GURL::Replacements repl; | 418 GURL::Replacements repl; |
395 repl.SetQueryStr(query); | 419 repl.SetQueryStr(query); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 error_strings->SetString( | 470 error_strings->SetString( |
447 "url", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, | 471 "url", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, |
448 failed_url.c_str())); | 472 failed_url.c_str())); |
449 | 473 |
450 error_strings->SetString("title", app->name()); | 474 error_strings->SetString("title", app->name()); |
451 error_strings->SetString("icon", app->icon_url().spec()); | 475 error_strings->SetString("icon", app->icon_url().spec()); |
452 error_strings->SetString("name", app->name()); | 476 error_strings->SetString("name", app->name()); |
453 error_strings->SetString("msg", | 477 error_strings->SetString("msg", |
454 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); | 478 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); |
455 } | 479 } |
OLD | NEW |