From c45ea217857a088a1f0acd2892bfea82319bd388 Mon Sep 17 00:00:00 2001 From: "finnur@chromium.org" Date: Fri, 10 Sep 2010 13:22:05 +0000 Subject: Page info model now shows red skull and crossbones on SECURITY_STYLE_AUTHENTICATION_BROKEN, like the Omnibox does. Started using... a) the Info icon (blue i) for the first visit section and b) the yellow exclamation point for http connections (instead of the skull and crossbones). BUG=http://crbug.com/52916 TEST=None Review URL: http://codereview.chromium.org/3367007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59088 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/page_info_model.cc | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'chrome/browser/page_info_model.cc') diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc index 1f2ffbd..f35da10 100644 --- a/chrome/browser/page_info_model.cc +++ b/chrome/browser/page_info_model.cc @@ -94,7 +94,8 @@ PageInfoModel::PageInfoModel(Profile* profile, // HTTP or bad HTTPS. description.assign(l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); - state = SECTION_STATE_ERROR; + state = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? + SECTION_STATE_WARNING_MAJOR : SECTION_STATE_ERROR; } sections_.push_back(SectionInfo( state, @@ -114,7 +115,8 @@ PageInfoModel::PageInfoModel(Profile* profile, // Security strength is unknown. Say nothing. state = SECTION_STATE_ERROR; } else if (ssl.security_bits() == 0) { - state = SECTION_STATE_ERROR; + state = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? + SECTION_STATE_WARNING_MAJOR : SECTION_STATE_ERROR; description.assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, subject_name)); @@ -129,11 +131,18 @@ PageInfoModel::PageInfoModel(Profile* profile, subject_name, base::IntToString16(ssl.security_bits()))); if (ssl.displayed_insecure_content() || ssl.ran_insecure_content()) { + // The old SSL dialog only had good and bad state, so for the old + // implementation we raise an error on finding mixed content. The new + // SSL info bubble has a warning state for displaying insecure content, + // so we check. The command line check will go away once we eliminate + // the old dialogs. const CommandLine* command_line(CommandLine::ForCurrentProcess()); - if (command_line->HasSwitch(switches::kEnableNewPageInfoBubble)) - state = SECTION_STATE_WARNING; - else + if (command_line->HasSwitch(switches::kEnableNewPageInfoBubble) && + !ssl.ran_insecure_content()) { + state = SECTION_STATE_WARNING_MINOR; + } else { state = SECTION_STATE_ERROR; + } description.assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, description, @@ -235,12 +244,18 @@ void PageInfoModel::OnGotVisitCountToHost(HistoryService::Handle handle, visited_before_today = (first_visit_midnight < today); } + // We only show the Site Information heading for the new dialogs. + string16 title; + const CommandLine* command_line(CommandLine::ForCurrentProcess()); + if (command_line->HasSwitch(switches::kEnableNewPageInfoBubble)) + title = l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE); + if (!visited_before_today) { sections_.push_back(SectionInfo( SECTION_STATE_ERROR, l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), - string16(), + title, l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY), SECTION_INFO_FIRST_VISIT)); @@ -249,7 +264,7 @@ void PageInfoModel::OnGotVisitCountToHost(HistoryService::Handle handle, SECTION_STATE_OK, l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), - string16(), + title, l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, WideToUTF16(base::TimeFormatShortDate(first_visit))), -- cgit v1.1