OLD | NEW |
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 "ios/chrome/browser/ui/omnibox/page_info_model.h" | 5 #include "ios/chrome/browser/ui/omnibox/page_info_model.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 headline.assign(subject_name); | 112 headline.assign(subject_name); |
113 base::string16 issuer_name( | 113 base::string16 issuer_name( |
114 base::UTF8ToUTF16(ssl.certificate->issuer().GetDisplayName())); | 114 base::UTF8ToUTF16(ssl.certificate->issuer().GetDisplayName())); |
115 if (issuer_name.empty()) { | 115 if (issuer_name.empty()) { |
116 issuer_name.assign(l10n_util::GetStringUTF16( | 116 issuer_name.assign(l10n_util::GetStringUTF16( |
117 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); | 117 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
118 } | 118 } |
119 description.assign(l10n_util::GetStringFUTF16( | 119 description.assign(l10n_util::GetStringFUTF16( |
120 IDS_IOS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name)); | 120 IDS_IOS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name)); |
121 } | 121 } |
122 // The date after which no new SHA-1 certificates may be issued. | 122 if (ssl.cert_status & net::CERT_STATUS_SHA1_SIGNATURE_PRESENT) { |
123 // 2016-01-01 00:00:00 UTC | |
124 // WARNING: This value must be kept in sync with WebsiteSettings::Init() in | |
125 // chrome/browser/ui/website_settings/website_settings.cc. | |
126 static const int64_t kJanuary2016 = INT64_C(13096080000000000); | |
127 static const int64_t kJanuary2017 = INT64_C(13127702400000000); | |
128 if ((ssl.cert_status & net::CERT_STATUS_SHA1_SIGNATURE_PRESENT) && | |
129 ssl.certificate->valid_expiry() >= | |
130 base::Time::FromInternalValue(kJanuary2016)) { | |
131 icon_id = ICON_STATE_INFO; | 123 icon_id = ICON_STATE_INFO; |
132 if (ssl.certificate->valid_expiry() >= | 124 description += |
133 base::Time::FromInternalValue(kJanuary2017)) { | 125 base::UTF8ToUTF16("\n\n") + |
134 description += | 126 l10n_util::GetStringUTF16( |
135 base::UTF8ToUTF16("\n\n") + | 127 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM); |
136 l10n_util::GetStringUTF16( | |
137 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM_MAJOR)
; | |
138 } else { | |
139 description += | |
140 base::UTF8ToUTF16("\n\n") + | |
141 l10n_util::GetStringUTF16( | |
142 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM_MINOR)
; | |
143 } | |
144 } | 128 } |
145 } else { | 129 } else { |
146 // HTTP or HTTPS with errors (not warnings). | 130 // HTTP or HTTPS with errors (not warnings). |
147 description.assign(l10n_util::GetStringUTF16( | 131 description.assign(l10n_util::GetStringUTF16( |
148 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); | 132 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); |
149 icon_id = ssl.security_style == web::SECURITY_STYLE_UNAUTHENTICATED | 133 icon_id = ssl.security_style == web::SECURITY_STYLE_UNAUTHENTICATED |
150 ? ICON_NONE | 134 ? ICON_NONE |
151 : ICON_STATE_ERROR; | 135 : ICON_STATE_ERROR; |
152 | 136 |
153 const base::string16 bullet = base::UTF8ToUTF16("\n • "); | 137 const base::string16 bullet = base::UTF8ToUTF16("\n • "); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 case ICON_STATE_OFFLINE_PAGE: | 287 case ICON_STATE_OFFLINE_PAGE: |
304 return &rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_OFFLINE); | 288 return &rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_OFFLINE); |
305 } | 289 } |
306 } | 290 } |
307 | 291 |
308 base::string16 PageInfoModel::GetCertificateLabel() const { | 292 base::string16 PageInfoModel::GetCertificateLabel() const { |
309 return certificate_label_; | 293 return certificate_label_; |
310 } | 294 } |
311 | 295 |
312 PageInfoModel::PageInfoModel() : observer_(NULL) {} | 296 PageInfoModel::PageInfoModel() : observer_(NULL) {} |
OLD | NEW |