diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 09:28:24 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 09:28:24 +0000 |
commit | 740ea16768c51c8d17d9242791e4dc411d978bfe (patch) | |
tree | 8bfe40f527f151698372d0b2e650fe3e4fbf769f /chrome/browser/page_info_model.cc | |
parent | f1869a3fbea7eb533b3e7cead99b80f9b32323f5 (diff) | |
download | chromium_src-740ea16768c51c8d17d9242791e4dc411d978bfe.zip chromium_src-740ea16768c51c8d17d9242791e4dc411d978bfe.tar.gz chromium_src-740ea16768c51c8d17d9242791e4dc411d978bfe.tar.bz2 |
Add mixed content warning to the Page Info bubble.
BUG=http://crbug.com/52916
TEST=Navigate to a page with mixed http and https content. The gray padlock should appear in the Omnibox icon and in the infobubble when you click it.
Review URL: http://codereview.chromium.org/3171031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57654 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/page_info_model.cc')
-rw-r--r-- | chrome/browser/page_info_model.cc | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc index ec818fe..3c031bc 100644 --- a/chrome/browser/page_info_model.cc +++ b/chrome/browser/page_info_model.cc @@ -28,8 +28,8 @@ PageInfoModel::PageInfoModel(Profile* profile, bool show_history, PageInfoModelObserver* observer) : observer_(observer) { - bool state = true; - string16 head_line; + SectionInfoState state = SECTION_STATE_OK; + string16 headline; string16 description; scoped_refptr<net::X509Certificate> cert; @@ -47,7 +47,7 @@ PageInfoModel::PageInfoModel(Profile* profile, // OK HTTPS page. if ((ssl.cert_status() & net::CERT_STATUS_IS_EV) != 0) { DCHECK(!cert->subject().organization_names.empty()); - head_line = + headline = l10n_util::GetStringFUTF16(IDS_PAGE_INFO_EV_IDENTITY_TITLE, UTF8ToUTF16(cert->subject().organization_names[0]), UTF8ToUTF16(url.host())); @@ -77,9 +77,9 @@ PageInfoModel::PageInfoModel(Profile* profile, } else { // Non EV OK HTTPS. if (empty_subject_name) - head_line.clear(); // Don't display any title. + headline.clear(); // Don't display any title. else - head_line.assign(subject_name); + headline.assign(subject_name); string16 issuer_name(UTF8ToUTF16(cert->issuer().GetDisplayName())); if (issuer_name.empty()) { issuer_name.assign(l10n_util::GetStringUTF16( @@ -93,12 +93,12 @@ PageInfoModel::PageInfoModel(Profile* profile, // HTTP or bad HTTPS. description.assign(l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); - state = false; + state = SECTION_STATE_ERROR; } sections_.push_back(SectionInfo( state, l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE), - head_line, + headline, description, SECTION_INFO_IDENTITY)); @@ -106,16 +106,16 @@ PageInfoModel::PageInfoModel(Profile* profile, // We consider anything less than 80 bits encryption to be weak encryption. // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and // weakly encrypted connections. - state = true; - head_line.clear(); + state = SECTION_STATE_OK; + headline.clear(); description.clear(); if (ssl.security_bits() <= 0) { - state = false; + state = SECTION_STATE_ERROR; description.assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, subject_name)); } else if (ssl.security_bits() < 80) { - state = false; + state = SECTION_STATE_ERROR; description.assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, subject_name)); @@ -125,7 +125,7 @@ PageInfoModel::PageInfoModel(Profile* profile, subject_name, base::IntToString16(ssl.security_bits()))); if (ssl.displayed_insecure_content() || ssl.ran_insecure_content()) { - state = false; + state = SECTION_STATE_ERROR; description.assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, description, @@ -135,6 +135,13 @@ PageInfoModel::PageInfoModel(Profile* profile, } } + if (state == SECTION_STATE_OK && ssl.displayed_insecure_content()) { + state = SECTION_STATE_WARNING; // Mixed content warrants a warning. + headline.clear(); + description.assign(l10n_util::GetStringUTF16( + IDS_PAGE_INFO_SECURITY_MIXED_CONTENT)); + } + uint16 cipher_suite = net::SSLConnectionStatusToCipherSuite(ssl.connection_status()); if (ssl.security_bits() > 0 && cipher_suite) { @@ -167,7 +174,7 @@ PageInfoModel::PageInfoModel(Profile* profile, if (did_fallback) { // For now, only SSLv3 fallback will trigger a warning icon. - state = false; + state = SECTION_STATE_ERROR; description += ASCIIToUTF16("\n\n"); description += l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_FALLBACK_MESSAGE); @@ -182,7 +189,7 @@ PageInfoModel::PageInfoModel(Profile* profile, sections_.push_back(SectionInfo( state, l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE), - head_line, + headline, description, SECTION_INFO_CONNECTION)); @@ -224,7 +231,7 @@ void PageInfoModel::OnGotVisitCountToHost(HistoryService::Handle handle, if (!visited_before_today) { sections_.push_back(SectionInfo( - false, + SECTION_STATE_ERROR, l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), string16(), @@ -233,7 +240,7 @@ void PageInfoModel::OnGotVisitCountToHost(HistoryService::Handle handle, SECTION_INFO_FIRST_VISIT)); } else { sections_.push_back(SectionInfo( - true, + SECTION_STATE_OK, l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), string16(), |