diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 08:44:43 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 08:44:43 +0000 |
commit | 5cb67f62e75963808e46775ac29f5ea289719bce (patch) | |
tree | 22040c59dbd41c94ca45a19a2fd50df13fd3d551 | |
parent | 9f284f13fd93a37bd8afa4840e91a953f4c9bc51 (diff) | |
download | chromium_src-5cb67f62e75963808e46775ac29f5ea289719bce.zip chromium_src-5cb67f62e75963808e46775ac29f5ea289719bce.tar.gz chromium_src-5cb67f62e75963808e46775ac29f5ea289719bce.tar.bz2 |
Tweaks to the SSL InfoBubble dialog.
Fixed the mixed state icon not showing for section Connection. I overlooked the fact that we already check for mixed content, but reported state as error (whereas now we want warning).
Added link to help center explaining what this dialog means.
BUG=http://crbug.com/52916
TEST=SSL Infobubble should show link to help center and should show mixed content icon when, for example, you open an email in Gmail with an external image embedded in it.
Review URL: http://codereview.chromium.org/3221005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57970 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/app/resources/locale_settings.grd | 5 | ||||
-rw-r--r-- | chrome/browser/page_info_model.cc | 16 | ||||
-rw-r--r-- | chrome/browser/views/page_info_bubble_view.cc | 66 | ||||
-rw-r--r-- | chrome/browser/views/page_info_bubble_view.h | 10 |
5 files changed, 69 insertions, 34 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index d8c3c62..8b0c862 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -5368,6 +5368,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Certificate Information </message> </if> + <message name="IDS_PAGE_INFO_HELP_CENTER_LINK" desc="This is the text of the link pointing to the Help Center. This appears at the bottom of the SSL dialog and 'this' refers to the sections within the bubble."> + What do these mean? + </message> <message name="IDS_PAGEINFO_CLOSE_BUTTON" desc="Text of button in the page info that closes the window."> Close </message> @@ -5436,9 +5439,6 @@ 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/app/resources/locale_settings.grd b/chrome/app/resources/locale_settings.grd index 237462a..499dffe 100644 --- a/chrome/app/resources/locale_settings.grd +++ b/chrome/app/resources/locale_settings.grd @@ -364,6 +364,11 @@ 25 </message> + <!-- The URL for the "Learn more" page for the Privacy section under Options. --> + <message name="IDS_PAGE_INFO_HELP_CENTER" translateable="false"> + http://www.google.com/support/chrome/bin/answer.py?hl=[GRITLANGCODE]&answer=95617 + </message> + <!-- The width and height of the Page Info bubble characters and lines (See above). --> <message name="IDS_PAGEINFOBUBBLE_WIDTH_CHARS" use_name_for_id="true"> 50 diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc index 3c031bc..5d15639 100644 --- a/chrome/browser/page_info_model.cc +++ b/chrome/browser/page_info_model.cc @@ -7,7 +7,7 @@ #include <string> #include "app/l10n_util.h" -#include "base/callback.h" +#include "base/command_line.h" #include "base/i18n/time_formatting.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" @@ -15,6 +15,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/ssl/ssl_manager.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "grit/generated_resources.h" #include "net/base/cert_status_flags.h" @@ -125,7 +126,11 @@ PageInfoModel::PageInfoModel(Profile* profile, subject_name, base::IntToString16(ssl.security_bits()))); if (ssl.displayed_insecure_content() || ssl.ran_insecure_content()) { - state = SECTION_STATE_ERROR; + const CommandLine* command_line(CommandLine::ForCurrentProcess()); + if (command_line->HasSwitch(switches::kEnableNewPageInfoBubble)) + state = SECTION_STATE_WARNING; + else + state = SECTION_STATE_ERROR; description.assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, description, @@ -135,13 +140,6 @@ 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) { diff --git a/chrome/browser/views/page_info_bubble_view.cc b/chrome/browser/views/page_info_bubble_view.cc index a1b15a2..b7ca272 100644 --- a/chrome/browser/views/page_info_bubble_view.cc +++ b/chrome/browser/views/page_info_bubble_view.cc @@ -7,6 +7,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/browser_list.h" #include "chrome/browser/certificate_viewer.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/info_bubble.h" @@ -16,7 +17,6 @@ #include "grit/theme_resources.h" #include "views/controls/image_view.h" #include "views/controls/label.h" -#include "views/controls/link.h" #include "views/controls/separator.h" #include "views/grid_layout.h" #include "views/widget/widget.h" @@ -40,7 +40,8 @@ class Section : public views::View, public views::LinkController { public: Section(PageInfoBubbleView* owner, - const PageInfoModel::SectionInfo& section_info); + const PageInfoModel::SectionInfo& section_info, + bool show_cert); virtual ~Section(); // views::View methods: @@ -91,7 +92,8 @@ PageInfoBubbleView::PageInfoBubbleView(gfx::NativeWindow parent_window, show_history, this)), parent_window_(parent_window), cert_id_(ssl.cert_id()), - info_bubble_(NULL) { + info_bubble_(NULL), + help_center_link_(NULL) { LayoutSections(); } @@ -122,16 +124,21 @@ void PageInfoBubbleView::LayoutSections() { layout->StartRow(0, 0); // TODO(finnur): Remove title from the info struct, since it is // not used anymore. - layout->AddView(new Section(this, info)); - - // Add separator after all sections except the last. - if (i < count - 1) { - layout->AddPaddingRow(0, kPaddingAboveSeparator); - layout->StartRow(0, 0); - layout->AddView(new views::Separator()); - layout->AddPaddingRow(0, kPaddingBelowSeparator); - } + layout->AddView(new Section(this, info, cert_id_ > 0)); + + // Add separator after all sections. + layout->AddPaddingRow(0, kPaddingAboveSeparator); + layout->StartRow(0, 0); + layout->AddView(new views::Separator()); + layout->AddPaddingRow(0, kPaddingBelowSeparator); } + + // Then add the help center link at the bottom. + layout->StartRow(0, 0); + help_center_link_ = + new views::Link(l10n_util::GetString(IDS_PAGE_INFO_HELP_CENTER_LINK)); + help_center_link_->SetController(this); + layout->AddView(help_center_link_); } gfx::Size PageInfoBubbleView::GetPreferredSize() { @@ -142,16 +149,25 @@ gfx::Size PageInfoBubbleView::GetPreferredSize() { int count = model_.GetSectionCount(); for (int i = 0; i < count; ++i) { PageInfoModel::SectionInfo info = model_.GetSectionInfo(i); - Section section(this, info); + Section section(this, info, cert_id_ > 0); size.Enlarge(0, section.GetHeightForWidth(size.width())); } - // Account for the separators and padding. + // Calculate how much space the separators take up (with padding). views::Separator separator; gfx::Size separator_size = separator.GetPreferredSize(); - size.Enlarge(0, (count - 1) * (separator_size.height() + - kPaddingAboveSeparator + - kPaddingBelowSeparator)); + gfx::Size separator_plus_padding(0, separator_size.height() + + kPaddingAboveSeparator + + kPaddingBelowSeparator); + + // Account for the separators and padding within sections. + size.Enlarge(0, (count - 1) * separator_plus_padding.height()); + + // Account for the Help Center link and the separator above it. + gfx::Size link_size = help_center_link_->GetPreferredSize(); + size.Enlarge(0, separator_plus_padding.height() + + link_size.height()); + return size; } @@ -160,13 +176,21 @@ void PageInfoBubbleView::ModelChanged() { info_bubble_->SizeToContents(); } +void PageInfoBubbleView::LinkActivated(views::Link* source, int event_flags) { + GURL url = GURL(l10n_util::GetStringUTF16(IDS_PAGE_INFO_HELP_CENTER)); + Browser* browser = BrowserList::GetLastActive(); + browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); +} + //////////////////////////////////////////////////////////////////////////////// // Section Section::Section(PageInfoBubbleView* owner, - const PageInfoModel::SectionInfo& section_info) + const PageInfoModel::SectionInfo& section_info, + bool show_cert) : owner_(owner), - info_(section_info) { + info_(section_info), + link_(NULL) { if (!good_state_icon_) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); good_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_GOOD); @@ -208,7 +232,7 @@ Section::Section(PageInfoBubbleView* owner, description_label_->SetAllowCharacterBreak(true); AddChildView(description_label_); - if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY) { + if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY && show_cert) { link_ = new views::Link( l10n_util::GetString(IDS_PAGEINFO_CERT_INFO_BUTTON)); link_->SetController(this); @@ -265,7 +289,7 @@ gfx::Size Section::LayoutItems(bool compute_bounds_only, int width) { if (!compute_bounds_only) description_label_->SetBounds(x, y, 0, 0); } - if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY) { + if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY && link_) { size = link_->GetPreferredSize(); link_->SetBounds(x, y, size.width(), size.height()); y += size.height(); diff --git a/chrome/browser/views/page_info_bubble_view.h b/chrome/browser/views/page_info_bubble_view.h index fcfdd9f..8585862 100644 --- a/chrome/browser/views/page_info_bubble_view.h +++ b/chrome/browser/views/page_info_bubble_view.h @@ -8,6 +8,7 @@ #include "chrome/browser/page_info_model.h" #include "chrome/browser/views/info_bubble.h" +#include "views/controls/link.h" #include "views/view.h" namespace views { @@ -16,7 +17,8 @@ class Label; class PageInfoBubbleView : public views::View, public PageInfoModel::PageInfoModelObserver, - public InfoBubbleDelegate { + public InfoBubbleDelegate, + public views::LinkController { public: PageInfoBubbleView(gfx::NativeWindow parent_window, Profile* profile, @@ -43,6 +45,9 @@ class PageInfoBubbleView : public views::View, virtual bool FadeInOnShow() { return false; } virtual std::wstring accessible_name() { return L"PageInfoBubble"; } + // LinkController methods: + virtual void LinkActivated(views::Link* source, int event_flags); + private: // Layout the sections within the bubble. void LayoutSections(); @@ -58,6 +63,9 @@ class PageInfoBubbleView : public views::View, InfoBubble* info_bubble_; + // The Help Center link at the bottom of the bubble. + views::Link* help_center_link_; + DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView); }; |