From 7c917ec090aabc41d35e6a3de51e1eaf07f2e5eb Mon Sep 17 00:00:00 2001 From: "wtc@chromium.org" Date: Thu, 11 Nov 2010 22:12:08 +0000 Subject: We should use SSLInfo or related types for HTTPS URLs only. R=eroman,finnur BUG=53366 TEST=net_unittests --gtest_filter=HTTPSRequestTest.HTTPS*Test Review URL: http://codereview.chromium.org/4210004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65864 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/page_info_model.cc | 14 +++++++++++--- chrome/browser/renderer_host/resource_dispatcher_host.cc | 3 +-- chrome/browser/ssl/ssl_manager.cc | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'chrome') diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc index 9e821d4..16a8255 100644 --- a/chrome/browser/page_info_model.cc +++ b/chrome/browser/page_info_model.cc @@ -161,12 +161,20 @@ PageInfoModel::PageInfoModel(Profile* profile, icon_id = ICON_STATE_OK; headline.clear(); description.clear(); - if (ssl.security_bits() < 0) { + if (!ssl.cert_id()) { + // Not HTTPS. + DCHECK_EQ(ssl.security_style(), SECURITY_STYLE_UNAUTHENTICATED); + icon_id = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? + ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR; + description.assign(l10n_util::GetStringFUTF16( + IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, + subject_name)); + } else if (ssl.security_bits() < 0) { // Security strength is unknown. Say nothing. icon_id = ICON_STATE_ERROR; } else if (ssl.security_bits() == 0) { - icon_id = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? - ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR; + DCHECK_NE(ssl.security_style(), SECURITY_STYLE_UNAUTHENTICATED); + icon_id = ICON_STATE_ERROR; description.assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, subject_name)); diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index 6fd669e..c88e558 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -1141,8 +1141,7 @@ bool ResourceDispatcherHost::CompleteResponseStarted(URLRequest* request) { } else { // We should not have any SSL state. DCHECK(!request->ssl_info().cert_status && - (request->ssl_info().security_bits == -1 || - request->ssl_info().security_bits == 0) && + request->ssl_info().security_bits == -1 && !request->ssl_info().connection_status); } diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc index 208a9d2..abb5a1a 100644 --- a/chrome/browser/ssl/ssl_manager.cc +++ b/chrome/browser/ssl/ssl_manager.cc @@ -79,8 +79,9 @@ bool SSLManager::DeserializeSecurityInfo(const std::string& state, if (state.empty()) { // No SSL used. *cert_id = 0; + // The following are not applicable and are set to the default values. *cert_status = 0; - *security_bits = 0; // Not encrypted. + *security_bits = -1; *ssl_connection_status = 0; return false; } -- cgit v1.1