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

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

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fixes following rebase Created 5 years, 6 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/grit/chromium_strings.h" 16 #include "chrome/grit/chromium_strings.h"
17 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
18 #include "components/error_page/common/error_page_params.h" 18 #include "components/error_page/common/error_page_params.h"
19 #include "components/error_page/common/net_error_info.h" 19 #include "components/error_page/common/net_error_info.h"
20 #include "components/url_formatter/url_formatter.h"
20 #include "net/base/escape.h" 21 #include "net/base/escape.h"
21 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
22 #include "net/base/net_util.h"
23 #include "third_party/WebKit/public/platform/WebURLError.h" 23 #include "third_party/WebKit/public/platform/WebURLError.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/webui/web_ui_util.h" 25 #include "ui/base/webui/web_ui_util.h"
26 26
27 #if defined(OS_WIN) 27 #if defined(OS_WIN)
28 #include "base/win/windows_version.h" 28 #include "base/win/windows_version.h"
29 #endif 29 #endif
30 30
31 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
32 #include "base/command_line.h" 32 #include "base/command_line.h"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 if (error_domain == net::kErrorDomain && 545 if (error_domain == net::kErrorDomain &&
546 error_code == net::ERR_ACCESS_DENIED && 546 error_code == net::ERR_ACCESS_DENIED &&
547 failed_url.scheme() == "file") { 547 failed_url.scheme() == "file") {
548 options.title_resource_id = IDS_ERRORPAGES_TITLE_ACCESS_DENIED; 548 options.title_resource_id = IDS_ERRORPAGES_TITLE_ACCESS_DENIED;
549 options.heading_resource_id = IDS_ERRORPAGES_HEADING_FILE_ACCESS_DENIED; 549 options.heading_resource_id = IDS_ERRORPAGES_HEADING_FILE_ACCESS_DENIED;
550 options.summary_resource_id = IDS_ERRORPAGES_SUMMARY_FILE_ACCESS_DENIED; 550 options.summary_resource_id = IDS_ERRORPAGES_SUMMARY_FILE_ACCESS_DENIED;
551 options.details_resource_id = IDS_ERRORPAGES_DETAILS_FILE_ACCESS_DENIED; 551 options.details_resource_id = IDS_ERRORPAGES_DETAILS_FILE_ACCESS_DENIED;
552 options.suggestions = SUGGEST_NONE; 552 options.suggestions = SUGGEST_NONE;
553 } 553 }
554 554
555 base::string16 failed_url_string(net::FormatUrl( 555 base::string16 failed_url_string(url_formatter::FormatUrl(
556 failed_url, accept_languages, net::kFormatUrlOmitNothing, 556 failed_url, accept_languages, url_formatter::kFormatUrlOmitNothing,
557 net::UnescapeRule::NORMAL, NULL, NULL, NULL)); 557 net::UnescapeRule::NORMAL, nullptr, nullptr, nullptr));
558 // URLs are always LTR. 558 // URLs are always LTR.
559 if (base::i18n::IsRTL()) 559 if (base::i18n::IsRTL())
560 base::i18n::WrapStringWithLTRFormatting(&failed_url_string); 560 base::i18n::WrapStringWithLTRFormatting(&failed_url_string);
561 error_strings->SetString("title", 561 error_strings->SetString("title",
562 l10n_util::GetStringFUTF16(options.title_resource_id, failed_url_string)); 562 l10n_util::GetStringFUTF16(options.title_resource_id, failed_url_string));
563 error_strings->SetString("heading", 563 error_strings->SetString("heading",
564 l10n_util::GetStringUTF16(options.heading_resource_id)); 564 l10n_util::GetStringUTF16(options.heading_resource_id));
565 565
566 std::string icon_class = GetIconClassForError(error_domain, error_code); 566 std::string icon_class = GetIconClassForError(error_domain, error_code);
567 error_strings->SetString("iconClass", icon_class); 567 error_strings->SetString("iconClass", icon_class);
(...skipping 16 matching lines...) Expand all
584 l10n_util::GetStringUTF16(IDS_ERRORPAGE_FUN_DISABLED)); 584 l10n_util::GetStringUTF16(IDS_ERRORPAGE_FUN_DISABLED));
585 } 585 }
586 #endif 586 #endif
587 587
588 } else { 588 } else {
589 // Set summary message in the details. 589 // Set summary message in the details.
590 summary->SetString("msg", 590 summary->SetString("msg",
591 l10n_util::GetStringUTF16(options.summary_resource_id)); 591 l10n_util::GetStringUTF16(options.summary_resource_id));
592 } 592 }
593 summary->SetString("failedUrl", failed_url_string); 593 summary->SetString("failedUrl", failed_url_string);
594 summary->SetString("hostName", net::IDNToUnicode(failed_url.host(), 594 summary->SetString("hostName", url_formatter::IDNToUnicode(failed_url.host(),
595 accept_languages)); 595 accept_languages));
596 summary->SetString("productName", 596 summary->SetString("productName",
597 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 597 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
598 598
599 error_strings->SetString( 599 error_strings->SetString(
600 "details", l10n_util::GetStringUTF16(IDS_ERRORPAGE_NET_BUTTON_DETAILS)); 600 "details", l10n_util::GetStringUTF16(IDS_ERRORPAGE_NET_BUTTON_DETAILS));
601 error_strings->SetString( 601 error_strings->SetString(
602 "hideDetails", l10n_util::GetStringUTF16( 602 "hideDetails", l10n_util::GetStringUTF16(
603 IDS_ERRORPAGE_NET_BUTTON_HIDE_DETAILS)); 603 IDS_ERRORPAGE_NET_BUTTON_HIDE_DETAILS));
604 error_strings->Set("summary", summary); 604 error_strings->Set("summary", summary);
605 605
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 GURL learn_more_url(kAppWarningLearnMoreUrl); 913 GURL learn_more_url(kAppWarningLearnMoreUrl);
914 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); 914 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue();
915 suggest_learn_more->SetString("msg", 915 suggest_learn_more->SetString("msg",
916 l10n_util::GetStringUTF16( 916 l10n_util::GetStringUTF16(
917 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); 917 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY));
918 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); 918 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec());
919 error_strings->Set("suggestionsLearnMore", suggest_learn_more); 919 error_strings->Set("suggestionsLearnMore", suggest_learn_more);
920 #endif // defined(OS_CHROMEOS) 920 #endif // defined(OS_CHROMEOS)
921 } 921 }
922 #endif 922 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698