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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 | 623 |
624 DictionaryValue* suggest_learn_more = new DictionaryValue; | 624 DictionaryValue* suggest_learn_more = new DictionaryValue; |
625 suggest_learn_more->SetString("msg", | 625 suggest_learn_more->SetString("msg", |
626 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); | 626 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); |
627 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 627 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
628 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 628 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
629 } | 629 } |
630 } | 630 } |
631 } | 631 } |
632 | 632 |
| 633 string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) { |
| 634 const LocalizedErrorMap* error_map = |
| 635 LookupErrorMap(error.domain.utf8(), error.reason); |
| 636 if (error_map) |
| 637 return l10n_util::GetStringUTF16(error_map->details_resource_id); |
| 638 else |
| 639 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); |
| 640 } |
| 641 |
633 bool LocalizedError::HasStrings(const std::string& error_domain, | 642 bool LocalizedError::HasStrings(const std::string& error_domain, |
634 int error_code) { | 643 int error_code) { |
635 return LookupErrorMap(error_domain, error_code) != NULL; | 644 return LookupErrorMap(error_domain, error_code) != NULL; |
636 } | 645 } |
637 | 646 |
638 void LocalizedError::GetFormRepostStrings(const GURL& display_url, | 647 void LocalizedError::GetFormRepostStrings(const GURL& display_url, |
639 DictionaryValue* error_strings) { | 648 DictionaryValue* error_strings) { |
640 bool rtl = LocaleIsRTL(); | 649 bool rtl = LocaleIsRTL(); |
641 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr"); | 650 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr"); |
642 | 651 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 failed_url.c_str())); | 683 failed_url.c_str())); |
675 | 684 |
676 error_strings->SetString("title", app->name()); | 685 error_strings->SetString("title", app->name()); |
677 error_strings->SetString("icon", | 686 error_strings->SetString("icon", |
678 app->GetIconURL(Extension::EXTENSION_ICON_LARGE, | 687 app->GetIconURL(Extension::EXTENSION_ICON_LARGE, |
679 ExtensionIconSet::MATCH_SMALLER).spec()); | 688 ExtensionIconSet::MATCH_SMALLER).spec()); |
680 error_strings->SetString("name", app->name()); | 689 error_strings->SetString("name", app->name()); |
681 error_strings->SetString("msg", | 690 error_strings->SetString("msg", |
682 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); | 691 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); |
683 } | 692 } |
OLD | NEW |