OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "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_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 | 601 |
602 DictionaryValue* suggest_learn_more = new DictionaryValue; | 602 DictionaryValue* suggest_learn_more = new DictionaryValue; |
603 suggest_learn_more->SetString("msg", | 603 suggest_learn_more->SetString("msg", |
604 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); | 604 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); |
605 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 605 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
606 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 606 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
607 } | 607 } |
608 } | 608 } |
609 } | 609 } |
610 | 610 |
| 611 string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) { |
| 612 const LocalizedErrorMap* error_map = |
| 613 LookupErrorMap(error.domain.utf8(), error.reason); |
| 614 if (error_map) |
| 615 return l10n_util::GetStringUTF16(error_map->details_resource_id); |
| 616 else |
| 617 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); |
| 618 } |
| 619 |
611 bool LocalizedError::HasStrings(const std::string& error_domain, | 620 bool LocalizedError::HasStrings(const std::string& error_domain, |
612 int error_code) { | 621 int error_code) { |
613 return LookupErrorMap(error_domain, error_code) != NULL; | 622 return LookupErrorMap(error_domain, error_code) != NULL; |
614 } | 623 } |
615 | 624 |
616 void LocalizedError::GetFormRepostStrings(const GURL& display_url, | 625 void LocalizedError::GetFormRepostStrings(const GURL& display_url, |
617 DictionaryValue* error_strings) { | 626 DictionaryValue* error_strings) { |
618 bool rtl = LocaleIsRTL(); | 627 bool rtl = LocaleIsRTL(); |
619 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr"); | 628 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr"); |
620 | 629 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 failed_url.c_str())); | 661 failed_url.c_str())); |
653 | 662 |
654 error_strings->SetString("title", app->name()); | 663 error_strings->SetString("title", app->name()); |
655 error_strings->SetString("icon", | 664 error_strings->SetString("icon", |
656 app->GetIconURL(Extension::EXTENSION_ICON_LARGE, | 665 app->GetIconURL(Extension::EXTENSION_ICON_LARGE, |
657 ExtensionIconSet::MATCH_SMALLER).spec()); | 666 ExtensionIconSet::MATCH_SMALLER).spec()); |
658 error_strings->SetString("name", app->name()); | 667 error_strings->SetString("name", app->name()); |
659 error_strings->SetString("msg", | 668 error_strings->SetString("msg", |
660 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); | 669 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); |
661 } | 670 } |
OLD | NEW |