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 // Not HTTPS. | |
166 DCHECK_EQ(ssl.security_style(), SECURITY_STYLE_UNAUTHENTICATED); | |
Finnur
2010/11/09 11:40:04
Wait... we are not failing safe in this case, are
wtc
2010/11/10 20:40:56
In general I trust our code maintains invariants c
| |
167 icon_id = ICON_STATE_WARNING_MAJOR; | |
168 description.assign(l10n_util::GetStringFUTF16( | |
169 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, | |
170 subject_name)); | |
171 } else if (ssl.security_bits() < 0) { | |
165 // Security strength is unknown. Say nothing. | 172 // Security strength is unknown. Say nothing. |
166 icon_id = ICON_STATE_ERROR; | 173 icon_id = ICON_STATE_ERROR; |
167 } else if (ssl.security_bits() == 0) { | 174 } else if (ssl.security_bits() == 0) { |
168 icon_id = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? | 175 DCHECK_NE(ssl.security_style(), SECURITY_STYLE_UNAUTHENTICATED); |
169 ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR; | 176 icon_id = ICON_STATE_ERROR; |
170 description.assign(l10n_util::GetStringFUTF16( | 177 description.assign(l10n_util::GetStringFUTF16( |
171 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, | 178 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
172 subject_name)); | 179 subject_name)); |
173 } else if (ssl.security_bits() < 80) { | 180 } else if (ssl.security_bits() < 80) { |
174 icon_id = ICON_STATE_ERROR; | 181 icon_id = ICON_STATE_ERROR; |
175 description.assign(l10n_util::GetStringFUTF16( | 182 description.assign(l10n_util::GetStringFUTF16( |
176 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, | 183 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, |
177 subject_name)); | 184 subject_name)); |
178 } else { | 185 } else { |
179 description.assign(l10n_util::GetStringFUTF16( | 186 description.assign(l10n_util::GetStringFUTF16( |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 gfx::NativeImage PageInfoModel::GetBitmapNamed(int resource_id) { | 356 gfx::NativeImage PageInfoModel::GetBitmapNamed(int resource_id) { |
350 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 357 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
351 gfx::NativeImage image = rb.GetNativeImageNamed(resource_id); | 358 gfx::NativeImage image = rb.GetNativeImageNamed(resource_id); |
352 #if defined(OS_MACOSX) | 359 #if defined(OS_MACOSX) |
353 // Unlike other platforms, the Mac ResourceBundle does not keep a shared image | 360 // Unlike other platforms, the Mac ResourceBundle does not keep a shared image |
354 // cache. These are released in the dtor. | 361 // cache. These are released in the dtor. |
355 mac_util::NSObjectRetain(image); | 362 mac_util::NSObjectRetain(image); |
356 #endif | 363 #endif |
357 return image; | 364 return image; |
358 } | 365 } |
OLD | NEW |