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" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
16 #include "components/error_page/common/error_page_params.h" | 16 #include "components/error_page/common/error_page_params.h" |
17 #include "components/error_page/common/net_error_info.h" | 17 #include "components/error_page/common/net_error_info.h" |
18 #include "net/base/escape.h" | 18 #include "net/base/escape.h" |
19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
20 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
21 #include "third_party/WebKit/public/platform/WebURLError.h" | 21 #include "third_party/WebKit/public/platform/WebURLError.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/base/webui/web_ui_util.h" | 23 #include "ui/base/webui/web_ui_util.h" |
24 | 24 |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 #include "base/win/windows_version.h" | 26 #include "base/win/windows_version.h" |
27 #endif | 27 #endif |
28 | 28 |
29 #if defined(OS_CHROMEOS) | |
30 #include "base/command_line.h" | |
31 #include "chrome/common/chrome_switches.h" | |
32 #endif | |
33 | |
29 #if defined(ENABLE_EXTENSIONS) | 34 #if defined(ENABLE_EXTENSIONS) |
30 #include "extensions/common/constants.h" | 35 #include "extensions/common/constants.h" |
31 #include "extensions/common/extension_icon_set.h" | 36 #include "extensions/common/extension_icon_set.h" |
32 #include "extensions/common/manifest_handlers/icons_handler.h" | 37 #include "extensions/common/manifest_handlers/icons_handler.h" |
33 #endif | 38 #endif |
34 | 39 |
35 using blink::WebURLError; | 40 using blink::WebURLError; |
36 | 41 |
37 // Some error pages have no details. | 42 // Some error pages have no details. |
38 const unsigned int kErrorPagesNoDetails = 0; | 43 const unsigned int kErrorPagesNoDetails = 0; |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 std::string icon_class = GetIconClassForError(error_domain, error_code); | 564 std::string icon_class = GetIconClassForError(error_domain, error_code); |
560 error_strings->SetString("iconClass", icon_class); | 565 error_strings->SetString("iconClass", icon_class); |
561 | 566 |
562 base::DictionaryValue* summary = new base::DictionaryValue; | 567 base::DictionaryValue* summary = new base::DictionaryValue; |
563 | 568 |
564 // For offline show a summary message underneath the heading. | 569 // For offline show a summary message underneath the heading. |
565 if (error_code == net::ERR_INTERNET_DISCONNECTED || | 570 if (error_code == net::ERR_INTERNET_DISCONNECTED || |
566 error_code == chrome_common_net::DNS_PROBE_FINISHED_NO_INTERNET) { | 571 error_code == chrome_common_net::DNS_PROBE_FINISHED_NO_INTERNET) { |
567 error_strings->SetString("primaryParagraph", | 572 error_strings->SetString("primaryParagraph", |
568 l10n_util::GetStringUTF16(options.summary_resource_id)); | 573 l10n_util::GetStringUTF16(options.summary_resource_id)); |
574 | |
575 #if defined(OS_CHROMEOS) | |
576 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
577 | |
578 // Check if easter egg should be disabled. | |
579 if (command_line->HasSwitch(switches::kDisableDinosaurEasterEgg)) { | |
580 error_strings->SetString("disabledEasterEgg", | |
Andrew T Wilson (Slow)
2015/03/23 16:38:27
Maybe add a comment that the presence of this stri
edwardjung
2015/03/24 16:07:35
Done.
| |
581 l10n_util::GetStringUTF16(IDS_ERRORPAGE_FUN_DISABLED)); | |
582 } | |
583 #endif | |
584 | |
569 } else { | 585 } else { |
570 // Set summary message in the details. | 586 // Set summary message in the details. |
571 summary->SetString("msg", | 587 summary->SetString("msg", |
572 l10n_util::GetStringUTF16(options.summary_resource_id)); | 588 l10n_util::GetStringUTF16(options.summary_resource_id)); |
573 } | 589 } |
574 summary->SetString("failedUrl", failed_url_string); | 590 summary->SetString("failedUrl", failed_url_string); |
575 summary->SetString("hostName", net::IDNToUnicode(failed_url.host(), | 591 summary->SetString("hostName", net::IDNToUnicode(failed_url.host(), |
576 accept_languages)); | 592 accept_languages)); |
577 summary->SetString("productName", | 593 summary->SetString("productName", |
578 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 594 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
880 GURL learn_more_url(kAppWarningLearnMoreUrl); | 896 GURL learn_more_url(kAppWarningLearnMoreUrl); |
881 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); | 897 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); |
882 suggest_learn_more->SetString("msg", | 898 suggest_learn_more->SetString("msg", |
883 l10n_util::GetStringUTF16( | 899 l10n_util::GetStringUTF16( |
884 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); | 900 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); |
885 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 901 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
886 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 902 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
887 #endif // defined(OS_CHROMEOS) | 903 #endif // defined(OS_CHROMEOS) |
888 } | 904 } |
889 #endif | 905 #endif |
OLD | NEW |