OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/page_info_model.h" | 5 #include "chrome/browser/page_info_model.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 description, | 154 description, |
155 SECTION_INFO_IDENTITY)); | 155 SECTION_INFO_IDENTITY)); |
156 | 156 |
157 // Connection section. | 157 // Connection section. |
158 // We consider anything less than 80 bits encryption to be weak encryption. | 158 // We consider anything less than 80 bits encryption to be weak encryption. |
159 // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and | 159 // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and |
160 // weakly encrypted connections. | 160 // weakly encrypted connections. |
161 icon_id = ICON_STATE_OK; | 161 icon_id = ICON_STATE_OK; |
162 headline.clear(); | 162 headline.clear(); |
163 description.clear(); | 163 description.clear(); |
164 if (ssl.security_bits() < 0) { | 164 if (!ssl.cert_id()) { |
165 // Security strength is unknown. Say nothing. | 165 // Not HTTPS. |
166 icon_id = ICON_STATE_ERROR; | 166 DCHECK_EQ(ssl.security_style(), SECURITY_STYLE_UNAUTHENTICATED); |
167 } else if (ssl.security_bits() == 0) { | |
168 icon_id = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? | 167 icon_id = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? |
169 ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR; | 168 ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR; |
170 description.assign(l10n_util::GetStringFUTF16( | 169 description.assign(l10n_util::GetStringFUTF16( |
171 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, | 170 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
172 subject_name)); | 171 subject_name)); |
| 172 } else if (ssl.security_bits() < 0) { |
| 173 // Security strength is unknown. Say nothing. |
| 174 icon_id = ICON_STATE_ERROR; |
| 175 } else if (ssl.security_bits() == 0) { |
| 176 DCHECK_NE(ssl.security_style(), SECURITY_STYLE_UNAUTHENTICATED); |
| 177 icon_id = ICON_STATE_ERROR; |
| 178 description.assign(l10n_util::GetStringFUTF16( |
| 179 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
| 180 subject_name)); |
173 } else if (ssl.security_bits() < 80) { | 181 } else if (ssl.security_bits() < 80) { |
174 icon_id = ICON_STATE_ERROR; | 182 icon_id = ICON_STATE_ERROR; |
175 description.assign(l10n_util::GetStringFUTF16( | 183 description.assign(l10n_util::GetStringFUTF16( |
176 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, | 184 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, |
177 subject_name)); | 185 subject_name)); |
178 } else { | 186 } else { |
179 description.assign(l10n_util::GetStringFUTF16( | 187 description.assign(l10n_util::GetStringFUTF16( |
180 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT, | 188 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT, |
181 subject_name, | 189 subject_name, |
182 base::IntToString16(ssl.security_bits()))); | 190 base::IntToString16(ssl.security_bits()))); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 gfx::NativeImage PageInfoModel::GetBitmapNamed(int resource_id) { | 352 gfx::NativeImage PageInfoModel::GetBitmapNamed(int resource_id) { |
345 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 353 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
346 gfx::NativeImage image = rb.GetNativeImageNamed(resource_id); | 354 gfx::NativeImage image = rb.GetNativeImageNamed(resource_id); |
347 #if defined(OS_MACOSX) | 355 #if defined(OS_MACOSX) |
348 // Unlike other platforms, the Mac ResourceBundle does not keep a shared image | 356 // Unlike other platforms, the Mac ResourceBundle does not keep a shared image |
349 // cache. These are released in the dtor. | 357 // cache. These are released in the dtor. |
350 mac_util::NSObjectRetain(image); | 358 mac_util::NSObjectRetain(image); |
351 #endif | 359 #endif |
352 return image; | 360 return image; |
353 } | 361 } |
OLD | NEW |