| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 base::UTF8ToUTF16("\n\n") + | 140 base::UTF8ToUTF16("\n\n") + |
| 141 l10n_util::GetStringUTF16( | 141 l10n_util::GetStringUTF16( |
| 142 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM_MINOR)
; | 142 IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM_MINOR)
; |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 } else { | 145 } else { |
| 146 // HTTP or HTTPS with errors (not warnings). | 146 // HTTP or HTTPS with errors (not warnings). |
| 147 description.assign(l10n_util::GetStringUTF16( | 147 description.assign(l10n_util::GetStringUTF16( |
| 148 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); | 148 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); |
| 149 icon_id = ssl.security_style == web::SECURITY_STYLE_UNAUTHENTICATED | 149 icon_id = ssl.security_style == web::SECURITY_STYLE_UNAUTHENTICATED |
| 150 ? ICON_NONE | 150 ? ICON_STATE_INFO |
| 151 : ICON_STATE_ERROR; | 151 : ICON_STATE_ERROR; |
| 152 | 152 |
| 153 const base::string16 bullet = base::UTF8ToUTF16("\n • "); | 153 const base::string16 bullet = base::UTF8ToUTF16("\n • "); |
| 154 std::vector<ssl_errors::ErrorInfo> errors; | 154 std::vector<ssl_errors::ErrorInfo> errors; |
| 155 ssl_errors::ErrorInfo::GetErrorsForCertStatus( | 155 ssl_errors::ErrorInfo::GetErrorsForCertStatus( |
| 156 ssl.certificate, ssl.cert_status, url, &errors); | 156 ssl.certificate, ssl.cert_status, url, &errors); |
| 157 for (size_t i = 0; i < errors.size(); ++i) { | 157 for (size_t i = 0; i < errors.size(); ++i) { |
| 158 description += bullet; | 158 description += bullet; |
| 159 description += errors[i].short_description(); | 159 description += errors[i].short_description(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 if (ssl.cert_status & net::CERT_STATUS_NON_UNIQUE_NAME) { | 162 if (ssl.cert_status & net::CERT_STATUS_NON_UNIQUE_NAME) { |
| 163 description += base::ASCIIToUTF16("\n\n"); | 163 description += base::ASCIIToUTF16("\n\n"); |
| 164 description += | 164 description += |
| 165 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME); | 165 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 sections_.push_back(SectionInfo(icon_id, headline, description, | 168 sections_.push_back(SectionInfo(icon_id, headline, description, |
| 169 SECTION_INFO_IDENTITY, | 169 SECTION_INFO_IDENTITY, |
| 170 BUTTON_SHOW_SECURITY_HELP)); | 170 BUTTON_SHOW_SECURITY_HELP)); |
| 171 | 171 |
| 172 // Connection section. | 172 // Connection section. |
| 173 icon_id = ICON_STATE_OK; | 173 icon_id = ICON_STATE_OK; |
| 174 headline.clear(); | 174 headline.clear(); |
| 175 description.clear(); | 175 description.clear(); |
| 176 if (!ssl.certificate) { | 176 if (!ssl.certificate) { |
| 177 // Not HTTPS. | 177 // Not HTTPS. |
| 178 icon_id = ssl.security_style == web::SECURITY_STYLE_UNAUTHENTICATED | 178 icon_id = ICON_STATE_INFO; |
| 179 ? ICON_NONE | |
| 180 : ICON_STATE_ERROR; | |
| 181 description.assign(l10n_util::GetStringFUTF16( | 179 description.assign(l10n_util::GetStringFUTF16( |
| 182 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, | 180 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
| 183 subject_name)); | 181 subject_name)); |
| 184 } else if (ssl.security_bits < 0) { | 182 } else if (ssl.security_bits < 0) { |
| 185 if (ssl.content_status == web::SSLStatus::DISPLAYED_INSECURE_CONTENT) { | 183 if (ssl.content_status == web::SSLStatus::DISPLAYED_INSECURE_CONTENT) { |
| 186 DCHECK(description.empty()); | 184 DCHECK(description.empty()); |
| 187 // For WKWebView security_bits flag is always -1, and description is empty | 185 // For WKWebView security_bits flag is always -1, and description is empty |
| 188 // because ciphersuite is unknown. On iOS9 WKWebView blocks active | 186 // because ciphersuite is unknown. On iOS9 WKWebView blocks active |
| 189 // mixed content, so warning should be about page look, not about page | 187 // mixed content, so warning should be about page look, not about page |
| 190 // behavior. | 188 // behavior. |
| 191 icon_id = ICON_NONE; | 189 icon_id = ICON_STATE_INFO; |
| 192 description.assign(l10n_util::GetStringUTF16( | 190 description.assign(l10n_util::GetStringUTF16( |
| 193 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING)); | 191 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING)); |
| 194 } else { | 192 } else { |
| 195 // Security strength is unknown. Say nothing. | 193 // Security strength is unknown. Say nothing. |
| 196 icon_id = ICON_STATE_ERROR; | 194 icon_id = ICON_STATE_ERROR; |
| 197 } | 195 } |
| 198 } else if (ssl.security_bits == 0) { | 196 } else if (ssl.security_bits == 0) { |
| 199 DCHECK_NE(ssl.security_style, web::SECURITY_STYLE_UNAUTHENTICATED); | 197 DCHECK_NE(ssl.security_style, web::SECURITY_STYLE_UNAUTHENTICATED); |
| 200 icon_id = ICON_STATE_ERROR; | 198 icon_id = ICON_STATE_ERROR; |
| 201 description.assign(l10n_util::GetStringFUTF16( | 199 description.assign(l10n_util::GetStringFUTF16( |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 case ICON_STATE_OFFLINE_PAGE: | 301 case ICON_STATE_OFFLINE_PAGE: |
| 304 return &rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_OFFLINE); | 302 return &rb.GetNativeImageNamed(IDR_IOS_OMNIBOX_OFFLINE); |
| 305 } | 303 } |
| 306 } | 304 } |
| 307 | 305 |
| 308 base::string16 PageInfoModel::GetCertificateLabel() const { | 306 base::string16 PageInfoModel::GetCertificateLabel() const { |
| 309 return certificate_label_; | 307 return certificate_label_; |
| 310 } | 308 } |
| 311 | 309 |
| 312 PageInfoModel::PageInfoModel() : observer_(NULL) {} | 310 PageInfoModel::PageInfoModel() : observer_(NULL) {} |
| OLD | NEW |