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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 description += | 124 description += |
125 base::UTF8ToUTF16("\n\n") + | 125 base::UTF8ToUTF16("\n\n") + |
126 l10n_util::GetStringUTF16( | 126 l10n_util::GetStringUTF16( |
127 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM); | 127 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM); |
128 } | 128 } |
129 } else { | 129 } else { |
130 // HTTP or HTTPS with errors (not warnings). | 130 // HTTP or HTTPS with errors (not warnings). |
131 description.assign(l10n_util::GetStringUTF16( | 131 description.assign(l10n_util::GetStringUTF16( |
132 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); | 132 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); |
133 icon_id = ssl.security_style == web::SECURITY_STYLE_UNAUTHENTICATED | 133 icon_id = ssl.security_style == web::SECURITY_STYLE_UNAUTHENTICATED |
134 ? ICON_NONE | 134 ? ICON_STATE_INFO |
135 : ICON_STATE_ERROR; | 135 : ICON_STATE_ERROR; |
136 | 136 |
137 const base::string16 bullet = base::UTF8ToUTF16("\n • "); | 137 const base::string16 bullet = base::UTF8ToUTF16("\n • "); |
138 std::vector<ssl_errors::ErrorInfo> errors; | 138 std::vector<ssl_errors::ErrorInfo> errors; |
139 ssl_errors::ErrorInfo::GetErrorsForCertStatus( | 139 ssl_errors::ErrorInfo::GetErrorsForCertStatus( |
140 ssl.certificate, ssl.cert_status, url, &errors); | 140 ssl.certificate, ssl.cert_status, url, &errors); |
141 for (size_t i = 0; i < errors.size(); ++i) { | 141 for (size_t i = 0; i < errors.size(); ++i) { |
142 description += bullet; | 142 description += bullet; |
143 description += errors[i].short_description(); | 143 description += errors[i].short_description(); |
144 } | 144 } |
145 | 145 |
146 if (ssl.cert_status & net::CERT_STATUS_NON_UNIQUE_NAME) { | 146 if (ssl.cert_status & net::CERT_STATUS_NON_UNIQUE_NAME) { |
147 description += base::ASCIIToUTF16("\n\n"); | 147 description += base::ASCIIToUTF16("\n\n"); |
148 description += | 148 description += |
149 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME); | 149 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME); |
150 } | 150 } |
151 } | 151 } |
152 sections_.push_back(SectionInfo(icon_id, headline, description, | 152 sections_.push_back(SectionInfo(icon_id, headline, description, |
153 SECTION_INFO_IDENTITY, | 153 SECTION_INFO_IDENTITY, |
154 BUTTON_SHOW_SECURITY_HELP)); | 154 BUTTON_SHOW_SECURITY_HELP)); |
155 | 155 |
156 // Connection section. | 156 // Connection section. |
157 icon_id = ICON_STATE_OK; | 157 icon_id = ICON_STATE_OK; |
158 headline.clear(); | 158 headline.clear(); |
159 description.clear(); | 159 description.clear(); |
160 if (!ssl.certificate) { | 160 if (!ssl.certificate) { |
161 // Not HTTPS. | 161 // Not HTTPS. |
162 icon_id = ssl.security_style == web::SECURITY_STYLE_UNAUTHENTICATED | 162 icon_id = ssl.security_style == web::SECURITY_STYLE_UNAUTHENTICATED |
163 ? ICON_NONE | 163 ? ICON_STATE_INFO |
164 : ICON_STATE_ERROR; | 164 : ICON_STATE_ERROR; |
165 description.assign(l10n_util::GetStringFUTF16( | 165 description.assign( |
166 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, | 166 l10n_util::GetStringUTF16(IDS_PAGEINFO_NOT_SECURE_SUMMARY)); |
167 subject_name)); | 167 description += base::ASCIIToUTF16("\n\n"); |
| 168 description += l10n_util::GetStringUTF16(IDS_PAGEINFO_NOT_SECURE_DETAILS); |
168 } else if (ssl.security_bits < 0) { | 169 } else if (ssl.security_bits < 0) { |
169 if (ssl.content_status == web::SSLStatus::DISPLAYED_INSECURE_CONTENT) { | 170 if (ssl.content_status == web::SSLStatus::DISPLAYED_INSECURE_CONTENT) { |
170 DCHECK(description.empty()); | 171 DCHECK(description.empty()); |
171 // For WKWebView security_bits flag is always -1, and description is empty | 172 // For WKWebView security_bits flag is always -1, and description is empty |
172 // because ciphersuite is unknown. On iOS9 WKWebView blocks active | 173 // because ciphersuite is unknown. On iOS9 WKWebView blocks active |
173 // mixed content, so warning should be about page look, not about page | 174 // mixed content, so warning should be about page look, not about page |
174 // behavior. | 175 // behavior. |
175 icon_id = ICON_NONE; | 176 icon_id = ICON_NONE; |
176 description.assign(l10n_util::GetStringUTF16( | 177 description.assign(l10n_util::GetStringUTF16( |
177 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING)); | 178 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING)); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 case ICON_STATE_OFFLINE_PAGE: | 288 case ICON_STATE_OFFLINE_PAGE: |
288 return &rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_OFFLINE); | 289 return &rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_OFFLINE); |
289 } | 290 } |
290 } | 291 } |
291 | 292 |
292 base::string16 PageInfoModel::GetCertificateLabel() const { | 293 base::string16 PageInfoModel::GetCertificateLabel() const { |
293 return certificate_label_; | 294 return certificate_label_; |
294 } | 295 } |
295 | 296 |
296 PageInfoModel::PageInfoModel() : observer_(NULL) {} | 297 PageInfoModel::PageInfoModel() : observer_(NULL) {} |
OLD | NEW |