Chromium Code Reviews| 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, |
|
mmenke
2013/04/08 15:39:14
This wasn't being used anywhere.
| |
| 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(); |
| 511 if (windows_version < base::win::VERSION_VISTA) { | 504 if (windows_version < base::win::VERSION_VISTA) { |
| 512 // XP, XP64, and Server 2003. | 505 // XP, XP64, and Server 2003. |
| 513 platform_string_id = | 506 platform_string_id = |
| 514 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM_XP; | 507 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM_XP; |
| 515 } else if (windows_version == base::win::VERSION_VISTA) { | 508 } else if (windows_version == base::win::VERSION_VISTA) { |
| 516 // Vista | 509 // Vista |
| 517 platform_string_id = | 510 platform_string_id = |
| 518 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM_VISTA; | 511 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM_VISTA; |
| 519 } | 512 } |
| 520 #endif // defined(OS_WIN) | 513 #endif // defined(OS_WIN) |
| 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 | |
| 531 if (options.suggestions & SUGGEST_RELOAD) { | 523 if (options.suggestions & SUGGEST_RELOAD) { |
| 532 DictionaryValue* reload_button = new DictionaryValue; | 524 DictionaryValue* reload_button = new DictionaryValue; |
| 533 reload_button->SetString("msg", | 525 reload_button->SetString("msg", |
| 534 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD)); | 526 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD)); |
| 535 reload_button->SetString("reloadUrl", failed_url_string); | 527 reload_button->SetString("reloadUrl", failed_url_string); |
| 536 error_strings->Set("reload", reload_button); | 528 error_strings->Set("reload", reload_button); |
| 537 } | 529 } |
| 538 | 530 |
| 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) { | 531 if (options.suggestions & SUGGEST_CHECK_CONNECTION) { |
| 557 DictionaryValue* suggest_check_connection = new DictionaryValue; | 532 DictionaryValue* suggest_check_connection = new DictionaryValue; |
| 558 suggest_check_connection->SetString("msg", | 533 suggest_check_connection->SetString("header", |
| 559 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION)); | 534 l10n_util::GetStringUTF16( |
| 560 error_strings->Set("suggestionsCheckConnection", suggest_check_connection); | 535 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_HEADER)); |
| 536 suggest_check_connection->SetString("body", | |
| 537 l10n_util::GetStringUTF16( | |
| 538 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_BODY)); | |
| 539 suggestions->Append(suggest_check_connection); | |
| 561 } | 540 } |
| 562 | 541 |
| 563 if (options.suggestions & SUGGEST_DNS_CONFIG) { | 542 if (options.suggestions & SUGGEST_DNS_CONFIG) { |
| 564 DictionaryValue* suggest_dns_config = new DictionaryValue; | 543 DictionaryValue* suggest_dns_config = new DictionaryValue; |
| 565 suggest_dns_config->SetString("msg", | 544 suggest_dns_config->SetString("header", |
| 566 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG)); | 545 l10n_util::GetStringUTF16( |
| 567 error_strings->Set("suggestionsDNSConfig", suggest_dns_config); | 546 IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG_HEADER)); |
| 547 suggest_dns_config->SetString("body", | |
| 548 l10n_util::GetStringUTF16( | |
| 549 IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG_BODY)); | |
| 550 suggestions->Append(suggest_dns_config); | |
| 568 | 551 |
| 569 DictionaryValue* suggest_network_prediction = GetStandardMenuItemsText(); | 552 DictionaryValue* suggest_network_prediction = GetStandardMenuItemsText(); |
| 570 suggest_network_prediction->SetString("msg", | 553 suggest_network_prediction->SetString("header", |
| 571 l10n_util::GetStringUTF16( | 554 l10n_util::GetStringUTF16( |
| 572 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION)); | 555 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION_HEADER)); |
| 556 suggest_network_prediction->SetString("body", | |
| 557 l10n_util::GetStringUTF16( | |
| 558 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION_BODY)); | |
| 573 suggest_network_prediction->SetString( | 559 suggest_network_prediction->SetString( |
| 574 "noNetworkPredictionTitle", | 560 "noNetworkPredictionTitle", |
| 575 l10n_util::GetStringUTF16( | 561 l10n_util::GetStringUTF16( |
| 576 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION)); | 562 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION)); |
| 577 error_strings->Set("suggestionsDisableNetworkPrediction", | 563 suggestions->Append(suggest_network_prediction); |
| 578 suggest_network_prediction); | |
| 579 } | 564 } |
| 580 | 565 |
| 581 if (options.suggestions & SUGGEST_FIREWALL_CONFIG) { | 566 if (options.suggestions & SUGGEST_FIREWALL_CONFIG) { |
| 582 DictionaryValue* suggest_firewall_config = new DictionaryValue; | 567 DictionaryValue* suggest_firewall_config = new DictionaryValue; |
| 583 suggest_firewall_config->SetString("msg", | 568 suggest_firewall_config->SetString("header", |
| 584 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_FIREWALL_CONFIG)); | 569 l10n_util::GetStringUTF16( |
| 585 suggest_firewall_config->SetString("productName", | 570 IDS_ERRORPAGES_SUGGESTION_FIREWALL_CONFIG_HEADER)); |
| 586 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 571 suggest_firewall_config->SetString("body", |
| 587 error_strings->Set("suggestionsFirewallConfig", suggest_firewall_config); | 572 l10n_util::GetStringUTF16( |
| 573 IDS_ERRORPAGES_SUGGESTION_FIREWALL_CONFIG_BODY)); | |
| 574 suggestions->Append(suggest_firewall_config); | |
| 588 } | 575 } |
| 589 | 576 |
| 590 if (options.suggestions & SUGGEST_PROXY_CONFIG) { | 577 if (options.suggestions & SUGGEST_PROXY_CONFIG) { |
| 591 #if defined(OS_CHROMEOS) | 578 #if defined(OS_CHROMEOS) |
| 592 DictionaryValue* suggest_proxy_config = new DictionaryValue(); | 579 DictionaryValue* suggest_proxy_config = new DictionaryValue(); |
| 593 #else | 580 #else |
| 594 DictionaryValue* suggest_proxy_config = GetStandardMenuItemsText(); | 581 DictionaryValue* suggest_proxy_config = GetStandardMenuItemsText(); |
| 595 #endif // defined(OS_CHROMEOS) | 582 #endif // defined(OS_CHROMEOS) |
| 596 suggest_proxy_config->SetString("msg", | 583 suggest_proxy_config->SetString("header", |
| 597 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG, | 584 l10n_util::GetStringUTF16( |
| 585 IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_HEADER)); | |
| 586 suggest_proxy_config->SetString("body", | |
| 587 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_BODY, | |
| 598 l10n_util::GetStringUTF16( | 588 l10n_util::GetStringUTF16( |
| 599 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM))); | 589 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM))); |
| 600 #if defined(OS_CHROMEOS) | 590 #if defined(OS_CHROMEOS) |
| 601 suggest_proxy_config->SetString("settingsTitle", | 591 suggest_proxy_config->SetString("settingsTitle", |
| 602 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); | 592 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); |
| 603 suggest_proxy_config->SetString("internetTitle", | 593 suggest_proxy_config->SetString("internetTitle", |
| 604 l10n_util::GetStringUTF16(IDS_OPTIONS_INTERNET_TAB_LABEL)); | 594 l10n_util::GetStringUTF16(IDS_OPTIONS_INTERNET_TAB_LABEL)); |
| 605 suggest_proxy_config->SetString("optionsButton", | 595 suggest_proxy_config->SetString("optionsButton", |
| 606 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_OPTIONS)); | 596 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_OPTIONS)); |
| 607 suggest_proxy_config->SetString("networkTab", | 597 suggest_proxy_config->SetString("networkTab", |
| 608 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTERNET_TAB_NETWORK)); | 598 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTERNET_TAB_NETWORK)); |
| 609 suggest_proxy_config->SetString("proxyButton", | 599 suggest_proxy_config->SetString("proxyButton", |
| 610 l10n_util::GetStringUTF16( | 600 l10n_util::GetStringUTF16( |
| 611 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CHANGE_PROXY_BUTTON)); | 601 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CHANGE_PROXY_BUTTON)); |
| 612 #else | 602 #else |
| 613 suggest_proxy_config->SetString("proxyTitle", | 603 suggest_proxy_config->SetString("proxyTitle", |
| 614 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); | 604 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); |
| 615 #endif // defined(OS_CHROMEOS) | 605 #endif // defined(OS_CHROMEOS) |
| 616 error_strings->Set("suggestionsProxyConfig", suggest_proxy_config); | 606 |
| 607 suggestions->Append(suggest_proxy_config); | |
| 617 } | 608 } |
| 618 | 609 |
| 619 if (options.suggestions & SUGGEST_DISABLE_EXTENSION) { | 610 if (options.suggestions & SUGGEST_DISABLE_EXTENSION) { |
| 620 DictionaryValue* suggestion = new DictionaryValue; | 611 DictionaryValue* suggest_disable_extension = new DictionaryValue; |
| 621 suggestion->SetString("msg", | 612 // There's only a header for this suggestion. |
| 622 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION)); | 613 suggest_disable_extension->SetString("header", |
| 623 suggestion->SetString("reloadUrl", failed_url_string); | 614 l10n_util::GetStringUTF16( |
| 624 error_strings->Set("suggestionsDisableExtension", suggestion); | 615 IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION_HEADER)); |
| 616 suggestions->Append(suggest_disable_extension); | |
| 617 } | |
| 618 | |
| 619 if (options.suggestions & SUGGEST_VIEW_POLICIES) { | |
| 620 DictionaryValue* suggest_view_policies = new DictionaryValue; | |
| 621 suggest_view_policies->SetString( | |
| 622 "header", | |
| 623 l10n_util::GetStringUTF16( | |
| 624 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_HEADER)); | |
| 625 suggest_view_policies->SetString( | |
| 626 "body", | |
| 627 l10n_util::GetStringUTF16( | |
| 628 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_BODY)); | |
| 629 suggestions->Append(suggest_view_policies); | |
| 630 } | |
| 631 | |
| 632 if (options.suggestions & SUGGEST_CONTACT_ADMINISTRATOR) { | |
| 633 DictionaryValue* suggest_contant_administrator = new DictionaryValue; | |
| 634 suggest_contant_administrator->SetString( | |
| 635 "body", | |
| 636 l10n_util::GetStringUTF16( | |
| 637 IDS_ERRORPAGES_SUGGESTION_CONTACT_ADMINISTRATOR_BODY)); | |
| 638 suggestions->Append(suggest_contant_administrator); | |
| 625 } | 639 } |
| 626 | 640 |
| 627 if (options.suggestions & SUGGEST_LEARNMORE) { | 641 if (options.suggestions & SUGGEST_LEARNMORE) { |
| 628 GURL learn_more_url; | 642 GURL learn_more_url; |
| 629 switch (options.error_code) { | 643 switch (options.error_code) { |
| 630 case net::ERR_TOO_MANY_REDIRECTS: | 644 case net::ERR_TOO_MANY_REDIRECTS: |
| 631 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); | 645 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); |
| 632 break; | 646 break; |
| 633 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: | 647 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: |
| 634 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); | 648 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); |
| 635 break; | 649 break; |
| 636 default: | 650 default: |
| 637 break; | 651 break; |
| 638 } | 652 } |
| 639 | 653 |
| 640 if (learn_more_url.is_valid()) { | 654 if (learn_more_url.is_valid()) { |
| 641 // Add the language parameter to the URL. | 655 // Add the language parameter to the URL. |
| 642 std::string query = learn_more_url.query() + "&hl=" + locale; | 656 std::string query = learn_more_url.query() + "&hl=" + locale; |
| 643 GURL::Replacements repl; | 657 GURL::Replacements repl; |
| 644 repl.SetQueryStr(query); | 658 repl.SetQueryStr(query); |
| 645 learn_more_url = learn_more_url.ReplaceComponents(repl); | 659 learn_more_url = learn_more_url.ReplaceComponents(repl); |
| 646 | 660 |
| 647 DictionaryValue* suggest_learn_more = new DictionaryValue; | 661 DictionaryValue* suggest_learn_more = new DictionaryValue; |
| 648 suggest_learn_more->SetString("msg", | 662 // There's only a body for this suggestion. |
| 649 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); | 663 suggest_learn_more->SetString("body", |
| 664 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); | |
| 650 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 665 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
| 651 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 666 suggestions->Append(suggest_learn_more); |
| 652 } | 667 } |
| 653 } | 668 } |
| 654 | 669 |
| 655 if (options.suggestions & SUGGEST_VIEW_POLICIES) { | 670 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 } | 671 } |
| 671 | 672 |
| 672 string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) { | 673 string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) { |
| 673 const LocalizedErrorMap* error_map = | 674 const LocalizedErrorMap* error_map = |
| 674 LookupErrorMap(error.domain.utf8(), error.reason); | 675 LookupErrorMap(error.domain.utf8(), error.reason); |
| 675 if (error_map) | 676 if (error_map) |
| 676 return l10n_util::GetStringUTF16(error_map->details_resource_id); | 677 return l10n_util::GetStringUTF16(error_map->details_resource_id); |
| 677 else | 678 else |
| 678 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); | 679 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); |
| 679 } | 680 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 731 error_strings->SetString("name", app->name()); | 732 error_strings->SetString("name", app->name()); |
| 732 error_strings->SetString( | 733 error_strings->SetString( |
| 733 "msg", | 734 "msg", |
| 734 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); | 735 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); |
| 735 | 736 |
| 736 #if defined(OS_CHROMEOS) | 737 #if defined(OS_CHROMEOS) |
| 737 GURL learn_more_url(kAppWarningLearnMoreUrl); | 738 GURL learn_more_url(kAppWarningLearnMoreUrl); |
| 738 DictionaryValue* suggest_learn_more = new DictionaryValue(); | 739 DictionaryValue* suggest_learn_more = new DictionaryValue(); |
| 739 suggest_learn_more->SetString("msg", | 740 suggest_learn_more->SetString("msg", |
| 740 l10n_util::GetStringUTF16( | 741 l10n_util::GetStringUTF16( |
| 741 IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); | 742 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); |
| 742 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 743 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
| 743 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 744 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
| 744 #endif // defined(OS_CHROMEOS) | 745 #endif // defined(OS_CHROMEOS) |
| 745 } | 746 } |
| OLD | NEW |