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 "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 Loading... | |
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 Loading... | |
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 Loading... | |
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 Loading... | |
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 10 matching lines...) Expand all Loading... | |
521 // Lead with the general error description, and suffix with the platform | 514 // Lead with the general error description, and suffix with the platform |
522 // dependent portion of the summary section. | 515 // dependent portion of the summary section. |
523 summary->SetString("msg", | 516 summary->SetString("msg", |
524 l10n_util::GetStringFUTF16( | 517 l10n_util::GetStringFUTF16( |
525 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_INSTRUCTIONS_TEMPLATE, | 518 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_INSTRUCTIONS_TEMPLATE, |
526 l10n_util::GetStringUTF16(options.summary_resource_id), | 519 l10n_util::GetStringUTF16(options.summary_resource_id), |
527 l10n_util::GetStringUTF16(platform_string_id))); | 520 l10n_util::GetStringUTF16(platform_string_id))); |
528 } | 521 } |
529 #endif // defined(OS_MACOSX) || defined(OS_WIN) | 522 #endif // defined(OS_MACOSX) || defined(OS_WIN) |
530 | 523 |
524 options.suggestions = -1; | |
531 if (options.suggestions & SUGGEST_RELOAD) { | 525 if (options.suggestions & SUGGEST_RELOAD) { |
532 DictionaryValue* reload_button = new DictionaryValue; | 526 DictionaryValue* reload_button = new DictionaryValue; |
533 reload_button->SetString("msg", | 527 reload_button->SetString("msg", |
534 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD)); | 528 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD)); |
535 reload_button->SetString("reloadUrl", failed_url_string); | 529 reload_button->SetString("reloadUrl", failed_url_string); |
536 error_strings->Set("reload", reload_button); | 530 error_strings->Set("reload", reload_button); |
537 } | 531 } |
538 | 532 |
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) { | 533 if (options.suggestions & SUGGEST_CHECK_CONNECTION) { |
557 DictionaryValue* suggest_check_connection = new DictionaryValue; | 534 DictionaryValue* suggest_check_connection = new DictionaryValue; |
558 suggest_check_connection->SetString("msg", | 535 suggest_check_connection->SetString("header", |
559 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION)); | 536 l10n_util::GetStringUTF16( |
560 error_strings->Set("suggestionsCheckConnection", suggest_check_connection); | 537 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_HEADER)); |
538 suggest_check_connection->SetString("body", | |
539 l10n_util::GetStringUTF16( | |
540 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_BODY)); | |
541 suggestions->Append(suggest_check_connection); | |
561 } | 542 } |
562 | 543 |
563 if (options.suggestions & SUGGEST_DNS_CONFIG) { | 544 if (options.suggestions & SUGGEST_DNS_CONFIG) { |
564 DictionaryValue* suggest_dns_config = new DictionaryValue; | 545 DictionaryValue* suggest_dns_config = new DictionaryValue; |
565 suggest_dns_config->SetString("msg", | 546 suggest_dns_config->SetString("header", |
ericroman
2013/04/06 00:22:08
I hope you tested these, because verifying correct
mmenke
2013/04/08 15:35:47
Yea, I've tested all of these. I set the suggesti
| |
566 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG)); | 547 l10n_util::GetStringUTF16( |
567 error_strings->Set("suggestionsDNSConfig", suggest_dns_config); | 548 IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG_HEADER)); |
549 suggest_dns_config->SetString("body", | |
550 l10n_util::GetStringUTF16( | |
551 IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG_BODY)); | |
552 suggestions->Append(suggest_dns_config); | |
568 | 553 |
569 DictionaryValue* suggest_network_prediction = GetStandardMenuItemsText(); | 554 DictionaryValue* suggest_network_prediction = GetStandardMenuItemsText(); |
570 suggest_network_prediction->SetString("msg", | 555 suggest_network_prediction->SetString("header", |
571 l10n_util::GetStringUTF16( | 556 l10n_util::GetStringUTF16( |
572 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION)); | 557 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION_HEADER)); |
558 suggest_network_prediction->SetString("body", | |
559 l10n_util::GetStringUTF16( | |
560 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION_BODY)); | |
573 suggest_network_prediction->SetString( | 561 suggest_network_prediction->SetString( |
574 "noNetworkPredictionTitle", | 562 "noNetworkPredictionTitle", |
575 l10n_util::GetStringUTF16( | 563 l10n_util::GetStringUTF16( |
576 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION)); | 564 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION)); |
577 error_strings->Set("suggestionsDisableNetworkPrediction", | 565 suggestions->Append(suggest_network_prediction); |
578 suggest_network_prediction); | |
579 } | 566 } |
580 | 567 |
581 if (options.suggestions & SUGGEST_FIREWALL_CONFIG) { | 568 if (options.suggestions & SUGGEST_FIREWALL_CONFIG) { |
582 DictionaryValue* suggest_firewall_config = new DictionaryValue; | 569 DictionaryValue* suggest_firewall_config = new DictionaryValue; |
583 suggest_firewall_config->SetString("msg", | 570 suggest_firewall_config->SetString("header", |
584 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_FIREWALL_CONFIG)); | 571 l10n_util::GetStringUTF16( |
585 suggest_firewall_config->SetString("productName", | 572 IDS_ERRORPAGES_SUGGESTION_FIREWALL_CONFIG_HEADER)); |
586 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 573 suggest_firewall_config->SetString("body", |
587 error_strings->Set("suggestionsFirewallConfig", suggest_firewall_config); | 574 l10n_util::GetStringUTF16( |
575 IDS_ERRORPAGES_SUGGESTION_FIREWALL_CONFIG_BODY)); | |
576 suggestions->Append(suggest_firewall_config); | |
588 } | 577 } |
589 | 578 |
590 if (options.suggestions & SUGGEST_PROXY_CONFIG) { | 579 if (options.suggestions & SUGGEST_PROXY_CONFIG) { |
591 #if defined(OS_CHROMEOS) | 580 #if defined(OS_ANDROID) || defined(OS_IOS) |
581 // Android and iOS have no instructions on how to disable a configured | |
582 // proxy. | |
592 DictionaryValue* suggest_proxy_config = new DictionaryValue(); | 583 DictionaryValue* suggest_proxy_config = new DictionaryValue(); |
584 suggest_proxy_config->SetString("body", | |
585 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_BODY)); | |
586 #elif defined(OS_CHROMEOS) | |
587 // ChromeOS's instructions on how to disable a proxy need a number of UI | |
588 // strings unique to ChromeOS. | |
589 DictionaryValue* suggest_proxy_config = new DictionaryValue(); | |
590 suggest_proxy_config->SetString("settingsTitle", | |
591 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); | |
592 suggest_proxy_config->SetString("internetGroup", | |
593 l10n_util::GetStringUTF16(IDS_OPTIONS_INTERNET_OPTIONS_GROUP_LABEL)); | |
594 suggest_proxy_config->SetString("proxyTab", | |
595 l10n_util::GetStringUTF16( | |
596 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CHANGE_PROXY_BUTTON)); | |
597 suggest_proxy_config->SetString("directConnection", | |
598 l10n_util::GetStringUTF16(IDS_PROXY_DIRECT_CONNECTION)); | |
599 suggest_proxy_config->SetString("body", | |
600 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_BODY, | |
601 l10n_util::GetStringUTF16( | |
602 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM))); | |
593 #else | 603 #else |
594 DictionaryValue* suggest_proxy_config = GetStandardMenuItemsText(); | 604 DictionaryValue* suggest_proxy_config = GetStandardMenuItemsText(); |
595 #endif // defined(OS_CHROMEOS) | 605 suggest_proxy_config->SetString("proxyTitle", |
596 suggest_proxy_config->SetString("msg", | 606 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); |
597 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG, | 607 suggest_proxy_config->SetString("body", |
608 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_BODY, | |
598 l10n_util::GetStringUTF16( | 609 l10n_util::GetStringUTF16( |
599 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM))); | 610 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM))); |
600 #if defined(OS_CHROMEOS) | 611 #endif |
601 suggest_proxy_config->SetString("settingsTitle", | 612 |
602 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); | 613 suggest_proxy_config->SetString("header", |
603 suggest_proxy_config->SetString("internetTitle", | |
604 l10n_util::GetStringUTF16(IDS_OPTIONS_INTERNET_TAB_LABEL)); | |
605 suggest_proxy_config->SetString("optionsButton", | |
606 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_OPTIONS)); | |
607 suggest_proxy_config->SetString("networkTab", | |
608 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTERNET_TAB_NETWORK)); | |
609 suggest_proxy_config->SetString("proxyButton", | |
610 l10n_util::GetStringUTF16( | 614 l10n_util::GetStringUTF16( |
611 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CHANGE_PROXY_BUTTON)); | 615 IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_HEADER)); |
612 #else | 616 suggestions->Append(suggest_proxy_config); |
613 suggest_proxy_config->SetString("proxyTitle", | |
614 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); | |
615 #endif // defined(OS_CHROMEOS) | |
616 error_strings->Set("suggestionsProxyConfig", suggest_proxy_config); | |
617 } | 617 } |
618 | 618 |
619 if (options.suggestions & SUGGEST_DISABLE_EXTENSION) { | 619 if (options.suggestions & SUGGEST_DISABLE_EXTENSION) { |
620 DictionaryValue* suggestion = new DictionaryValue; | 620 DictionaryValue* suggest_disable_extension = new DictionaryValue; |
621 suggestion->SetString("msg", | 621 // There's only a header for this suggestion. |
622 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION)); | 622 suggest_disable_extension->SetString("header", |
623 suggestion->SetString("reloadUrl", failed_url_string); | 623 l10n_util::GetStringUTF16( |
624 error_strings->Set("suggestionsDisableExtension", suggestion); | 624 IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION_HEADER)); |
625 suggestions->Append(suggest_disable_extension); | |
626 } | |
627 | |
628 if (options.suggestions & SUGGEST_VIEW_POLICIES) { | |
629 DictionaryValue* suggest_view_policies = new DictionaryValue; | |
630 suggest_view_policies->SetString( | |
631 "header", | |
632 l10n_util::GetStringUTF16( | |
633 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_HEADER)); | |
634 suggest_view_policies->SetString( | |
635 "body", | |
636 l10n_util::GetStringUTF16( | |
637 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_BODY)); | |
638 suggestions->Append(suggest_view_policies); | |
639 } | |
640 | |
641 if (options.suggestions & SUGGEST_CONTACT_ADMINISTRATOR) { | |
642 DictionaryValue* suggest_contant_administrator = new DictionaryValue; | |
643 suggest_contant_administrator->SetString( | |
644 "body", | |
645 l10n_util::GetStringUTF16( | |
646 IDS_ERRORPAGES_SUGGESTION_CONTACT_ADMINISTRATOR_BODY)); | |
647 suggestions->Append(suggest_contant_administrator); | |
625 } | 648 } |
626 | 649 |
627 if (options.suggestions & SUGGEST_LEARNMORE) { | 650 if (options.suggestions & SUGGEST_LEARNMORE) { |
628 GURL learn_more_url; | 651 GURL learn_more_url; |
652 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); | |
ericroman
2013/04/06 00:22:08
nit: merge this onto previous line
mmenke
2013/04/08 15:35:47
Oops...this was a line for debugging. Removed.
| |
629 switch (options.error_code) { | 653 switch (options.error_code) { |
630 case net::ERR_TOO_MANY_REDIRECTS: | 654 case net::ERR_TOO_MANY_REDIRECTS: |
631 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); | 655 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); |
632 break; | 656 break; |
633 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: | 657 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: |
634 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); | 658 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); |
635 break; | 659 break; |
636 default: | 660 default: |
637 break; | 661 break; |
638 } | 662 } |
639 | 663 |
640 if (learn_more_url.is_valid()) { | 664 if (learn_more_url.is_valid()) { |
641 // Add the language parameter to the URL. | 665 // Add the language parameter to the URL. |
642 std::string query = learn_more_url.query() + "&hl=" + locale; | 666 std::string query = learn_more_url.query() + "&hl=" + locale; |
643 GURL::Replacements repl; | 667 GURL::Replacements repl; |
644 repl.SetQueryStr(query); | 668 repl.SetQueryStr(query); |
645 learn_more_url = learn_more_url.ReplaceComponents(repl); | 669 learn_more_url = learn_more_url.ReplaceComponents(repl); |
646 | 670 |
647 DictionaryValue* suggest_learn_more = new DictionaryValue; | 671 DictionaryValue* suggest_learn_more = new DictionaryValue; |
648 suggest_learn_more->SetString("msg", | 672 // There's only a body for this suggestion. |
649 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); | 673 suggest_learn_more->SetString("body", |
674 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); | |
650 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 675 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
651 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 676 suggestions->Append(suggest_learn_more); |
652 } | 677 } |
653 } | 678 } |
654 | 679 |
655 if (options.suggestions & SUGGEST_VIEW_POLICIES) { | 680 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 } | 681 } |
671 | 682 |
672 string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) { | 683 string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) { |
673 const LocalizedErrorMap* error_map = | 684 const LocalizedErrorMap* error_map = |
674 LookupErrorMap(error.domain.utf8(), error.reason); | 685 LookupErrorMap(error.domain.utf8(), error.reason); |
675 if (error_map) | 686 if (error_map) |
676 return l10n_util::GetStringUTF16(error_map->details_resource_id); | 687 return l10n_util::GetStringUTF16(error_map->details_resource_id); |
677 else | 688 else |
678 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); | 689 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); |
679 } | 690 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
731 error_strings->SetString("name", app->name()); | 742 error_strings->SetString("name", app->name()); |
732 error_strings->SetString( | 743 error_strings->SetString( |
733 "msg", | 744 "msg", |
734 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); | 745 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); |
735 | 746 |
736 #if defined(OS_CHROMEOS) | 747 #if defined(OS_CHROMEOS) |
737 GURL learn_more_url(kAppWarningLearnMoreUrl); | 748 GURL learn_more_url(kAppWarningLearnMoreUrl); |
738 DictionaryValue* suggest_learn_more = new DictionaryValue(); | 749 DictionaryValue* suggest_learn_more = new DictionaryValue(); |
739 suggest_learn_more->SetString("msg", | 750 suggest_learn_more->SetString("msg", |
740 l10n_util::GetStringUTF16( | 751 l10n_util::GetStringUTF16( |
741 IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); | 752 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); |
742 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 753 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
743 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 754 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
744 #endif // defined(OS_CHROMEOS) | 755 #endif // defined(OS_CHROMEOS) |
745 } | 756 } |
OLD | NEW |