summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 13:22:05 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 13:22:05 +0000
commitc45ea217857a088a1f0acd2892bfea82319bd388 (patch)
treea6cce9d19f77c9add64f2b17243b35e7556aba2f /chrome
parent43c77d0bdba60745ef3dc01fd4fa6744642491b8 (diff)
downloadchromium_src-c45ea217857a088a1f0acd2892bfea82319bd388.zip
chromium_src-c45ea217857a088a1f0acd2892bfea82319bd388.tar.gz
chromium_src-c45ea217857a088a1f0acd2892bfea82319bd388.tar.bz2
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
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd5
-rw-r--r--chrome/app/theme/theme_resources.grd4
-rw-r--r--chrome/browser/gtk/page_info_bubble_gtk.cc9
-rw-r--r--chrome/browser/page_info_model.cc29
-rw-r--r--chrome/browser/page_info_model.h6
-rw-r--r--chrome/browser/views/page_info_bubble_view.cc41
-rw-r--r--chrome/browser/views/page_info_window_view.cc4
7 files changed, 60 insertions, 38 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 4c05595..af446c4 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5454,7 +5454,10 @@ 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_SITE_INFO_TITLE" desc="The name of the site information section.">
+ Site information
+ </message>
+
<!-- SSL Blocking Page -->
<message name="IDS_SSL_BLOCKING_PAGE_TITLE" desc="The title of the SSL blocking page.">
SSL Error
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index 1ffe9a7..9ba0d85 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -243,7 +243,9 @@
<include name="IDR_OTR_ICON" file="otr_icon.png" type="BINDATA" />
<include name="IDR_PAGEINFO_BAD" file="pageinfo_bad.png" type="BINDATA" />
<include name="IDR_PAGEINFO_GOOD" file="pageinfo_good.png" type="BINDATA" />
- <include name="IDR_PAGEINFO_MIXED" file="pageinfo_mixed.png" type="BINDATA" />
+ <include name="IDR_PAGEINFO_INFO" file="pageinfo_info.png" type="BINDATA" />
+ <include name="IDR_PAGEINFO_WARNING_MAJOR" file="pageinfo_warning.png" type="BINDATA" />
+ <include name="IDR_PAGEINFO_WARNING_MINOR" file="pageinfo_mixed.png" type="BINDATA" />
<include name="IDR_PLUGIN" file="plugin.png" type="BINDATA" />
<if expr="pp_ifdef('_google_chrome')">
<include name="IDR_PRODUCT_ICON_32" file="google_chrome/google_chrome_icon_32.png" type="BINDATA" />
diff --git a/chrome/browser/gtk/page_info_bubble_gtk.cc b/chrome/browser/gtk/page_info_bubble_gtk.cc
index c47ac51..807de26 100644
--- a/chrome/browser/gtk/page_info_bubble_gtk.cc
+++ b/chrome/browser/gtk/page_info_bubble_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -223,9 +223,12 @@ GtkWidget* PageInfoBubbleGtk::CreateSection(
case PageInfoModel::SECTION_STATE_OK:
pixbuf = rb.GetPixbufNamed(IDR_PAGEINFO_GOOD);
break;
- case PageInfoModel::SECTION_STATE_WARNING:
+ case PageInfoModel::SECTION_STATE_WARNING_MINOR:
DCHECK(section.type == PageInfoModel::SECTION_INFO_CONNECTION);
- pixbuf = rb.GetPixbufNamed(IDR_PAGEINFO_MIXED);
+ pixbuf = rb.GetPixbufNamed(IDR_PAGEINFO_WARNING_MINOR);
+ break;
+ case PageInfoModel::SECTION_STATE_WARNING_MAJOR:
+ pixbuf = rb.GetPixbufNamed(IDR_PAGEINFO_WARNING_MAJOR);
break;
case PageInfoModel::SECTION_STATE_ERROR:
pixbuf = rb.GetPixbufNamed(IDR_PAGEINFO_BAD);
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))),
diff --git a/chrome/browser/page_info_model.h b/chrome/browser/page_info_model.h
index e46ab8d..1f9942f 100644
--- a/chrome/browser/page_info_model.h
+++ b/chrome/browser/page_info_model.h
@@ -37,8 +37,10 @@ class PageInfoModel {
enum SectionInfoState {
SECTION_STATE_OK = 0,
- // If state is OK but contains mixed content.
- SECTION_STATE_WARNING,
+ // For example, if state is OK but contains mixed content.
+ SECTION_STATE_WARNING_MINOR,
+ // For example, if content was served over HTTP.
+ SECTION_STATE_WARNING_MAJOR,
// For example, unverified identity over HTTPS.
SECTION_STATE_ERROR,
};
diff --git a/chrome/browser/views/page_info_bubble_view.cc b/chrome/browser/views/page_info_bubble_view.cc
index bfdafc6..46ea691 100644
--- a/chrome/browser/views/page_info_bubble_view.cc
+++ b/chrome/browser/views/page_info_bubble_view.cc
@@ -61,10 +61,6 @@ class Section : public views::View,
// The information this view represents.
PageInfoModel::SectionInfo info_;
- static SkBitmap* good_state_icon_;
- static SkBitmap* bad_state_icon_;
- static SkBitmap* mixed_state_icon_;
-
views::ImageView* status_image_;
views::Label* headline_label_;
views::Label* description_label_;
@@ -73,11 +69,6 @@ class Section : public views::View,
DISALLOW_COPY_AND_ASSIGN(Section);
};
-// static
-SkBitmap* Section::good_state_icon_ = NULL;
-SkBitmap* Section::bad_state_icon_ = NULL;
-SkBitmap* Section::mixed_state_icon_ = NULL;
-
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -190,32 +181,36 @@ Section::Section(PageInfoBubbleView* owner,
bool show_cert)
: owner_(owner),
info_(section_info),
+ status_image_(NULL),
link_(NULL) {
- if (!good_state_icon_) {
- 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);
- }
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY ||
info_.type == PageInfoModel::SECTION_INFO_CONNECTION) {
status_image_ = new views::ImageView();
switch (info_.state) {
case PageInfoModel::SECTION_STATE_OK:
- status_image_->SetImage(good_state_icon_);
+ status_image_->SetImage(rb.GetBitmapNamed(IDR_PAGEINFO_GOOD));
+ break;
+ case PageInfoModel::SECTION_STATE_WARNING_MAJOR:
+ status_image_->SetImage(rb.GetBitmapNamed(IDR_PAGEINFO_WARNING_MAJOR));
break;
- case PageInfoModel::SECTION_STATE_WARNING:
- DCHECK(info_.type == PageInfoModel::SECTION_INFO_CONNECTION);
- status_image_->SetImage(mixed_state_icon_);
+ case PageInfoModel::SECTION_STATE_WARNING_MINOR:
+ status_image_->SetImage(rb.GetBitmapNamed(IDR_PAGEINFO_WARNING_MINOR));
break;
case PageInfoModel::SECTION_STATE_ERROR:
- status_image_->SetImage(bad_state_icon_);
+ status_image_->SetImage(rb.GetBitmapNamed(IDR_PAGEINFO_BAD));
break;
default:
NOTREACHED(); // Do you need to add a case here?
}
AddChildView(status_image_);
+ } else if (info_.type == PageInfoModel::SECTION_INFO_FIRST_VISIT) {
+ status_image_ = new views::ImageView();
+ status_image_->SetImage(info_.state == PageInfoModel::SECTION_STATE_OK ?
+ rb.GetBitmapNamed(IDR_PAGEINFO_INFO) :
+ rb.GetBitmapNamed(IDR_PAGEINFO_WARNING_MAJOR));
+ AddChildView(status_image_);
}
headline_label_ = new views::Label(UTF16ToWideHack(info_.headline));
@@ -261,8 +256,7 @@ gfx::Size Section::LayoutItems(bool compute_bounds_only, int width) {
// Layout the image, head-line and description.
gfx::Size size;
- if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY ||
- info_.type == PageInfoModel::SECTION_INFO_CONNECTION) {
+ if (status_image_) {
size = status_image_->GetPreferredSize();
if (!compute_bounds_only)
status_image_->SetBounds(x, y, size.width(), size.height());
@@ -291,7 +285,8 @@ gfx::Size Section::LayoutItems(bool compute_bounds_only, int width) {
}
if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY && link_) {
size = link_->GetPreferredSize();
- link_->SetBounds(x, y, size.width(), size.height());
+ if (!compute_bounds_only)
+ link_->SetBounds(x, y, size.width(), size.height());
y += size.height();
}
diff --git a/chrome/browser/views/page_info_window_view.cc b/chrome/browser/views/page_info_window_view.cc
index 4b65c7a..aa833ab 100644
--- a/chrome/browser/views/page_info_window_view.cc
+++ b/chrome/browser/views/page_info_window_view.cc
@@ -344,7 +344,9 @@ Section::Section(const string16& title,
if (!good_state_icon_) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
good_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_GOOD);
- bad_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_BAD);
+ // The exclamation point has been re-purposed as a warning
+ // signal in the new code.
+ bad_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_WARNING_MAJOR);
}
title_label_ = new views::Label(UTF16ToWideHack(title));
title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);