Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: chrome/common/localized_error.cc

Issue 977323003: Disable easter egg on enterprised enrolled devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove debug, fix indentation in JS Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // The prescence of this string disables the easter egg. Acts as a flag.
581 error_strings->SetString("disabledEasterEgg",
582 l10n_util::GetStringUTF16(IDS_ERRORPAGE_FUN_DISABLED));
583 }
584 #endif
585
569 } else { 586 } else {
570 // Set summary message in the details. 587 // Set summary message in the details.
571 summary->SetString("msg", 588 summary->SetString("msg",
572 l10n_util::GetStringUTF16(options.summary_resource_id)); 589 l10n_util::GetStringUTF16(options.summary_resource_id));
573 } 590 }
574 summary->SetString("failedUrl", failed_url_string); 591 summary->SetString("failedUrl", failed_url_string);
575 summary->SetString("hostName", net::IDNToUnicode(failed_url.host(), 592 summary->SetString("hostName", net::IDNToUnicode(failed_url.host(),
576 accept_languages)); 593 accept_languages));
577 summary->SetString("productName", 594 summary->SetString("productName",
578 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 595 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 GURL learn_more_url(kAppWarningLearnMoreUrl); 897 GURL learn_more_url(kAppWarningLearnMoreUrl);
881 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); 898 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue();
882 suggest_learn_more->SetString("msg", 899 suggest_learn_more->SetString("msg",
883 l10n_util::GetStringUTF16( 900 l10n_util::GetStringUTF16(
884 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); 901 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY));
885 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); 902 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec());
886 error_strings->Set("suggestionsLearnMore", suggest_learn_more); 903 error_strings->Set("suggestionsLearnMore", suggest_learn_more);
887 #endif // defined(OS_CHROMEOS) 904 #endif // defined(OS_CHROMEOS)
888 } 905 }
889 #endif 906 #endif
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | chrome/renderer/resources/default_100_percent/offline/100-disabled.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698