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/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 522 |
523 string16 failed_url_string(UTF8ToUTF16(failed_url.spec())); | 523 string16 failed_url_string(UTF8ToUTF16(failed_url.spec())); |
524 // URLs are always LTR. | 524 // URLs are always LTR. |
525 if (rtl) | 525 if (rtl) |
526 base::i18n::WrapStringWithLTRFormatting(&failed_url_string); | 526 base::i18n::WrapStringWithLTRFormatting(&failed_url_string); |
527 error_strings->SetString("title", | 527 error_strings->SetString("title", |
528 l10n_util::GetStringFUTF16(options.title_resource_id, failed_url_string)); | 528 l10n_util::GetStringFUTF16(options.title_resource_id, failed_url_string)); |
529 error_strings->SetString("heading", | 529 error_strings->SetString("heading", |
530 l10n_util::GetStringUTF16(options.heading_resource_id)); | 530 l10n_util::GetStringUTF16(options.heading_resource_id)); |
531 | 531 |
| 532 std::string icon_class = (error_code == net::ERR_INTERNET_DISCONNECTED && |
| 533 error_domain == net::kErrorDomain) |
| 534 ? "icon-offline" |
| 535 : "icon-generic"; |
| 536 error_strings->SetString("iconClass", icon_class); |
| 537 |
532 base::DictionaryValue* summary = new base::DictionaryValue; | 538 base::DictionaryValue* summary = new base::DictionaryValue; |
533 summary->SetString("msg", | 539 summary->SetString("msg", |
534 l10n_util::GetStringUTF16(options.summary_resource_id)); | 540 l10n_util::GetStringUTF16(options.summary_resource_id)); |
535 // TODO(tc): We want the unicode url and host here since they're being | 541 // TODO(tc): We want the unicode url and host here since they're being |
536 // displayed. | 542 // displayed. |
537 summary->SetString("failedUrl", failed_url_string); | 543 summary->SetString("failedUrl", failed_url_string); |
538 summary->SetString("hostName", failed_url.host()); | 544 summary->SetString("hostName", failed_url.host()); |
539 summary->SetString("productName", | 545 summary->SetString("productName", |
540 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 546 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
541 | 547 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 #if defined(OS_CHROMEOS) | 807 #if defined(OS_CHROMEOS) |
802 GURL learn_more_url(kAppWarningLearnMoreUrl); | 808 GURL learn_more_url(kAppWarningLearnMoreUrl); |
803 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); | 809 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); |
804 suggest_learn_more->SetString("msg", | 810 suggest_learn_more->SetString("msg", |
805 l10n_util::GetStringUTF16( | 811 l10n_util::GetStringUTF16( |
806 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); | 812 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); |
807 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 813 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
808 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 814 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
809 #endif // defined(OS_CHROMEOS) | 815 #endif // defined(OS_CHROMEOS) |
810 } | 816 } |
OLD | NEW |