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

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: Rebase again now that CQ is fixed 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"
21 #include "net/base/escape.h" 22 #include "net/base/escape.h"
22 #include "net/base/net_errors.h" 23 #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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 if (error_domain == net::kErrorDomain && 548 if (error_domain == net::kErrorDomain &&
549 error_code == net::ERR_ACCESS_DENIED && 549 error_code == net::ERR_ACCESS_DENIED &&
550 failed_url.scheme() == "file") { 550 failed_url.scheme() == "file") {
551 options.title_resource_id = IDS_ERRORPAGES_TITLE_ACCESS_DENIED; 551 options.title_resource_id = IDS_ERRORPAGES_TITLE_ACCESS_DENIED;
552 options.heading_resource_id = IDS_ERRORPAGES_HEADING_FILE_ACCESS_DENIED; 552 options.heading_resource_id = IDS_ERRORPAGES_HEADING_FILE_ACCESS_DENIED;
553 options.summary_resource_id = IDS_ERRORPAGES_SUMMARY_FILE_ACCESS_DENIED; 553 options.summary_resource_id = IDS_ERRORPAGES_SUMMARY_FILE_ACCESS_DENIED;
554 options.details_resource_id = IDS_ERRORPAGES_DETAILS_FILE_ACCESS_DENIED; 554 options.details_resource_id = IDS_ERRORPAGES_DETAILS_FILE_ACCESS_DENIED;
555 options.suggestions = SUGGEST_NONE; 555 options.suggestions = SUGGEST_NONE;
556 } 556 }
557 557
558 base::string16 failed_url_string(net::FormatUrl( 558 base::string16 failed_url_string(url_formatter::FormatUrl(
559 failed_url, accept_languages, net::kFormatUrlOmitNothing, 559 failed_url, accept_languages, url_formatter::kFormatUrlOmitNothing,
560 net::UnescapeRule::NORMAL, NULL, NULL, NULL)); 560 net::UnescapeRule::NORMAL, nullptr, nullptr, nullptr));
561 // URLs are always LTR. 561 // URLs are always LTR.
562 if (base::i18n::IsRTL()) 562 if (base::i18n::IsRTL())
563 base::i18n::WrapStringWithLTRFormatting(&failed_url_string); 563 base::i18n::WrapStringWithLTRFormatting(&failed_url_string);
564 error_strings->SetString("title", 564 error_strings->SetString("title",
565 l10n_util::GetStringFUTF16(options.title_resource_id, failed_url_string)); 565 l10n_util::GetStringFUTF16(options.title_resource_id, failed_url_string));
566 error_strings->SetString("heading", 566 error_strings->SetString("heading",
567 l10n_util::GetStringUTF16(options.heading_resource_id)); 567 l10n_util::GetStringUTF16(options.heading_resource_id));
568 568
569 std::string icon_class = GetIconClassForError(error_domain, error_code); 569 std::string icon_class = GetIconClassForError(error_domain, error_code);
570 error_strings->SetString("iconClass", icon_class); 570 error_strings->SetString("iconClass", icon_class);
(...skipping 16 matching lines...) Expand all
587 l10n_util::GetStringUTF16(IDS_ERRORPAGE_FUN_DISABLED)); 587 l10n_util::GetStringUTF16(IDS_ERRORPAGE_FUN_DISABLED));
588 } 588 }
589 #endif 589 #endif
590 590
591 } else { 591 } else {
592 // Set summary message in the details. 592 // Set summary message in the details.
593 summary->SetString("msg", 593 summary->SetString("msg",
594 l10n_util::GetStringUTF16(options.summary_resource_id)); 594 l10n_util::GetStringUTF16(options.summary_resource_id));
595 } 595 }
596 summary->SetString("failedUrl", failed_url_string); 596 summary->SetString("failedUrl", failed_url_string);
597 summary->SetString("hostName", net::IDNToUnicode(failed_url.host(), 597 summary->SetString("hostName", url_formatter::IDNToUnicode(failed_url.host(),
598 accept_languages)); 598 accept_languages));
599 summary->SetString("productName", 599 summary->SetString("productName",
600 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 600 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
601 601
602 error_strings->SetString( 602 error_strings->SetString(
603 "details", l10n_util::GetStringUTF16(IDS_ERRORPAGE_NET_BUTTON_DETAILS)); 603 "details", l10n_util::GetStringUTF16(IDS_ERRORPAGE_NET_BUTTON_DETAILS));
604 error_strings->SetString( 604 error_strings->SetString(
605 "hideDetails", l10n_util::GetStringUTF16( 605 "hideDetails", l10n_util::GetStringUTF16(
606 IDS_ERRORPAGE_NET_BUTTON_HIDE_DETAILS)); 606 IDS_ERRORPAGE_NET_BUTTON_HIDE_DETAILS));
607 error_strings->Set("summary", summary); 607 error_strings->Set("summary", summary);
608 608
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 cache_button->SetString("cacheUrl", cache_url); 928 cache_button->SetString("cacheUrl", cache_url);
929 cache_button->SetInteger("trackingId", cache_tracking_id); 929 cache_button->SetInteger("trackingId", cache_tracking_id);
930 error_strings->Set("cacheButton", cache_button.release()); 930 error_strings->Set("cacheButton", cache_button.release());
931 931
932 // Remove the item from suggestions dictionary so that it does not get 932 // Remove the item from suggestions dictionary so that it does not get
933 // displayed by the template in the details section. 933 // displayed by the template in the details section.
934 suggestions->Remove(0, nullptr); 934 suggestions->Remove(0, nullptr);
935 } 935 }
936 } 936 }
937 } 937 }
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