| 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/feature_list.h" |
| 7 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 8 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
| 9 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 10 #include "components/url_formatter/url_formatter.h" | 11 #include "components/url_formatter/url_formatter.h" |
| 11 #include "grit/components_strings.h" | 12 #include "grit/components_strings.h" |
| 12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 14 | 15 |
| 16 namespace { |
| 17 const base::Feature kSecurityWarningIconUpdate{ |
| 18 "SecurityWarningIconUpdate", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 19 } // namespace |
| 20 |
| 15 namespace security_interstitials { | 21 namespace security_interstitials { |
| 16 | 22 |
| 17 namespace common_string_util { | 23 namespace common_string_util { |
| 18 | 24 |
| 19 base::string16 GetFormattedHostName(const GURL& gurl) { | 25 base::string16 GetFormattedHostName(const GURL& gurl) { |
| 20 base::string16 host = url_formatter::IDNToUnicode(gurl.host()); | 26 base::string16 host = url_formatter::IDNToUnicode(gurl.host()); |
| 21 if (base::i18n::IsRTL()) | 27 if (base::i18n::IsRTL()) |
| 22 base::i18n::WrapStringWithLTRFormatting(&host); | 28 base::i18n::WrapStringWithLTRFormatting(&host); |
| 23 return host; | 29 return host; |
| 24 } | 30 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 "expirationDate", | 49 "expirationDate", |
| 44 base::TimeFormatShortDate(ssl_info.cert->valid_expiry())); | 50 base::TimeFormatShortDate(ssl_info.cert->valid_expiry())); |
| 45 load_time_data->SetString("currentDate", | 51 load_time_data->SetString("currentDate", |
| 46 base::TimeFormatShortDate(time_triggered)); | 52 base::TimeFormatShortDate(time_triggered)); |
| 47 std::vector<std::string> encoded_chain; | 53 std::vector<std::string> encoded_chain; |
| 48 ssl_info.cert->GetPEMEncodedChain(&encoded_chain); | 54 ssl_info.cert->GetPEMEncodedChain(&encoded_chain); |
| 49 load_time_data->SetString( | 55 load_time_data->SetString( |
| 50 "pem", base::JoinString(encoded_chain, base::StringPiece())); | 56 "pem", base::JoinString(encoded_chain, base::StringPiece())); |
| 51 } | 57 } |
| 52 | 58 |
| 59 void PopulateNewIconStrings(base::DictionaryValue* load_time_data) { |
| 60 load_time_data->SetBoolean( |
| 61 "iconUpdate", base::FeatureList::IsEnabled(kSecurityWarningIconUpdate)); |
| 62 } |
| 63 |
| 53 } // namespace common_string_util | 64 } // namespace common_string_util |
| 54 | 65 |
| 55 } // namespace security_interstitials | 66 } // namespace security_interstitials |
| OLD | NEW |