Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: chrome/renderer/localized_error.cc

Issue 4813001: Error text for "ERR_ADDRESS_UNREACHABLE". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/renderer/resources/error_no_details.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 "http://www.google.com/support/chrome/bin/answer.py?answer=95626"; 29 "http://www.google.com/support/chrome/bin/answer.py?answer=95626";
30 static const char kWeakDHKeyLearnMoreUrl[] = 30 static const char kWeakDHKeyLearnMoreUrl[] =
31 "http://sites.google.com/a/chromium.org/dev/err_ssl_weak_server_ephemeral_dh _key"; 31 "http://sites.google.com/a/chromium.org/dev/err_ssl_weak_server_ephemeral_dh _key";
32 static const char kESETLearnMoreUrl[] = 32 static const char kESETLearnMoreUrl[] =
33 "http://sites.google.com/a/chromium.org/dev/err_eset_anti_virus_ssl_intercep tion"; 33 "http://sites.google.com/a/chromium.org/dev/err_eset_anti_virus_ssl_intercep tion";
34 34
35 enum NAV_SUGGESTIONS { 35 enum NAV_SUGGESTIONS {
36 SUGGEST_NONE = 0, 36 SUGGEST_NONE = 0,
37 SUGGEST_RELOAD = 1 << 0, 37 SUGGEST_RELOAD = 1 << 0,
38 SUGGEST_HOSTNAME = 1 << 1, 38 SUGGEST_HOSTNAME = 1 << 1,
39 SUGGEST_LEARNMORE = 1 << 2, 39 SUGGEST_FIREWALL_CONFIG = 1 << 2,
40 SUGGEST_PROXY_CONFIG = 1 << 3,
41 SUGGEST_LEARNMORE = 1 << 4,
40 }; 42 };
41 43
42 struct LocalizedErrorMap { 44 struct LocalizedErrorMap {
43 int error_code; 45 int error_code;
44 unsigned int title_resource_id; 46 unsigned int title_resource_id;
45 unsigned int heading_resource_id; 47 unsigned int heading_resource_id;
46 unsigned int summary_resource_id; 48 unsigned int summary_resource_id;
47 unsigned int details_resource_id; 49 unsigned int details_resource_id;
48 int suggestions; // Bitmap of SUGGEST_* values. 50 int suggestions; // Bitmap of SUGGEST_* values.
49 }; 51 };
(...skipping 20 matching lines...) Expand all
70 IDS_ERRORPAGES_DETAILS_CONNECT_FAILED, 72 IDS_ERRORPAGES_DETAILS_CONNECT_FAILED,
71 SUGGEST_RELOAD, 73 SUGGEST_RELOAD,
72 }, 74 },
73 {net::ERR_NAME_NOT_RESOLVED, 75 {net::ERR_NAME_NOT_RESOLVED,
74 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 76 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
75 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, 77 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
76 IDS_ERRORPAGES_SUMMARY_NOT_AVAILABLE, 78 IDS_ERRORPAGES_SUMMARY_NOT_AVAILABLE,
77 IDS_ERRORPAGES_DETAILS_NAME_NOT_RESOLVED, 79 IDS_ERRORPAGES_DETAILS_NAME_NOT_RESOLVED,
78 SUGGEST_RELOAD, 80 SUGGEST_RELOAD,
79 }, 81 },
82 {net::ERR_ADDRESS_UNREACHABLE,
83 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
84 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
85 IDS_ERRORPAGES_SUMMARY_ADDRESS_UNREACHABLE,
86 IDS_ERRORPAGES_DETAILS_ADDRESS_UNREACHABLE,
87 SUGGEST_RELOAD | SUGGEST_FIREWALL_CONFIG | SUGGEST_PROXY_CONFIG,
88 },
80 {net::ERR_NETWORK_ACCESS_DENIED, 89 {net::ERR_NETWORK_ACCESS_DENIED,
81 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 90 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
82 IDS_ERRORPAGES_HEADING_NETWORK_ACCESS_DENIED, 91 IDS_ERRORPAGES_HEADING_NETWORK_ACCESS_DENIED,
83 IDS_ERRORPAGES_SUMMARY_NETWORK_ACCESS_DENIED, 92 IDS_ERRORPAGES_SUMMARY_NETWORK_ACCESS_DENIED,
84 IDS_ERRORPAGES_DETAILS_NETWORK_ACCESS_DENIED, 93 IDS_ERRORPAGES_DETAILS_NETWORK_ACCESS_DENIED,
85 SUGGEST_NONE, 94 SUGGEST_FIREWALL_CONFIG,
86 }, 95 },
87 {net::ERR_PROXY_CONNECTION_FAILED, 96 {net::ERR_PROXY_CONNECTION_FAILED,
88 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 97 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
89 IDS_ERRORPAGES_HEADING_PROXY_CONNECTION_FAILED, 98 IDS_ERRORPAGES_HEADING_PROXY_CONNECTION_FAILED,
90 IDS_ERRORPAGES_SUMMARY_PROXY_CONNECTION_FAILED, 99 IDS_ERRORPAGES_SUMMARY_PROXY_CONNECTION_FAILED,
91 IDS_ERRORPAGES_DETAILS_PROXY_CONNECTION_FAILED, 100 IDS_ERRORPAGES_DETAILS_PROXY_CONNECTION_FAILED,
92 SUGGEST_NONE, 101 SUGGEST_PROXY_CONFIG,
93 }, 102 },
94 {net::ERR_INTERNET_DISCONNECTED, 103 {net::ERR_INTERNET_DISCONNECTED,
95 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 104 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
96 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED, 105 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED,
97 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED, 106 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED,
98 IDS_ERRORPAGES_DETAILS_INTERNET_DISCONNECTED, 107 IDS_ERRORPAGES_DETAILS_INTERNET_DISCONNECTED,
99 SUGGEST_NONE, 108 SUGGEST_NONE,
100 }, 109 },
101 {net::ERR_FILE_NOT_FOUND, 110 {net::ERR_FILE_NOT_FOUND,
102 IDS_ERRORPAGES_TITLE_NOT_FOUND, 111 IDS_ERRORPAGES_TITLE_NOT_FOUND,
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // TODO(tc): we want the unicode url here since it's being displayed 350 // TODO(tc): we want the unicode url here since it's being displayed
342 summary->SetString("failedUrl", failed_url); 351 summary->SetString("failedUrl", failed_url);
343 summary->SetString("productName", 352 summary->SetString("productName",
344 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 353 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
345 error_strings->Set("summary", summary); 354 error_strings->Set("summary", summary);
346 355
347 string16 details = l10n_util::GetStringUTF16(options.details_resource_id); 356 string16 details = l10n_util::GetStringUTF16(options.details_resource_id);
348 error_strings->SetString("details", 357 error_strings->SetString("details",
349 GetErrorDetailsString(error_domain, error_code, details)); 358 GetErrorDetailsString(error_domain, error_code, details));
350 359
351 // Any special case processing that needs to happen for particular
352 // errors (hack).
353 if (error_domain == net::kErrorDomain &&
354 error_code == net::ERR_PROXY_CONNECTION_FAILED) {
355 // Suffix the platform dependent portion of the summary section.
356 summary->SetString("msg",
357 l10n_util::GetStringFUTF16(options.summary_resource_id,
358 l10n_util::GetStringUTF16(
359 IDS_ERRORPAGES_SUMMARY_PROXY_CONNECTION_FAILED_PLATFORM)));
360 }
361
362 // Platform specific instructions for diagnosing network issues on OSX and 360 // Platform specific instructions for diagnosing network issues on OSX and
363 // Windows. 361 // Windows.
364 #if defined(OS_MACOSX) || defined(OS_WIN) 362 #if defined(OS_MACOSX) || defined(OS_WIN)
365 if (error_domain == net::kErrorDomain && 363 if (error_domain == net::kErrorDomain &&
366 error_code == net::ERR_INTERNET_DISCONNECTED) { 364 error_code == net::ERR_INTERNET_DISCONNECTED) {
367 int platform_string_id = 365 int platform_string_id =
368 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM; 366 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM;
369 #if defined(OS_WIN) 367 #if defined(OS_WIN)
370 // Different versions of Windows have different instructions. 368 // Different versions of Windows have different instructions.
371 int32 major_version, minor_version, bugfix_version; 369 int32 major_version, minor_version, bugfix_version;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 // URLs are always LTR. 408 // URLs are always LTR.
411 if (rtl) 409 if (rtl)
412 base::i18n::WrapStringWithLTRFormatting(&homepage); 410 base::i18n::WrapStringWithLTRFormatting(&homepage);
413 suggest_home_page->SetString("homePage", homepage); 411 suggest_home_page->SetString("homePage", homepage);
414 // TODO(tc): we actually want the unicode hostname 412 // TODO(tc): we actually want the unicode hostname
415 suggest_home_page->SetString("hostName", failed_url.host()); 413 suggest_home_page->SetString("hostName", failed_url.host());
416 error_strings->Set("suggestionsHomepage", suggest_home_page); 414 error_strings->Set("suggestionsHomepage", suggest_home_page);
417 } 415 }
418 } 416 }
419 417
418 if (options.suggestions & SUGGEST_FIREWALL_CONFIG) {
419 DictionaryValue* suggest_firewall_config = new DictionaryValue;
420 suggest_firewall_config->SetString("msg",
421 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_FIREWALL_CONFIG));
422 suggest_firewall_config->SetString("productName",
423 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
424 error_strings->Set("suggestionsFirewallConfig", suggest_firewall_config);
425 }
426
427 if (options.suggestions & SUGGEST_PROXY_CONFIG) {
428 DictionaryValue* suggest_proxy_config = new DictionaryValue;
429 suggest_proxy_config->SetString("msg",
430 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG));
431 error_strings->Set("suggestionsProxyConfig", suggest_proxy_config);
432
433 DictionaryValue* suggest_proxy_disable = new DictionaryValue;
434 suggest_proxy_disable->SetString("msg",
435 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE,
436 l10n_util::GetStringUTF16(
437 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM)));
438 error_strings->Set("suggestionsProxyDisable", suggest_proxy_disable);
439 }
440
420 if (options.suggestions & SUGGEST_LEARNMORE) { 441 if (options.suggestions & SUGGEST_LEARNMORE) {
421 GURL learn_more_url; 442 GURL learn_more_url;
422 switch (options.error_code) { 443 switch (options.error_code) {
423 case net::ERR_TOO_MANY_REDIRECTS: 444 case net::ERR_TOO_MANY_REDIRECTS:
424 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); 445 learn_more_url = GURL(kRedirectLoopLearnMoreUrl);
425 break; 446 break;
426 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: 447 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY:
427 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); 448 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl);
428 break; 449 break;
429 case net::ERR_ESET_ANTI_VIRUS_SSL_INTERCEPTION: 450 case net::ERR_ESET_ANTI_VIRUS_SSL_INTERCEPTION:
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 error_strings->SetString( 513 error_strings->SetString(
493 "url", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 514 "url", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
494 failed_url.c_str())); 515 failed_url.c_str()));
495 516
496 error_strings->SetString("title", app->name()); 517 error_strings->SetString("title", app->name());
497 error_strings->SetString("icon", app->icon_url().spec()); 518 error_strings->SetString("icon", app->icon_url().spec());
498 error_strings->SetString("name", app->name()); 519 error_strings->SetString("name", app->name());
499 error_strings->SetString("msg", 520 error_strings->SetString("msg",
500 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); 521 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING));
501 } 522 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/renderer/resources/error_no_details.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698