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

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

Issue 664553007: Cleanup: Put more chrome/ code behind ENABLE_EXTENSIONS ifdefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: fix android Created 6 years, 2 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
« no previous file with comments | « chrome/common/localized_error.h ('k') | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/common/constants.h"
19 #include "extensions/common/extension_icon_set.h"
20 #include "extensions/common/manifest_handlers/icons_handler.h"
21 #include "net/base/escape.h" 18 #include "net/base/escape.h"
22 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
23 #include "net/base/net_util.h" 20 #include "net/base/net_util.h"
24 #include "third_party/WebKit/public/platform/WebURLError.h" 21 #include "third_party/WebKit/public/platform/WebURLError.h"
25 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/webui/web_ui_util.h" 23 #include "ui/base/webui/web_ui_util.h"
27 24
28 #if defined(OS_WIN) 25 #if defined(OS_WIN)
29 #include "base/win/windows_version.h" 26 #include "base/win/windows_version.h"
30 #endif 27 #endif
31 28
29 #if defined(ENABLE_EXTENSIONS)
30 #include "extensions/common/constants.h"
31 #include "extensions/common/extension_icon_set.h"
32 #include "extensions/common/manifest_handlers/icons_handler.h"
33 #endif
34
32 using blink::WebURLError; 35 using blink::WebURLError;
33 36
34 // Some error pages have no details. 37 // Some error pages have no details.
35 const unsigned int kErrorPagesNoDetails = 0; 38 const unsigned int kErrorPagesNoDetails = 0;
36 39
37 namespace { 40 namespace {
38 41
39 static const char kRedirectLoopLearnMoreUrl[] = 42 static const char kRedirectLoopLearnMoreUrl[] =
40 "https://www.google.com/support/chrome/bin/answer.py?answer=95626"; 43 "https://www.google.com/support/chrome/bin/answer.py?answer=95626";
41 static const char kWeakDHKeyLearnMoreUrl[] = 44 static const char kWeakDHKeyLearnMoreUrl[] =
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 } 843 }
841 844
842 bool LocalizedError::HasStrings(const std::string& error_domain, 845 bool LocalizedError::HasStrings(const std::string& error_domain,
843 int error_code) { 846 int error_code) {
844 // Whether or not the there are strings for an error does not depend on 847 // Whether or not the there are strings for an error does not depend on
845 // whether or not the page was be generated by a POST, so just claim it was 848 // whether or not the page was be generated by a POST, so just claim it was
846 // not. 849 // not.
847 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != NULL; 850 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != NULL;
848 } 851 }
849 852
853 #if defined(ENABLE_EXTENSIONS)
850 void LocalizedError::GetAppErrorStrings( 854 void LocalizedError::GetAppErrorStrings(
851 const GURL& display_url, 855 const GURL& display_url,
852 const extensions::Extension* app, 856 const extensions::Extension* app,
853 base::DictionaryValue* error_strings) { 857 base::DictionaryValue* error_strings) {
854 DCHECK(app); 858 DCHECK(app);
855 859
856 bool rtl = LocaleIsRTL(); 860 bool rtl = LocaleIsRTL();
857 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr"); 861 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr");
858 862
859 base::string16 failed_url(base::ASCIIToUTF16(display_url.spec())); 863 base::string16 failed_url(base::ASCIIToUTF16(display_url.spec()));
(...skipping 19 matching lines...) Expand all
879 #if defined(OS_CHROMEOS) 883 #if defined(OS_CHROMEOS)
880 GURL learn_more_url(kAppWarningLearnMoreUrl); 884 GURL learn_more_url(kAppWarningLearnMoreUrl);
881 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); 885 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue();
882 suggest_learn_more->SetString("msg", 886 suggest_learn_more->SetString("msg",
883 l10n_util::GetStringUTF16( 887 l10n_util::GetStringUTF16(
884 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); 888 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY));
885 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); 889 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec());
886 error_strings->Set("suggestionsLearnMore", suggest_learn_more); 890 error_strings->Set("suggestionsLearnMore", suggest_learn_more);
887 #endif // defined(OS_CHROMEOS) 891 #endif // defined(OS_CHROMEOS)
888 } 892 }
893 #endif
OLDNEW
« no previous file with comments | « chrome/common/localized_error.h ('k') | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698