| Index: chrome/browser/page_info_model.cc
|
| ===================================================================
|
| --- chrome/browser/page_info_model.cc (revision 57521)
|
| +++ chrome/browser/page_info_model.cc (working copy)
|
| @@ -28,8 +28,8 @@
|
| 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 @@
|
| // 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 @@
|
| } 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 @@
|
| // 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 @@
|
| // 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 @@
|
| 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 @@
|
| }
|
| }
|
|
|
| + 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 @@
|
|
|
| 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 @@
|
| 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 @@
|
|
|
| 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 @@
|
| 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(),
|
|
|