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

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

Issue 13471007: New network error pages: Update format of suggestions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove bonus linebreaks added by MSVC Created 7 years, 8 months 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/google_chrome_strings.grd ('k') | chrome/renderer/resources/neterror.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) 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 "chrome/common/localized_error.h" 5 #include "chrome/common/localized_error.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 "err_ssl_weak_server_ephemeral_dh_key"; 43 "err_ssl_weak_server_ephemeral_dh_key";
44 #if defined(OS_CHROMEOS) 44 #if defined(OS_CHROMEOS)
45 static const char kAppWarningLearnMoreUrl[] = 45 static const char kAppWarningLearnMoreUrl[] =
46 "chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html" 46 "chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html"
47 "?answer=1721911"; 47 "?answer=1721911";
48 #endif // defined(OS_CHROMEOS) 48 #endif // defined(OS_CHROMEOS)
49 49
50 enum NAV_SUGGESTIONS { 50 enum NAV_SUGGESTIONS {
51 SUGGEST_NONE = 0, 51 SUGGEST_NONE = 0,
52 SUGGEST_RELOAD = 1 << 0, 52 SUGGEST_RELOAD = 1 << 0,
53 SUGGEST_HOSTNAME = 1 << 1, 53 SUGGEST_CHECK_CONNECTION = 1 << 1,
54 SUGGEST_CHECK_CONNECTION = 1 << 2, 54 SUGGEST_DNS_CONFIG = 1 << 2,
55 SUGGEST_DNS_CONFIG = 1 << 3, 55 SUGGEST_FIREWALL_CONFIG = 1 << 3,
56 SUGGEST_FIREWALL_CONFIG = 1 << 4, 56 SUGGEST_PROXY_CONFIG = 1 << 4,
57 SUGGEST_PROXY_CONFIG = 1 << 5, 57 SUGGEST_DISABLE_EXTENSION = 1 << 5,
58 SUGGEST_DISABLE_EXTENSION = 1 << 6, 58 SUGGEST_LEARNMORE = 1 << 6,
59 SUGGEST_LEARNMORE = 1 << 7, 59 SUGGEST_VIEW_POLICIES = 1 << 7,
60 SUGGEST_VIEW_POLICIES = 1 << 8, 60 SUGGEST_CONTACT_ADMINISTRATOR = 1 << 8,
61 SUGGEST_CONTACT_ADMINISTRATOR = 1 << 9,
62 }; 61 };
63 62
64 struct LocalizedErrorMap { 63 struct LocalizedErrorMap {
65 int error_code; 64 int error_code;
66 unsigned int title_resource_id; 65 unsigned int title_resource_id;
67 unsigned int heading_resource_id; 66 unsigned int heading_resource_id;
68 unsigned int summary_resource_id; 67 unsigned int summary_resource_id;
69 unsigned int details_resource_id; 68 unsigned int details_resource_id;
70 int suggestions; // Bitmap of SUGGEST_* values. 69 int suggestions; // Bitmap of SUGGEST_* values.
71 }; 70 };
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 IDS_ERRORPAGES_HEADING_ACCESS_DENIED, 269 IDS_ERRORPAGES_HEADING_ACCESS_DENIED,
271 IDS_ERRORPAGES_SUMMARY_TEMPORARILY_THROTTLED, 270 IDS_ERRORPAGES_SUMMARY_TEMPORARILY_THROTTLED,
272 IDS_ERRORPAGES_DETAILS_TEMPORARILY_THROTTLED, 271 IDS_ERRORPAGES_DETAILS_TEMPORARILY_THROTTLED,
273 SUGGEST_NONE, 272 SUGGEST_NONE,
274 }, 273 },
275 {net::ERR_BLOCKED_BY_CLIENT, 274 {net::ERR_BLOCKED_BY_CLIENT,
276 IDS_ERRORPAGES_TITLE_BLOCKED, 275 IDS_ERRORPAGES_TITLE_BLOCKED,
277 IDS_ERRORPAGES_HEADING_BLOCKED, 276 IDS_ERRORPAGES_HEADING_BLOCKED,
278 IDS_ERRORPAGES_SUMMARY_BLOCKED, 277 IDS_ERRORPAGES_SUMMARY_BLOCKED,
279 IDS_ERRORPAGES_DETAILS_BLOCKED, 278 IDS_ERRORPAGES_DETAILS_BLOCKED,
280 SUGGEST_DISABLE_EXTENSION, 279 SUGGEST_RELOAD | SUGGEST_DISABLE_EXTENSION,
281 }, 280 },
282 {net::ERR_NETWORK_CHANGED, 281 {net::ERR_NETWORK_CHANGED,
283 IDS_ERRORPAGES_TITLE_LOAD_FAILED, 282 IDS_ERRORPAGES_TITLE_LOAD_FAILED,
284 IDS_ERRORPAGES_HEADING_NETWORK_ACCESS_DENIED, 283 IDS_ERRORPAGES_HEADING_NETWORK_ACCESS_DENIED,
285 IDS_ERRORPAGES_SUMMARY_NETWORK_CHANGED, 284 IDS_ERRORPAGES_SUMMARY_NETWORK_CHANGED,
286 IDS_ERRORPAGES_DETAILS_NETWORK_CHANGED, 285 IDS_ERRORPAGES_DETAILS_NETWORK_CHANGED,
287 SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION, 286 SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION,
288 }, 287 },
289 {net::ERR_BLOCKED_BY_ADMINISTRATOR, 288 {net::ERR_BLOCKED_BY_ADMINISTRATOR,
290 IDS_ERRORPAGES_TITLE_BLOCKED, 289 IDS_ERRORPAGES_TITLE_BLOCKED,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (error_domain == net::kErrorDomain && 438 if (error_domain == net::kErrorDomain &&
440 error_code == net::ERR_ACCESS_DENIED && 439 error_code == net::ERR_ACCESS_DENIED &&
441 failed_url.scheme() == "file") { 440 failed_url.scheme() == "file") {
442 options.title_resource_id = IDS_ERRORPAGES_TITLE_ACCESS_DENIED; 441 options.title_resource_id = IDS_ERRORPAGES_TITLE_ACCESS_DENIED;
443 options.heading_resource_id = IDS_ERRORPAGES_HEADING_FILE_ACCESS_DENIED; 442 options.heading_resource_id = IDS_ERRORPAGES_HEADING_FILE_ACCESS_DENIED;
444 options.summary_resource_id = IDS_ERRORPAGES_SUMMARY_FILE_ACCESS_DENIED; 443 options.summary_resource_id = IDS_ERRORPAGES_SUMMARY_FILE_ACCESS_DENIED;
445 options.details_resource_id = IDS_ERRORPAGES_DETAILS_FILE_ACCESS_DENIED; 444 options.details_resource_id = IDS_ERRORPAGES_DETAILS_FILE_ACCESS_DENIED;
446 options.suggestions = SUGGEST_NONE; 445 options.suggestions = SUGGEST_NONE;
447 } 446 }
448 447
449 // If there are any suggestions other than reload, populate the suggestion
450 // heading (reload has a button, rather than a suggestion in the list).
451 if ((options.suggestions & ~SUGGEST_RELOAD) != SUGGEST_NONE) {
452 error_strings->SetString(
453 "suggestionsHeading",
454 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_HEADING));
455 }
456
457 string16 failed_url_string(UTF8ToUTF16(failed_url.spec())); 448 string16 failed_url_string(UTF8ToUTF16(failed_url.spec()));
458 // URLs are always LTR. 449 // URLs are always LTR.
459 if (rtl) 450 if (rtl)
460 base::i18n::WrapStringWithLTRFormatting(&failed_url_string); 451 base::i18n::WrapStringWithLTRFormatting(&failed_url_string);
461 error_strings->SetString("title", 452 error_strings->SetString("title",
462 l10n_util::GetStringFUTF16(options.title_resource_id, failed_url_string)); 453 l10n_util::GetStringFUTF16(options.title_resource_id, failed_url_string));
463 error_strings->SetString("heading", 454 error_strings->SetString("heading",
464 l10n_util::GetStringUTF16(options.heading_resource_id)); 455 l10n_util::GetStringUTF16(options.heading_resource_id));
465 456
466 DictionaryValue* summary = new DictionaryValue; 457 DictionaryValue* summary = new DictionaryValue;
(...skipping 24 matching lines...) Expand all
491 // Remove the leading "net::" from the returned string. 482 // Remove the leading "net::" from the returned string.
492 RemoveChars(ascii_error_string, "net:", &ascii_error_string); 483 RemoveChars(ascii_error_string, "net:", &ascii_error_string);
493 error_string = ASCIIToUTF16(ascii_error_string); 484 error_string = ASCIIToUTF16(ascii_error_string);
494 } else { 485 } else {
495 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain); 486 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain);
496 error_string = base::IntToString16(error_code); 487 error_string = base::IntToString16(error_code);
497 } 488 }
498 error_strings->SetString("errorCode", 489 error_strings->SetString("errorCode",
499 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_ERROR_CODE, error_string)); 490 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_ERROR_CODE, error_string));
500 491
492 base::ListValue* suggestions = new base::ListValue();
493
501 // Platform specific instructions for diagnosing network issues on OSX and 494 // Platform specific instructions for diagnosing network issues on OSX and
502 // Windows. 495 // Windows.
503 #if defined(OS_MACOSX) || defined(OS_WIN) 496 #if defined(OS_MACOSX) || defined(OS_WIN)
504 if (error_domain == net::kErrorDomain && 497 if (error_domain == net::kErrorDomain &&
505 error_code == net::ERR_INTERNET_DISCONNECTED) { 498 error_code == net::ERR_INTERNET_DISCONNECTED) {
506 int platform_string_id = 499 int platform_string_id =
507 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM; 500 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM;
508 #if defined(OS_WIN) 501 #if defined(OS_WIN)
509 // Different versions of Windows have different instructions. 502 // Different versions of Windows have different instructions.
510 base::win::Version windows_version = base::win::GetVersion(); 503 base::win::Version windows_version = base::win::GetVersion();
(...skipping 18 matching lines...) Expand all
529 #endif // defined(OS_MACOSX) || defined(OS_WIN) 522 #endif // defined(OS_MACOSX) || defined(OS_WIN)
530 523
531 if (options.suggestions & SUGGEST_RELOAD) { 524 if (options.suggestions & SUGGEST_RELOAD) {
532 DictionaryValue* reload_button = new DictionaryValue; 525 DictionaryValue* reload_button = new DictionaryValue;
533 reload_button->SetString("msg", 526 reload_button->SetString("msg",
534 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD)); 527 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD));
535 reload_button->SetString("reloadUrl", failed_url_string); 528 reload_button->SetString("reloadUrl", failed_url_string);
536 error_strings->Set("reload", reload_button); 529 error_strings->Set("reload", reload_button);
537 } 530 }
538 531
539 if (options.suggestions & SUGGEST_HOSTNAME) {
540 // Only show the "Go to hostname" suggestion if the failed_url has a path.
541 if (std::string() == failed_url.path()) {
542 DictionaryValue* suggest_home_page = new DictionaryValue;
543 suggest_home_page->SetString("suggestionsHomepageMsg",
544 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_HOMEPAGE));
545 string16 homepage(ASCIIToUTF16(failed_url.GetWithEmptyPath().spec()));
546 // URLs are always LTR.
547 if (rtl)
548 base::i18n::WrapStringWithLTRFormatting(&homepage);
549 suggest_home_page->SetString("homePage", homepage);
550 // TODO(tc): we actually want the unicode hostname
551 suggest_home_page->SetString("hostName", failed_url.host());
552 error_strings->Set("suggestionsHomepage", suggest_home_page);
553 }
554 }
555
556 if (options.suggestions & SUGGEST_CHECK_CONNECTION) { 532 if (options.suggestions & SUGGEST_CHECK_CONNECTION) {
557 DictionaryValue* suggest_check_connection = new DictionaryValue; 533 DictionaryValue* suggest_check_connection = new DictionaryValue;
558 suggest_check_connection->SetString("msg", 534 suggest_check_connection->SetString("header",
559 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION)); 535 l10n_util::GetStringUTF16(
560 error_strings->Set("suggestionsCheckConnection", suggest_check_connection); 536 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_HEADER));
537 suggest_check_connection->SetString("body",
538 l10n_util::GetStringUTF16(
539 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_BODY));
540 suggestions->Append(suggest_check_connection);
561 } 541 }
562 542
563 if (options.suggestions & SUGGEST_DNS_CONFIG) { 543 if (options.suggestions & SUGGEST_DNS_CONFIG) {
564 DictionaryValue* suggest_dns_config = new DictionaryValue; 544 DictionaryValue* suggest_dns_config = new DictionaryValue;
565 suggest_dns_config->SetString("msg", 545 suggest_dns_config->SetString("header",
566 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG)); 546 l10n_util::GetStringUTF16(
567 error_strings->Set("suggestionsDNSConfig", suggest_dns_config); 547 IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG_HEADER));
548 suggest_dns_config->SetString("body",
549 l10n_util::GetStringUTF16(
550 IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG_BODY));
551 suggestions->Append(suggest_dns_config);
568 552
569 DictionaryValue* suggest_network_prediction = GetStandardMenuItemsText(); 553 DictionaryValue* suggest_network_prediction = GetStandardMenuItemsText();
570 suggest_network_prediction->SetString("msg", 554 suggest_network_prediction->SetString("header",
571 l10n_util::GetStringUTF16( 555 l10n_util::GetStringUTF16(
572 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION)); 556 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION_HEADER));
557 suggest_network_prediction->SetString("body",
558 l10n_util::GetStringUTF16(
559 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION_BODY));
573 suggest_network_prediction->SetString( 560 suggest_network_prediction->SetString(
574 "noNetworkPredictionTitle", 561 "noNetworkPredictionTitle",
575 l10n_util::GetStringUTF16( 562 l10n_util::GetStringUTF16(
576 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION)); 563 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION));
577 error_strings->Set("suggestionsDisableNetworkPrediction", 564 suggestions->Append(suggest_network_prediction);
578 suggest_network_prediction);
579 } 565 }
580 566
581 if (options.suggestions & SUGGEST_FIREWALL_CONFIG) { 567 if (options.suggestions & SUGGEST_FIREWALL_CONFIG) {
582 DictionaryValue* suggest_firewall_config = new DictionaryValue; 568 DictionaryValue* suggest_firewall_config = new DictionaryValue;
583 suggest_firewall_config->SetString("msg", 569 suggest_firewall_config->SetString("header",
584 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_FIREWALL_CONFIG)); 570 l10n_util::GetStringUTF16(
585 suggest_firewall_config->SetString("productName", 571 IDS_ERRORPAGES_SUGGESTION_FIREWALL_CONFIG_HEADER));
586 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 572 suggest_firewall_config->SetString("body",
587 error_strings->Set("suggestionsFirewallConfig", suggest_firewall_config); 573 l10n_util::GetStringUTF16(
574 IDS_ERRORPAGES_SUGGESTION_FIREWALL_CONFIG_BODY));
575 suggestions->Append(suggest_firewall_config);
588 } 576 }
589 577
590 if (options.suggestions & SUGGEST_PROXY_CONFIG) { 578 if (options.suggestions & SUGGEST_PROXY_CONFIG) {
591 #if defined(OS_CHROMEOS) 579 #if defined(OS_CHROMEOS)
592 DictionaryValue* suggest_proxy_config = new DictionaryValue(); 580 DictionaryValue* suggest_proxy_config = new DictionaryValue();
593 #else 581 #else
594 DictionaryValue* suggest_proxy_config = GetStandardMenuItemsText(); 582 DictionaryValue* suggest_proxy_config = GetStandardMenuItemsText();
595 #endif // defined(OS_CHROMEOS) 583 #endif // defined(OS_CHROMEOS)
596 suggest_proxy_config->SetString("msg", 584 suggest_proxy_config->SetString("header",
597 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG, 585 l10n_util::GetStringUTF16(
586 IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_HEADER));
587 suggest_proxy_config->SetString("body",
588 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_BODY,
598 l10n_util::GetStringUTF16( 589 l10n_util::GetStringUTF16(
599 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM))); 590 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM)));
600 #if defined(OS_CHROMEOS) 591 #if defined(OS_CHROMEOS)
601 suggest_proxy_config->SetString("settingsTitle", 592 suggest_proxy_config->SetString("settingsTitle",
602 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); 593 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE));
603 suggest_proxy_config->SetString("internetTitle", 594 suggest_proxy_config->SetString("internetTitle",
604 l10n_util::GetStringUTF16(IDS_OPTIONS_INTERNET_TAB_LABEL)); 595 l10n_util::GetStringUTF16(IDS_OPTIONS_INTERNET_TAB_LABEL));
605 suggest_proxy_config->SetString("optionsButton", 596 suggest_proxy_config->SetString("optionsButton",
606 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_OPTIONS)); 597 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_OPTIONS));
607 suggest_proxy_config->SetString("networkTab", 598 suggest_proxy_config->SetString("networkTab",
608 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTERNET_TAB_NETWORK)); 599 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTERNET_TAB_NETWORK));
609 suggest_proxy_config->SetString("proxyButton", 600 suggest_proxy_config->SetString("proxyButton",
610 l10n_util::GetStringUTF16( 601 l10n_util::GetStringUTF16(
611 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CHANGE_PROXY_BUTTON)); 602 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CHANGE_PROXY_BUTTON));
612 #else 603 #else
613 suggest_proxy_config->SetString("proxyTitle", 604 suggest_proxy_config->SetString("proxyTitle",
614 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); 605 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON));
615 #endif // defined(OS_CHROMEOS) 606 #endif // defined(OS_CHROMEOS)
616 error_strings->Set("suggestionsProxyConfig", suggest_proxy_config); 607
608 suggestions->Append(suggest_proxy_config);
617 } 609 }
618 610
619 if (options.suggestions & SUGGEST_DISABLE_EXTENSION) { 611 if (options.suggestions & SUGGEST_DISABLE_EXTENSION) {
620 DictionaryValue* suggestion = new DictionaryValue; 612 DictionaryValue* suggest_disable_extension = new DictionaryValue;
621 suggestion->SetString("msg", 613 // There's only a header for this suggestion.
622 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION)); 614 suggest_disable_extension->SetString("header",
623 suggestion->SetString("reloadUrl", failed_url_string); 615 l10n_util::GetStringUTF16(
624 error_strings->Set("suggestionsDisableExtension", suggestion); 616 IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION_HEADER));
617 suggestions->Append(suggest_disable_extension);
618 }
619
620 if (options.suggestions & SUGGEST_VIEW_POLICIES) {
621 DictionaryValue* suggest_view_policies = new DictionaryValue;
622 suggest_view_policies->SetString(
623 "header",
624 l10n_util::GetStringUTF16(
625 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_HEADER));
626 suggest_view_policies->SetString(
627 "body",
628 l10n_util::GetStringUTF16(
629 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_BODY));
630 suggestions->Append(suggest_view_policies);
631 }
632
633 if (options.suggestions & SUGGEST_CONTACT_ADMINISTRATOR) {
634 DictionaryValue* suggest_contant_administrator = new DictionaryValue;
635 suggest_contant_administrator->SetString(
636 "body",
637 l10n_util::GetStringUTF16(
638 IDS_ERRORPAGES_SUGGESTION_CONTACT_ADMINISTRATOR_BODY));
639 suggestions->Append(suggest_contant_administrator);
625 } 640 }
626 641
627 if (options.suggestions & SUGGEST_LEARNMORE) { 642 if (options.suggestions & SUGGEST_LEARNMORE) {
628 GURL learn_more_url; 643 GURL learn_more_url;
629 switch (options.error_code) { 644 switch (options.error_code) {
630 case net::ERR_TOO_MANY_REDIRECTS: 645 case net::ERR_TOO_MANY_REDIRECTS:
631 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); 646 learn_more_url = GURL(kRedirectLoopLearnMoreUrl);
632 break; 647 break;
633 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: 648 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY:
634 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); 649 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl);
635 break; 650 break;
636 default: 651 default:
637 break; 652 break;
638 } 653 }
639 654
640 if (learn_more_url.is_valid()) { 655 if (learn_more_url.is_valid()) {
641 // Add the language parameter to the URL. 656 // Add the language parameter to the URL.
642 std::string query = learn_more_url.query() + "&hl=" + locale; 657 std::string query = learn_more_url.query() + "&hl=" + locale;
643 GURL::Replacements repl; 658 GURL::Replacements repl;
644 repl.SetQueryStr(query); 659 repl.SetQueryStr(query);
645 learn_more_url = learn_more_url.ReplaceComponents(repl); 660 learn_more_url = learn_more_url.ReplaceComponents(repl);
646 661
647 DictionaryValue* suggest_learn_more = new DictionaryValue; 662 DictionaryValue* suggest_learn_more = new DictionaryValue;
648 suggest_learn_more->SetString("msg", 663 // There's only a body for this suggestion.
649 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); 664 suggest_learn_more->SetString("body",
665 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY));
650 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); 666 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec());
651 error_strings->Set("suggestionsLearnMore", suggest_learn_more); 667 suggestions->Append(suggest_learn_more);
652 } 668 }
653 } 669 }
654 670
655 if (options.suggestions & SUGGEST_VIEW_POLICIES) { 671 error_strings->Set("suggestions", suggestions);
656 DictionaryValue* suggestion = new DictionaryValue;
657 suggestion->SetString("msg",
658 l10n_util::GetStringUTF16(
659 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES));
660 error_strings->Set("suggestionsViewPolicies", suggestion);
661 }
662
663 if (options.suggestions & SUGGEST_CONTACT_ADMINISTRATOR) {
664 DictionaryValue* suggestion = new DictionaryValue;
665 suggestion->SetString("msg",
666 l10n_util::GetStringUTF16(
667 IDS_ERRORPAGES_SUGGESTION_CONTACT_ADMINISTRATOR));
668 error_strings->Set("suggestionsContactAdministrator", suggestion);
669 }
670 } 672 }
671 673
672 string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) { 674 string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) {
673 const LocalizedErrorMap* error_map = 675 const LocalizedErrorMap* error_map =
674 LookupErrorMap(error.domain.utf8(), error.reason); 676 LookupErrorMap(error.domain.utf8(), error.reason);
675 if (error_map) 677 if (error_map)
676 return l10n_util::GetStringUTF16(error_map->details_resource_id); 678 return l10n_util::GetStringUTF16(error_map->details_resource_id);
677 else 679 else
678 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); 680 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN);
679 } 681 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 error_strings->SetString("name", app->name()); 733 error_strings->SetString("name", app->name());
732 error_strings->SetString( 734 error_strings->SetString(
733 "msg", 735 "msg",
734 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); 736 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING));
735 737
736 #if defined(OS_CHROMEOS) 738 #if defined(OS_CHROMEOS)
737 GURL learn_more_url(kAppWarningLearnMoreUrl); 739 GURL learn_more_url(kAppWarningLearnMoreUrl);
738 DictionaryValue* suggest_learn_more = new DictionaryValue(); 740 DictionaryValue* suggest_learn_more = new DictionaryValue();
739 suggest_learn_more->SetString("msg", 741 suggest_learn_more->SetString("msg",
740 l10n_util::GetStringUTF16( 742 l10n_util::GetStringUTF16(
741 IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); 743 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY));
742 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); 744 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec());
743 error_strings->Set("suggestionsLearnMore", suggest_learn_more); 745 error_strings->Set("suggestionsLearnMore", suggest_learn_more);
744 #endif // defined(OS_CHROMEOS) 746 #endif // defined(OS_CHROMEOS)
745 } 747 }
OLDNEW
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | chrome/renderer/resources/neterror.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698