| Index: chrome/browser/ui/views/page_info/page_info_popup_view.cc
|
| diff --git a/chrome/browser/ui/views/page_info/page_info_popup_view.cc b/chrome/browser/ui/views/page_info/page_info_popup_view.cc
|
| index c1b73ff459d28444d0364d5c46c54b595f4e59cf..aa3798e2cd3077421d8d06879d51fb2e7999321b 100644
|
| --- a/chrome/browser/ui/views/page_info/page_info_popup_view.cc
|
| +++ b/chrome/browser/ui/views/page_info/page_info_popup_view.cc
|
| @@ -7,8 +7,9 @@
|
| #include <stddef.h>
|
|
|
| #include <algorithm>
|
| -#include <vector>
|
| +#include <utility>
|
|
|
| +#include "base/command_line.h"
|
| #include "base/i18n/rtl.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ptr_util.h"
|
| @@ -28,6 +29,7 @@
|
| #include "chrome/browser/ui/views/page_info/chosen_object_row.h"
|
| #include "chrome/browser/ui/views/page_info/non_accessible_image_view.h"
|
| #include "chrome/browser/ui/views/page_info/permission_selector_row.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "chrome/grit/chromium_strings.h"
|
| #include "chrome/grit/generated_resources.h"
|
| @@ -87,8 +89,8 @@ const int kHeaderLabelSpacing = 4;
|
|
|
| // Site Settings Section -------------------------------------------------------
|
|
|
| -// Spacing above and below the cookies view.
|
| -const int kCookiesViewVerticalPadding = 6;
|
| +// Spacing above and below the cookies and certificate views.
|
| +const int kSubViewsVerticalPadding = 6;
|
|
|
| // Spacing between a permission image and the text.
|
| const int kPermissionImageSpacing = 6;
|
| @@ -105,6 +107,7 @@ const int STYLED_LABEL_SECURITY_DETAILS = 1338;
|
| const int STYLED_LABEL_RESET_CERTIFICATE_DECISIONS = 1339;
|
| const int LINK_COOKIE_DIALOG = 1340;
|
| const int LINK_SITE_SETTINGS = 1341;
|
| +const int LINK_CERTIFICATE_VIEWER = 1342;
|
|
|
| // The default, ui::kTitleFontSizeDelta, is too large for the page info
|
| // bubble (e.g. +3). Use +1 to obtain a smaller font.
|
| @@ -387,6 +390,8 @@ PageInfoPopupView::PageInfoPopupView(
|
| header_(nullptr),
|
| separator_(nullptr),
|
| site_settings_view_(nullptr),
|
| + certificate_view_(nullptr),
|
| + certificate_viewer_link_(nullptr),
|
| cookies_view_(nullptr),
|
| cookie_dialog_link_(nullptr),
|
| permissions_view_(nullptr),
|
| @@ -562,7 +567,7 @@ void PageInfoPopupView::SetCookieInfo(const CookieInfoList& cookie_info_list) {
|
| column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL,
|
| 0, views::GridLayout::USE_PREF, 0, 0);
|
|
|
| - layout->AddPaddingRow(0, kCookiesViewVerticalPadding);
|
| + layout->AddPaddingRow(0, kSubViewsVerticalPadding);
|
|
|
| layout->StartRow(1, cookies_view_column);
|
| PageInfoUI::PermissionInfo info;
|
| @@ -576,8 +581,8 @@ void PageInfoPopupView::SetCookieInfo(const CookieInfoList& cookie_info_list) {
|
| icon->SetImage(image.ToImageSkia());
|
| layout->AddView(
|
| icon, 1, 2, views::GridLayout::FILL,
|
| - // TODO: The vertical alignment may change to CENTER once Harmony is
|
| - // implemented. See https://crbug.com/512442#c48
|
| + // TODO(lgarron): The vertical alignment may change to CENTER once
|
| + // Harmony is implemented. See https://crbug.com/512442#c48
|
| views::GridLayout::LEADING);
|
|
|
| views::Label* cookies_label = new views::Label(
|
| @@ -589,7 +594,7 @@ void PageInfoPopupView::SetCookieInfo(const CookieInfoList& cookie_info_list) {
|
|
|
| layout->AddView(cookie_dialog_link_);
|
|
|
| - layout->AddPaddingRow(0, kCookiesViewVerticalPadding);
|
| + layout->AddPaddingRow(0, kSubViewsVerticalPadding);
|
| }
|
|
|
| layout->Layout(cookies_view_);
|
| @@ -681,6 +686,63 @@ void PageInfoPopupView::SetIdentityInfo(const IdentityInfo& identity_info) {
|
|
|
| if (identity_info.show_ssl_decision_revoke_button)
|
| header_->AddResetDecisionsLabel();
|
| +
|
| + if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kShowCertButton)) {
|
| + certificate_view_ = new views::View();
|
| + views::GridLayout* layout = static_cast<views::GridLayout*>(
|
| + certificate_view_->GetLayoutManager());
|
| + if (!layout) {
|
| + layout = new views::GridLayout(certificate_view_);
|
| + certificate_view_->SetLayoutManager(layout);
|
| +
|
| + const int certificate_view_column = 0;
|
| + views::ColumnSet* column_set =
|
| + layout->AddColumnSet(certificate_view_column);
|
| + column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL,
|
| + 0, views::GridLayout::FIXED,
|
| + kPermissionIconColumnWidth, 0);
|
| + column_set->AddPaddingColumn(0, kPermissionImageSpacing);
|
| + column_set->AddColumn(views::GridLayout::LEADING,
|
| + views::GridLayout::FILL, 0,
|
| + views::GridLayout::USE_PREF, 0, 0);
|
| +
|
| + layout->AddPaddingRow(0, kSubViewsVerticalPadding);
|
| +
|
| + layout->StartRow(1, certificate_view_column);
|
| +
|
| + views::ImageView* icon = new NonAccessibleImageView();
|
| + const gfx::Image& image = PageInfoUI::GetCertificateIcon();
|
| + icon->SetImage(image.ToImageSkia());
|
| + layout->AddView(
|
| + icon, 1, 2, views::GridLayout::FILL,
|
| + // TODO(lgarron): The vertical alignment may change to CENTER once
|
| + // Harmony is implemented. See https://crbug.com/512442#c48
|
| + views::GridLayout::LEADING);
|
| +
|
| + views::Label* certificate_label = new views::Label(
|
| + l10n_util::GetStringUTF16(IDS_PAGE_INFO_CERTIFICATE),
|
| + CONTEXT_BODY_TEXT_LARGE);
|
| + layout->AddView(certificate_label);
|
| + layout->StartRow(1, certificate_view_column);
|
| + layout->SkipColumns(1);
|
| +
|
| + // The text of link to the Certificate Viewer varies depending on the
|
| + // validity of the Certificate.
|
| + certificate_viewer_link_ = new views::Link(l10n_util::GetStringUTF16(
|
| + (identity_info.identity_status ==
|
| + PageInfo::SITE_IDENTITY_STATUS_ERROR)
|
| + ? IDS_PAGE_INFO_CERTIFICATE_INVALID_LINK
|
| + : IDS_PAGE_INFO_CERTIFICATE_VALID_LINK));
|
| + certificate_viewer_link_->set_id(LINK_CERTIFICATE_VIEWER);
|
| + certificate_viewer_link_->set_listener(this);
|
| +
|
| + layout->AddView(certificate_viewer_link_);
|
| + }
|
| +
|
| + layout->Layout(certificate_view_);
|
| + site_settings_view_->AddChildViewAt(certificate_view_, 0);
|
| + }
|
| }
|
|
|
| header_->SetDetails(security_description->details);
|
| @@ -705,7 +767,7 @@ views::View* PageInfoPopupView::CreateSiteSettingsView(int side_margin) {
|
| }
|
|
|
| void PageInfoPopupView::HandleLinkClickedAsync(views::Link* source) {
|
| - // Both switch cases require accessing web_contents(), so we check it here.
|
| + // All switch cases require accessing web_contents(), so we check it here.
|
| if (web_contents() == nullptr || web_contents()->IsBeingDestroyed())
|
| return;
|
| switch (source->id()) {
|
| @@ -727,6 +789,14 @@ void PageInfoPopupView::HandleLinkClickedAsync(views::Link* source) {
|
| PageInfo::PAGE_INFO_COOKIES_DIALOG_OPENED);
|
| new CollectedCookiesViews(web_contents());
|
| break;
|
| + case LINK_CERTIFICATE_VIEWER: {
|
| + gfx::NativeWindow top_window = web_contents()->GetTopLevelNativeWindow();
|
| + if (certificate_ && top_window) {
|
| + presenter_->RecordPageInfoAction(
|
| + PageInfo::PAGE_INFO_CERTIFICATE_DIALOG_OPENED);
|
| + ShowCertificateViewer(web_contents(), top_window, certificate_.get());
|
| + }
|
| + } break;
|
| default:
|
| NOTREACHED();
|
| }
|
|
|