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/base64.h" | |
7 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/string16.h" | 10 #include "base/string16.h" |
10 #include "base/string_util.h" | 11 #include "base/string_util.h" |
11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "chrome/common/extensions/extension_constants.h" | 15 #include "chrome/common/extensions/extension_constants.h" |
15 #include "chrome/common/extensions/extension_icon_set.h" | 16 #include "chrome/common/extensions/extension_icon_set.h" |
16 #include "chrome/common/extensions/extension_set.h" | 17 #include "chrome/common/extensions/extension_set.h" |
17 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 18 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
18 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
19 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
22 #include "grit/theme_resources.h" | |
21 #include "net/base/escape.h" | 23 #include "net/base/escape.h" |
22 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
23 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h" | 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h" |
24 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/resource/resource_bundle.h" | |
25 #include "ui/webui/web_ui_util.h" | 28 #include "ui/webui/web_ui_util.h" |
26 #include "webkit/glue/webkit_glue.h" | 29 #include "webkit/glue/webkit_glue.h" |
27 | 30 |
28 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
29 #include "base/win/windows_version.h" | 32 #include "base/win/windows_version.h" |
30 #endif | 33 #endif |
31 | 34 |
32 using WebKit::WebURLError; | 35 using WebKit::WebURLError; |
33 | 36 |
34 // Some error pages have no details. | 37 // Some error pages have no details. |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
644 DictionaryValue* suggest_learn_more = new DictionaryValue; | 647 DictionaryValue* suggest_learn_more = new DictionaryValue; |
645 // There's only a body for this suggestion. | 648 // There's only a body for this suggestion. |
646 suggest_learn_more->SetString("body", | 649 suggest_learn_more->SetString("body", |
647 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); | 650 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); |
648 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 651 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
649 suggestions->Append(suggest_learn_more); | 652 suggestions->Append(suggest_learn_more); |
650 } | 653 } |
651 } | 654 } |
652 | 655 |
653 error_strings->Set("suggestions", suggestions); | 656 error_strings->Set("suggestions", suggestions); |
657 | |
658 std::string resource_base64; | |
659 if (base::Base64Encode( | |
660 ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( | |
661 IDR_ERROR_NETWORK_GENERIC, ui::GetMaxScaleFactor()), | |
Nico
2013/04/16 23:15:11
This is not correct. This needs to be a -webkit-im
mmenke
2013/04/16 23:23:02
This is run in a generic renderer process, and doe
mmenke
2013/04/16 23:27:18
Sorry...Just skimmed your response. I'll go ahead
mmenke
2013/04/16 23:57:30
I've embedded the images.
| |
662 &resource_base64)) { | |
663 base::StringValue* data_url = | |
664 new base::StringValue("data:image/png;base64," + resource_base64); | |
665 error_strings->Set("image", data_url); | |
666 } | |
654 } | 667 } |
655 | 668 |
656 string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) { | 669 string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) { |
657 const LocalizedErrorMap* error_map = | 670 const LocalizedErrorMap* error_map = |
658 LookupErrorMap(error.domain.utf8(), error.reason); | 671 LookupErrorMap(error.domain.utf8(), error.reason); |
659 if (error_map) | 672 if (error_map) |
660 return l10n_util::GetStringUTF16(error_map->details_resource_id); | 673 return l10n_util::GetStringUTF16(error_map->details_resource_id); |
661 else | 674 else |
662 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); | 675 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); |
663 } | 676 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
720 #if defined(OS_CHROMEOS) | 733 #if defined(OS_CHROMEOS) |
721 GURL learn_more_url(kAppWarningLearnMoreUrl); | 734 GURL learn_more_url(kAppWarningLearnMoreUrl); |
722 DictionaryValue* suggest_learn_more = new DictionaryValue(); | 735 DictionaryValue* suggest_learn_more = new DictionaryValue(); |
723 suggest_learn_more->SetString("msg", | 736 suggest_learn_more->SetString("msg", |
724 l10n_util::GetStringUTF16( | 737 l10n_util::GetStringUTF16( |
725 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); | 738 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); |
726 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 739 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
727 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 740 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
728 #endif // defined(OS_CHROMEOS) | 741 #endif // defined(OS_CHROMEOS) |
729 } | 742 } |
OLD | NEW |