OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/security_interstitials/core/common_string_util.h" | 5 #include "components/security_interstitials/core/common_string_util.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "components/url_formatter/url_formatter.h" | 10 #include "components/url_formatter/url_formatter.h" |
11 #include "grit/components_strings.h" | 11 #include "grit/components_strings.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 | 14 |
15 namespace security_interstitials { | 15 namespace security_interstitials { |
16 | 16 |
17 namespace common_string_util { | 17 namespace common_string_util { |
18 | 18 |
19 base::string16 GetFormattedHostName(const GURL& gurl, | 19 base::string16 GetFormattedHostName(const GURL& gurl) { |
20 const std::string& languages) { | 20 base::string16 host = url_formatter::IDNToUnicode(gurl.host()); |
21 base::string16 host = url_formatter::IDNToUnicode(gurl.host(), languages); | |
22 if (base::i18n::IsRTL()) | 21 if (base::i18n::IsRTL()) |
23 base::i18n::WrapStringWithLTRFormatting(&host); | 22 base::i18n::WrapStringWithLTRFormatting(&host); |
24 return host; | 23 return host; |
25 } | 24 } |
26 | 25 |
27 void PopulateSSLLayoutStrings(int cert_error, | 26 void PopulateSSLLayoutStrings(int cert_error, |
28 base::DictionaryValue* load_time_data) { | 27 base::DictionaryValue* load_time_data) { |
29 load_time_data->SetString("type", "SSL"); | 28 load_time_data->SetString("type", "SSL"); |
30 load_time_data->SetString("errorCode", net::ErrorToString(cert_error)); | 29 load_time_data->SetString("errorCode", net::ErrorToString(cert_error)); |
31 load_time_data->SetString( | 30 load_time_data->SetString( |
(...skipping 15 matching lines...) Expand all Loading... |
47 base::TimeFormatShortDate(time_triggered)); | 46 base::TimeFormatShortDate(time_triggered)); |
48 std::vector<std::string> encoded_chain; | 47 std::vector<std::string> encoded_chain; |
49 ssl_info.cert->GetPEMEncodedChain(&encoded_chain); | 48 ssl_info.cert->GetPEMEncodedChain(&encoded_chain); |
50 load_time_data->SetString( | 49 load_time_data->SetString( |
51 "pem", base::JoinString(encoded_chain, base::StringPiece())); | 50 "pem", base::JoinString(encoded_chain, base::StringPiece())); |
52 } | 51 } |
53 | 52 |
54 } // namespace common_string_util | 53 } // namespace common_string_util |
55 | 54 |
56 } // namespace security_interstitials | 55 } // namespace security_interstitials |
OLD | NEW |