summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/browser/cocoa/page_info_window_mac_unittest.mm16
-rw-r--r--chrome/browser/page_info_model.cc39
-rw-r--r--chrome/browser/page_info_model.h14
-rw-r--r--chrome/browser/views/page_info_bubble_view.cc18
-rw-r--r--chrome/browser/views/page_info_window_view.cc7
6 files changed, 66 insertions, 31 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 26ea56c..6b37b00 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5419,6 +5419,9 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_PAGE_INFO_SECURITY_TAB_RENEGOTIATION_MESSAGE" desc="This message is displayed when the server hasn't been updated to fix a recent security issues. TLS here is an acronym and need not be translated. 'renegotiation' is a technical term describing a process of agreeing on a new set of security parameters and secrets. 'extension' here should be taken to mean 'amendment' rather than elongation.">
The server does not support the TLS renegotiation extension.
</message>
+ <message name="IDS_PAGE_INFO_SECURITY_MIXED_CONTENT" desc="This message is displayed when there is mixed HTTP and HTTPS content on the page.">
+ Some of the elements on this page came from an unverified source and were not displayed.
+ </message>
<!-- SSL Blocking Page -->
<message name="IDS_SSL_BLOCKING_PAGE_TITLE" desc="The title of the SSL blocking page.">
diff --git a/chrome/browser/cocoa/page_info_window_mac_unittest.mm b/chrome/browser/cocoa/page_info_window_mac_unittest.mm
index 9454206..632aac1a 100644
--- a/chrome/browser/cocoa/page_info_window_mac_unittest.mm
+++ b/chrome/browser/cocoa/page_info_window_mac_unittest.mm
@@ -19,7 +19,7 @@ namespace {
class FakeModel : public PageInfoModel {
public:
- void AddSection(bool state,
+ void AddSection(SectionInfoState state,
const string16& title,
const string16& description,
SectionInfoType type) {
@@ -111,13 +111,13 @@ class PageInfoWindowMacTest : public CocoaTest {
TEST_F(PageInfoWindowMacTest, NoHistoryNoSecurity) {
- model_->AddSection(false,
+ model_->AddSection(PageInfoModel::SECTION_STATE_ERROR,
l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE),
l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY,
ASCIIToUTF16("google.com")),
PageInfoModel::SECTION_INFO_IDENTITY);
- model_->AddSection(false,
+ model_->AddSection(PageInfoModel::SECTION_STATE_ERROR,
l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE),
l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
@@ -131,13 +131,13 @@ TEST_F(PageInfoWindowMacTest, NoHistoryNoSecurity) {
TEST_F(PageInfoWindowMacTest, HistoryNoSecurity) {
- model_->AddSection(false,
+ model_->AddSection(PageInfoModel::SECTION_STATE_ERROR,
l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE),
l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY,
ASCIIToUTF16("google.com")),
PageInfoModel::SECTION_INFO_IDENTITY);
- model_->AddSection(false,
+ model_->AddSection(PageInfoModel::SECTION_STATE_ERROR,
l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE),
l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
@@ -148,7 +148,7 @@ TEST_F(PageInfoWindowMacTest, HistoryNoSecurity) {
// asynchronously, so replicate the double-build here.
bridge_->ModelChanged();
- model_->AddSection(false,
+ model_->AddSection(PageInfoModel::SECTION_STATE_ERROR,
l10n_util::GetStringUTF16(
IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE),
l10n_util::GetStringUTF16(
@@ -162,7 +162,7 @@ TEST_F(PageInfoWindowMacTest, HistoryNoSecurity) {
TEST_F(PageInfoWindowMacTest, NoHistoryMixedSecurity) {
- model_->AddSection(true,
+ model_->AddSection(PageInfoModel::SECTION_STATE_OK,
l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE),
l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY,
@@ -173,7 +173,7 @@ TEST_F(PageInfoWindowMacTest, NoHistoryMixedSecurity) {
// region (kImageSize).
string16 title =
l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE);
- model_->AddSection(true,
+ model_->AddSection(PageInfoModel::SECTION_STATE_OK,
title,
l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK,
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(),
diff --git a/chrome/browser/page_info_model.h b/chrome/browser/page_info_model.h
index 60e3883..08a9b56 100644
--- a/chrome/browser/page_info_model.h
+++ b/chrome/browser/page_info_model.h
@@ -35,8 +35,16 @@ class PageInfoModel {
SECTION_INFO_FIRST_VISIT,
};
+ enum SectionInfoState {
+ SECTION_STATE_OK = 0,
+ // If state is OK but contains mixed content.
+ SECTION_STATE_WARNING,
+ // For example, unverified identity over HTTPS.
+ SECTION_STATE_ERROR,
+ };
+
struct SectionInfo {
- SectionInfo(bool state,
+ SectionInfo(SectionInfoState state,
const string16& title,
const string16& headline,
const string16& description,
@@ -48,8 +56,8 @@ class PageInfoModel {
type(type) {
}
- bool state; // True if state is OK, false otherwise (ex of bad states:
- // unverified identity over HTTPS).
+ // The overall state of the connection (error, warning, ok).
+ SectionInfoState state;
// The title of the section.
string16 title;
diff --git a/chrome/browser/views/page_info_bubble_view.cc b/chrome/browser/views/page_info_bubble_view.cc
index 5f1f6f6..a1b15a2 100644
--- a/chrome/browser/views/page_info_bubble_view.cc
+++ b/chrome/browser/views/page_info_bubble_view.cc
@@ -62,6 +62,7 @@ class Section : public views::View,
static SkBitmap* good_state_icon_;
static SkBitmap* bad_state_icon_;
+ static SkBitmap* mixed_state_icon_;
views::ImageView* status_image_;
views::Label* headline_label_;
@@ -74,6 +75,7 @@ class Section : public views::View,
// static
SkBitmap* Section::good_state_icon_ = NULL;
SkBitmap* Section::bad_state_icon_ = NULL;
+SkBitmap* Section::mixed_state_icon_ = NULL;
} // namespace
@@ -169,12 +171,26 @@ Section::Section(PageInfoBubbleView* owner,
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
good_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_GOOD);
bad_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_BAD);
+ mixed_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_MIXED);
}
if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY ||
info_.type == PageInfoModel::SECTION_INFO_CONNECTION) {
status_image_ = new views::ImageView();
- status_image_->SetImage(info_.state ? good_state_icon_ : bad_state_icon_);
+ switch (info_.state) {
+ case PageInfoModel::SECTION_STATE_OK:
+ status_image_->SetImage(good_state_icon_);
+ break;
+ case PageInfoModel::SECTION_STATE_WARNING:
+ DCHECK(info_.type == PageInfoModel::SECTION_INFO_CONNECTION);
+ status_image_->SetImage(mixed_state_icon_);
+ break;
+ case PageInfoModel::SECTION_STATE_ERROR:
+ status_image_->SetImage(bad_state_icon_);
+ break;
+ default:
+ NOTREACHED(); // Do you need to add a case here?
+ }
AddChildView(status_image_);
}
diff --git a/chrome/browser/views/page_info_window_view.cc b/chrome/browser/views/page_info_window_view.cc
index 2432a93..690fc9a 100644
--- a/chrome/browser/views/page_info_window_view.cc
+++ b/chrome/browser/views/page_info_window_view.cc
@@ -82,7 +82,7 @@ class PageInfoWindowView : public views::View,
virtual void ModelChanged();
private:
- // This retreives the sections from the model and lay them out.
+ // This retrieves the sections from the model and lays them out.
void LayoutSections();
// Offsets the specified rectangle so it is showing on the screen and shifted
@@ -217,8 +217,9 @@ void PageInfoWindowView::LayoutSections() {
for (int i = 0; i < model_.GetSectionCount(); ++i) {
PageInfoModel::SectionInfo info = model_.GetSectionInfo(i);
layout->StartRow(0, 0);
- layout->AddView(new Section(info.title, info.state, info.headline,
- info.description));
+ layout->AddView(new Section(
+ info.title, info.state != PageInfoModel::SECTION_STATE_ERROR,
+ info.headline, info.description));
layout->AddPaddingRow(0, kVerticalPadding);
}
layout->AddPaddingRow(1, kVerticalPadding);