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

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

Issue 1260033005: Revert of Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/DEPS ('k') | chrome/common/net/url_util.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/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/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/grit/chromium_strings.h" 17 #include "chrome/grit/chromium_strings.h"
18 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
19 #include "components/error_page/common/error_page_params.h" 19 #include "components/error_page/common/error_page_params.h"
20 #include "components/error_page/common/net_error_info.h" 20 #include "components/error_page/common/net_error_info.h"
21 #include "components/url_formatter/url_formatter.h"
22 #include "net/base/escape.h" 21 #include "net/base/escape.h"
23 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
23 #include "net/base/net_util.h"
24 #include "third_party/WebKit/public/platform/WebURLError.h" 24 #include "third_party/WebKit/public/platform/WebURLError.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/webui/web_ui_util.h" 26 #include "ui/base/webui/web_ui_util.h"
27 27
28 #if defined(OS_WIN) 28 #if defined(OS_WIN)
29 #include "base/win/windows_version.h" 29 #include "base/win/windows_version.h"
30 #endif 30 #endif
31 31
32 #if defined(OS_CHROMEOS) 32 #if defined(OS_CHROMEOS)
33 #include "base/command_line.h" 33 #include "base/command_line.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 if (error_domain == net::kErrorDomain && 547 if (error_domain == net::kErrorDomain &&
548 error_code == net::ERR_ACCESS_DENIED && 548 error_code == net::ERR_ACCESS_DENIED &&
549 failed_url.scheme() == "file") { 549 failed_url.scheme() == "file") {
550 options.title_resource_id = IDS_ERRORPAGES_TITLE_ACCESS_DENIED; 550 options.title_resource_id = IDS_ERRORPAGES_TITLE_ACCESS_DENIED;
551 options.heading_resource_id = IDS_ERRORPAGES_HEADING_FILE_ACCESS_DENIED; 551 options.heading_resource_id = IDS_ERRORPAGES_HEADING_FILE_ACCESS_DENIED;
552 options.summary_resource_id = IDS_ERRORPAGES_SUMMARY_FILE_ACCESS_DENIED; 552 options.summary_resource_id = IDS_ERRORPAGES_SUMMARY_FILE_ACCESS_DENIED;
553 options.details_resource_id = IDS_ERRORPAGES_DETAILS_FILE_ACCESS_DENIED; 553 options.details_resource_id = IDS_ERRORPAGES_DETAILS_FILE_ACCESS_DENIED;
554 options.suggestions = SUGGEST_NONE; 554 options.suggestions = SUGGEST_NONE;
555 } 555 }
556 556
557 base::string16 failed_url_string(url_formatter::FormatUrl( 557 base::string16 failed_url_string(net::FormatUrl(
558 failed_url, accept_languages, url_formatter::kFormatUrlOmitNothing, 558 failed_url, accept_languages, net::kFormatUrlOmitNothing,
559 net::UnescapeRule::NORMAL, nullptr, nullptr, nullptr)); 559 net::UnescapeRule::NORMAL, NULL, NULL, NULL));
560 // URLs are always LTR. 560 // URLs are always LTR.
561 if (base::i18n::IsRTL()) 561 if (base::i18n::IsRTL())
562 base::i18n::WrapStringWithLTRFormatting(&failed_url_string); 562 base::i18n::WrapStringWithLTRFormatting(&failed_url_string);
563 error_strings->SetString("title", 563 error_strings->SetString("title",
564 l10n_util::GetStringFUTF16(options.title_resource_id, failed_url_string)); 564 l10n_util::GetStringFUTF16(options.title_resource_id, failed_url_string));
565 error_strings->SetString("heading", 565 error_strings->SetString("heading",
566 l10n_util::GetStringUTF16(options.heading_resource_id)); 566 l10n_util::GetStringUTF16(options.heading_resource_id));
567 567
568 std::string icon_class = GetIconClassForError(error_domain, error_code); 568 std::string icon_class = GetIconClassForError(error_domain, error_code);
569 error_strings->SetString("iconClass", icon_class); 569 error_strings->SetString("iconClass", icon_class);
(...skipping 16 matching lines...) Expand all
586 l10n_util::GetStringUTF16(IDS_ERRORPAGE_FUN_DISABLED)); 586 l10n_util::GetStringUTF16(IDS_ERRORPAGE_FUN_DISABLED));
587 } 587 }
588 #endif 588 #endif
589 589
590 } else { 590 } else {
591 // Set summary message in the details. 591 // Set summary message in the details.
592 summary->SetString("msg", 592 summary->SetString("msg",
593 l10n_util::GetStringUTF16(options.summary_resource_id)); 593 l10n_util::GetStringUTF16(options.summary_resource_id));
594 } 594 }
595 summary->SetString("failedUrl", failed_url_string); 595 summary->SetString("failedUrl", failed_url_string);
596 summary->SetString("hostName", url_formatter::IDNToUnicode(failed_url.host(), 596 summary->SetString("hostName", net::IDNToUnicode(failed_url.host(),
597 accept_languages)); 597 accept_languages));
598 summary->SetString("productName", 598 summary->SetString("productName",
599 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 599 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
600 600
601 error_strings->SetString( 601 error_strings->SetString(
602 "details", l10n_util::GetStringUTF16(IDS_ERRORPAGE_NET_BUTTON_DETAILS)); 602 "details", l10n_util::GetStringUTF16(IDS_ERRORPAGE_NET_BUTTON_DETAILS));
603 error_strings->SetString( 603 error_strings->SetString(
604 "hideDetails", l10n_util::GetStringUTF16( 604 "hideDetails", l10n_util::GetStringUTF16(
605 IDS_ERRORPAGE_NET_BUTTON_HIDE_DETAILS)); 605 IDS_ERRORPAGE_NET_BUTTON_HIDE_DETAILS));
606 error_strings->Set("summary", summary); 606 error_strings->Set("summary", summary);
607 607
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 cache_button->SetString("cacheUrl", cache_url); 921 cache_button->SetString("cacheUrl", cache_url);
922 cache_button->SetInteger("trackingId", cache_tracking_id); 922 cache_button->SetInteger("trackingId", cache_tracking_id);
923 error_strings->Set("cacheButton", cache_button.release()); 923 error_strings->Set("cacheButton", cache_button.release());
924 924
925 // Remove the item from suggestions dictionary so that it does not get 925 // Remove the item from suggestions dictionary so that it does not get
926 // displayed by the template in the details section. 926 // displayed by the template in the details section.
927 suggestions->Remove(0, nullptr); 927 suggestions->Remove(0, nullptr);
928 } 928 }
929 } 929 }
930 } 930 }
OLDNEW
« no previous file with comments | « chrome/common/DEPS ('k') | chrome/common/net/url_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698