summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-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
5 files changed, 53 insertions, 36 deletions
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);