| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" | 5 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "chrome/browser/certificate_viewer.h" | 18 #include "chrome/browser/certificate_viewer.h" |
| 19 #include "chrome/browser/infobars/infobar_service.h" | 19 #include "chrome/browser/infobars/infobar_service.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 // Margin and padding values for the |BubbleHeaderView|. | 83 // Margin and padding values for the |BubbleHeaderView|. |
| 84 const int kHeaderMarginBottom = 10; | 84 const int kHeaderMarginBottom = 10; |
| 85 const int kHeaderPaddingBottom = 13; | 85 const int kHeaderPaddingBottom = 13; |
| 86 | 86 |
| 87 // Spacing between labels in the header. | 87 // Spacing between labels in the header. |
| 88 const int kHeaderLabelSpacing = 4; | 88 const int kHeaderLabelSpacing = 4; |
| 89 | 89 |
| 90 // Site Settings Section ------------------------------------------------------- | 90 // Site Settings Section ------------------------------------------------------- |
| 91 | 91 |
| 92 // Spacing above and below the cookies view. | 92 // Spacing above and below the cookies and certificate views. |
| 93 const int kCookiesViewVerticalPadding = 6; | 93 const int kSubViewsVerticalPadding = 6; |
| 94 | 94 |
| 95 // Spacing between a permission image and the text. | 95 // Spacing between a permission image and the text. |
| 96 const int kPermissionImageSpacing = 6; | 96 const int kPermissionImageSpacing = 6; |
| 97 | 97 |
| 98 // Spacing between rows in the site settings section | 98 // Spacing between rows in the site settings section |
| 99 const int kPermissionsVerticalSpacing = 12; | 99 const int kPermissionsVerticalSpacing = 12; |
| 100 | 100 |
| 101 // Spacing between the label and the menu. | 101 // Spacing between the label and the menu. |
| 102 const int kPermissionMenuSpacing = 16; | 102 const int kPermissionMenuSpacing = 16; |
| 103 | 103 |
| 104 // Button/styled label/link IDs ------------------------------------------------ | 104 // Button/styled label/link IDs ------------------------------------------------ |
| 105 const int BUTTON_CLOSE = 1337; | 105 const int BUTTON_CLOSE = 1337; |
| 106 const int STYLED_LABEL_SECURITY_DETAILS = 1338; | 106 const int STYLED_LABEL_SECURITY_DETAILS = 1338; |
| 107 const int STYLED_LABEL_RESET_CERTIFICATE_DECISIONS = 1339; | 107 const int STYLED_LABEL_RESET_CERTIFICATE_DECISIONS = 1339; |
| 108 const int LINK_COOKIE_DIALOG = 1340; | 108 const int LINK_COOKIE_DIALOG = 1340; |
| 109 const int LINK_SITE_SETTINGS = 1341; | 109 const int LINK_SITE_SETTINGS = 1341; |
| 110 const int LINK_CERTIFICATE_VIEWER = 1342; |
| 110 | 111 |
| 111 // The default, ui::kTitleFontSizeDelta, is too large for the page info | 112 // The default, ui::kTitleFontSizeDelta, is too large for the page info |
| 112 // bubble (e.g. +3). Use +1 to obtain a smaller font. | 113 // bubble (e.g. +3). Use +1 to obtain a smaller font. |
| 113 constexpr int kSummaryFontSizeDelta = 1; | 114 constexpr int kSummaryFontSizeDelta = 1; |
| 114 | 115 |
| 115 // Adds a ColumnSet on |layout| with a single View column and padding columns | 116 // Adds a ColumnSet on |layout| with a single View column and padding columns |
| 116 // on either side of it with |margin| width. | 117 // on either side of it with |margin| width. |
| 117 void AddColumnWithSideMargin(views::GridLayout* layout, int margin, int id) { | 118 void AddColumnWithSideMargin(views::GridLayout* layout, int margin, int id) { |
| 118 views::ColumnSet* column_set = layout->AddColumnSet(id); | 119 views::ColumnSet* column_set = layout->AddColumnSet(id); |
| 119 column_set->AddPaddingColumn(0, margin); | 120 column_set->AddPaddingColumn(0, margin); |
| 120 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 121 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
| 121 views::GridLayout::USE_PREF, 0, 0); | 122 views::GridLayout::USE_PREF, 0, 0); |
| 122 column_set->AddPaddingColumn(0, margin); | 123 column_set->AddPaddingColumn(0, margin); |
| 123 } | 124 } |
| 124 | 125 |
| 126 // Creates a section containing a title, icon, and link. Used to display |
| 127 // Cookies and Certificate information. |
| 128 views::View* CreateInspectLinkSection(const gfx::ImageSkia& image_icon, |
| 129 const int title_id, |
| 130 views::Link* link) { |
| 131 views::View* new_view = new views::View(); |
| 132 |
| 133 views::GridLayout* layout = new views::GridLayout(new_view); |
| 134 new_view->SetLayoutManager(layout); |
| 135 |
| 136 const int column = 0; |
| 137 views::ColumnSet* column_set = layout->AddColumnSet(column); |
| 138 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, |
| 139 views::GridLayout::FIXED, kPermissionIconColumnWidth, |
| 140 0); |
| 141 column_set->AddPaddingColumn(0, kPermissionImageSpacing); |
| 142 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 0, |
| 143 views::GridLayout::USE_PREF, 0, 0); |
| 144 |
| 145 layout->AddPaddingRow(0, kSubViewsVerticalPadding); |
| 146 |
| 147 layout->StartRow(1, column); |
| 148 |
| 149 views::ImageView* icon = new NonAccessibleImageView(); |
| 150 icon->SetImage(image_icon); |
| 151 layout->AddView( |
| 152 icon, 1, 2, views::GridLayout::FILL, |
| 153 // TODO(lgarron): The vertical alignment may change to CENTER once |
| 154 // Harmony is implemented. See https://crbug.com/512442#c48 |
| 155 views::GridLayout::LEADING); |
| 156 |
| 157 views::Label* title_label = new views::Label( |
| 158 l10n_util::GetStringUTF16(title_id), CONTEXT_BODY_TEXT_LARGE); |
| 159 layout->AddView(title_label); |
| 160 layout->StartRow(1, column); |
| 161 layout->SkipColumns(1); |
| 162 |
| 163 layout->AddView(link); |
| 164 return new_view; |
| 165 } |
| 166 |
| 125 } // namespace | 167 } // namespace |
| 126 | 168 |
| 127 // |BubbleHeaderView| is the UI element (view) that represents the header of the | 169 // |BubbleHeaderView| is the UI element (view) that represents the header of the |
| 128 // |PageInfoBubbleView|. The header shows the status of the site's | 170 // |PageInfoBubbleView|. The header shows the status of the site's |
| 129 // identity check and the name of the site's identity. | 171 // identity check and the name of the site's identity. |
| 130 class BubbleHeaderView : public views::View { | 172 class BubbleHeaderView : public views::View { |
| 131 public: | 173 public: |
| 132 BubbleHeaderView(views::ButtonListener* button_listener, | 174 BubbleHeaderView(views::ButtonListener* button_listener, |
| 133 views::StyledLabelListener* styled_label_listener, | 175 views::StyledLabelListener* styled_label_listener, |
| 134 int side_margin); | 176 int side_margin); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 Profile* profile, | 424 Profile* profile, |
| 383 content::WebContents* web_contents, | 425 content::WebContents* web_contents, |
| 384 const GURL& url, | 426 const GURL& url, |
| 385 const security_state::SecurityInfo& security_info) | 427 const security_state::SecurityInfo& security_info) |
| 386 : content::WebContentsObserver(web_contents), | 428 : content::WebContentsObserver(web_contents), |
| 387 BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), | 429 BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), |
| 388 profile_(profile), | 430 profile_(profile), |
| 389 header_(nullptr), | 431 header_(nullptr), |
| 390 separator_(nullptr), | 432 separator_(nullptr), |
| 391 site_settings_view_(nullptr), | 433 site_settings_view_(nullptr), |
| 392 cookies_view_(nullptr), | |
| 393 cookie_dialog_link_(nullptr), | 434 cookie_dialog_link_(nullptr), |
| 394 permissions_view_(nullptr), | 435 permissions_view_(nullptr), |
| 395 weak_factory_(this) { | 436 weak_factory_(this) { |
| 396 g_shown_bubble_type = BUBBLE_PAGE_INFO; | 437 g_shown_bubble_type = BUBBLE_PAGE_INFO; |
| 397 set_parent_window(parent_window); | 438 set_parent_window(parent_window); |
| 398 | 439 |
| 399 // Compensate for built-in vertical padding in the anchor view's image. | 440 // Compensate for built-in vertical padding in the anchor view's image. |
| 400 set_anchor_view_insets(gfx::Insets( | 441 set_anchor_view_insets(gfx::Insets( |
| 401 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); | 442 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); |
| 402 | 443 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 void PageInfoBubbleView::SetCookieInfo(const CookieInfoList& cookie_info_list) { | 575 void PageInfoBubbleView::SetCookieInfo(const CookieInfoList& cookie_info_list) { |
| 535 // |cookie_info_list| should only ever have 2 items: first- and third-party | 576 // |cookie_info_list| should only ever have 2 items: first- and third-party |
| 536 // cookies. | 577 // cookies. |
| 537 DCHECK_EQ(cookie_info_list.size(), 2u); | 578 DCHECK_EQ(cookie_info_list.size(), 2u); |
| 538 int total_allowed = 0; | 579 int total_allowed = 0; |
| 539 for (const auto& i : cookie_info_list) | 580 for (const auto& i : cookie_info_list) |
| 540 total_allowed += i.allowed; | 581 total_allowed += i.allowed; |
| 541 base::string16 label_text = l10n_util::GetPluralStringFUTF16( | 582 base::string16 label_text = l10n_util::GetPluralStringFUTF16( |
| 542 IDS_PAGE_INFO_NUM_COOKIES, total_allowed); | 583 IDS_PAGE_INFO_NUM_COOKIES, total_allowed); |
| 543 | 584 |
| 544 if (!cookie_dialog_link_) { | 585 cookie_dialog_link_->SetText(label_text); |
| 545 cookie_dialog_link_ = new views::Link(label_text); | 586 Layout(); |
| 546 cookie_dialog_link_->set_id(LINK_COOKIE_DIALOG); | |
| 547 cookie_dialog_link_->set_listener(this); | |
| 548 } else { | |
| 549 cookie_dialog_link_->SetText(label_text); | |
| 550 } | |
| 551 | |
| 552 views::GridLayout* layout = | |
| 553 static_cast<views::GridLayout*>(cookies_view_->GetLayoutManager()); | |
| 554 if (!layout) { | |
| 555 layout = new views::GridLayout(cookies_view_); | |
| 556 cookies_view_->SetLayoutManager(layout); | |
| 557 | |
| 558 const int cookies_view_column = 0; | |
| 559 views::ColumnSet* column_set = layout->AddColumnSet(cookies_view_column); | |
| 560 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, | |
| 561 views::GridLayout::FIXED, kPermissionIconColumnWidth, | |
| 562 0); | |
| 563 column_set->AddPaddingColumn(0, kPermissionImageSpacing); | |
| 564 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, | |
| 565 0, views::GridLayout::USE_PREF, 0, 0); | |
| 566 | |
| 567 layout->AddPaddingRow(0, kCookiesViewVerticalPadding); | |
| 568 | |
| 569 layout->StartRow(1, cookies_view_column); | |
| 570 PageInfoUI::PermissionInfo info; | |
| 571 info.type = CONTENT_SETTINGS_TYPE_COOKIES; | |
| 572 info.setting = CONTENT_SETTING_ALLOW; | |
| 573 info.is_incognito = | |
| 574 Profile::FromBrowserContext(web_contents()->GetBrowserContext()) | |
| 575 ->IsOffTheRecord(); | |
| 576 views::ImageView* icon = new NonAccessibleImageView(); | |
| 577 const gfx::Image& image = PageInfoUI::GetPermissionIcon(info); | |
| 578 icon->SetImage(image.ToImageSkia()); | |
| 579 layout->AddView( | |
| 580 icon, 1, 2, views::GridLayout::FILL, | |
| 581 // TODO: The vertical alignment may change to CENTER once Harmony is | |
| 582 // implemented. See https://crbug.com/512442#c48 | |
| 583 views::GridLayout::LEADING); | |
| 584 | |
| 585 views::Label* cookies_label = new views::Label( | |
| 586 l10n_util::GetStringUTF16(IDS_PAGE_INFO_TITLE_SITE_DATA), | |
| 587 CONTEXT_BODY_TEXT_LARGE); | |
| 588 layout->AddView(cookies_label); | |
| 589 layout->StartRow(1, cookies_view_column); | |
| 590 layout->SkipColumns(1); | |
| 591 | |
| 592 layout->AddView(cookie_dialog_link_); | |
| 593 | |
| 594 layout->AddPaddingRow(0, kCookiesViewVerticalPadding); | |
| 595 } | |
| 596 | |
| 597 layout->Layout(cookies_view_); | |
| 598 SizeToContents(); | 587 SizeToContents(); |
| 599 } | 588 } |
| 600 | 589 |
| 601 void PageInfoBubbleView::SetPermissionInfo( | 590 void PageInfoBubbleView::SetPermissionInfo( |
| 602 const PermissionInfoList& permission_info_list, | 591 const PermissionInfoList& permission_info_list, |
| 603 ChosenObjectInfoList chosen_object_info_list) { | 592 ChosenObjectInfoList chosen_object_info_list) { |
| 604 // When a permission is changed, PageInfo::OnSitePermissionChanged() | 593 // When a permission is changed, PageInfo::OnSitePermissionChanged() |
| 605 // calls this method with updated permissions. However, PermissionSelectorRow | 594 // calls this method with updated permissions. However, PermissionSelectorRow |
| 606 // will have already updated its state, so it's already reflected in the UI. | 595 // will have already updated its state, so it's already reflected in the UI. |
| 607 // In addition, if a permission is set to the default setting, PageInfo | 596 // In addition, if a permission is set to the default setting, PageInfo |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 identity_info.GetSecurityDescription(); | 665 identity_info.GetSecurityDescription(); |
| 677 | 666 |
| 678 summary_text_ = security_description->summary; | 667 summary_text_ = security_description->summary; |
| 679 GetWidget()->UpdateWindowTitle(); | 668 GetWidget()->UpdateWindowTitle(); |
| 680 | 669 |
| 681 if (identity_info.certificate) { | 670 if (identity_info.certificate) { |
| 682 certificate_ = identity_info.certificate; | 671 certificate_ = identity_info.certificate; |
| 683 | 672 |
| 684 if (identity_info.show_ssl_decision_revoke_button) | 673 if (identity_info.show_ssl_decision_revoke_button) |
| 685 header_->AddResetDecisionsLabel(); | 674 header_->AddResetDecisionsLabel(); |
| 675 |
| 676 if (PageInfoUI::ShouldShowCertificateLink()) { |
| 677 // The text of link to the Certificate Viewer varies depending on the |
| 678 // validity of the Certificate. |
| 679 const bool valid_identity = (identity_info.identity_status != |
| 680 PageInfo::SITE_IDENTITY_STATUS_ERROR); |
| 681 const base::string16 link_title = l10n_util::GetStringUTF16( |
| 682 valid_identity ? IDS_PAGE_INFO_CERTIFICATE_VALID_LINK |
| 683 : IDS_PAGE_INFO_CERTIFICATE_INVALID_LINK); |
| 684 |
| 685 // Create the link to add to the Certificate Section. |
| 686 views::Link* inspect_link = new views::Link(link_title); |
| 687 inspect_link->set_id(LINK_CERTIFICATE_VIEWER); |
| 688 inspect_link->set_listener(this); |
| 689 if (valid_identity) { |
| 690 inspect_link->SetTooltipText(l10n_util::GetStringFUTF16( |
| 691 IDS_PAGE_INFO_CERTIFICATE_VALID_LINK_TOOLTIP, |
| 692 base::UTF8ToUTF16(certificate_->issuer().GetDisplayName()))); |
| 693 } |
| 694 |
| 695 // Add the Certificate Section. |
| 696 site_settings_view_->AddChildViewAt( |
| 697 CreateInspectLinkSection(PageInfoUI::GetCertificateIcon(), |
| 698 IDS_PAGE_INFO_CERTIFICATE, inspect_link), |
| 699 0); |
| 700 } |
| 686 } | 701 } |
| 687 | 702 |
| 688 header_->SetDetails(security_description->details); | 703 header_->SetDetails(security_description->details); |
| 689 | 704 |
| 690 Layout(); | 705 Layout(); |
| 691 SizeToContents(); | 706 SizeToContents(); |
| 692 } | 707 } |
| 693 | 708 |
| 694 views::View* PageInfoBubbleView::CreateSiteSettingsView(int side_margin) { | 709 views::View* PageInfoBubbleView::CreateSiteSettingsView(int side_margin) { |
| 695 views::View* site_settings_view = new views::View(); | 710 views::View* site_settings_view = new views::View(); |
| 696 views::BoxLayout* box_layout = | 711 views::BoxLayout* box_layout = |
| 697 new views::BoxLayout(views::BoxLayout::kVertical, side_margin, 0, 0); | 712 new views::BoxLayout(views::BoxLayout::kVertical, side_margin, 0, 0); |
| 698 site_settings_view->SetLayoutManager(box_layout); | 713 site_settings_view->SetLayoutManager(box_layout); |
| 699 box_layout->set_cross_axis_alignment( | 714 box_layout->set_cross_axis_alignment( |
| 700 views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); | 715 views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); |
| 701 | 716 |
| 702 // Add cookies view. | 717 // Create the link and icon for the Certificate section. |
| 703 cookies_view_ = new views::View(); | 718 cookie_dialog_link_ = new views::Link( |
| 704 site_settings_view->AddChildView(cookies_view_); | 719 l10n_util::GetPluralStringFUTF16(IDS_PAGE_INFO_NUM_COOKIES, 0)); |
| 720 cookie_dialog_link_->set_id(LINK_COOKIE_DIALOG); |
| 721 cookie_dialog_link_->set_listener(this); |
| 722 |
| 723 PageInfoUI::PermissionInfo info; |
| 724 info.type = CONTENT_SETTINGS_TYPE_COOKIES; |
| 725 info.setting = CONTENT_SETTING_ALLOW; |
| 726 info.is_incognito = |
| 727 Profile::FromBrowserContext(web_contents()->GetBrowserContext()) |
| 728 ->IsOffTheRecord(); |
| 729 |
| 730 const gfx::ImageSkia icon = PageInfoUI::GetPermissionIcon(info).AsImageSkia(); |
| 731 // Add the Cookies section. |
| 732 site_settings_view->AddChildView(CreateInspectLinkSection( |
| 733 icon, IDS_PAGE_INFO_TITLE_SITE_DATA, cookie_dialog_link_)); |
| 705 | 734 |
| 706 return site_settings_view; | 735 return site_settings_view; |
| 707 } | 736 } |
| 708 | 737 |
| 709 void PageInfoBubbleView::HandleLinkClickedAsync(views::Link* source) { | 738 void PageInfoBubbleView::HandleLinkClickedAsync(views::Link* source) { |
| 710 // Both switch cases require accessing web_contents(), so we check it here. | 739 // All switch cases require accessing web_contents(), so we check it here. |
| 711 if (web_contents() == nullptr || web_contents()->IsBeingDestroyed()) | 740 if (web_contents() == nullptr || web_contents()->IsBeingDestroyed()) |
| 712 return; | 741 return; |
| 713 switch (source->id()) { | 742 switch (source->id()) { |
| 714 case LINK_SITE_SETTINGS: | 743 case LINK_SITE_SETTINGS: |
| 715 // TODO(crbug.com/655876): This opens the general Content Settings pane, | 744 // TODO(crbug.com/655876): This opens the general Content Settings pane, |
| 716 // which is OK for now. But on Android, it opens a page specific to a | 745 // which is OK for now. But on Android, it opens a page specific to a |
| 717 // given origin that shows all of the settings for that origin. If/when | 746 // given origin that shows all of the settings for that origin. If/when |
| 718 // that's available on desktop we should link to that here, too. | 747 // that's available on desktop we should link to that here, too. |
| 719 web_contents()->OpenURL(content::OpenURLParams( | 748 web_contents()->OpenURL(content::OpenURLParams( |
| 720 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), | 749 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), |
| 721 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, | 750 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
| 722 false)); | 751 false)); |
| 723 presenter_->RecordPageInfoAction( | 752 presenter_->RecordPageInfoAction( |
| 724 PageInfo::PAGE_INFO_SITE_SETTINGS_OPENED); | 753 PageInfo::PAGE_INFO_SITE_SETTINGS_OPENED); |
| 725 break; | 754 break; |
| 726 case LINK_COOKIE_DIALOG: | 755 case LINK_COOKIE_DIALOG: |
| 727 // Count how often the Collected Cookies dialog is opened. | 756 // Count how often the Collected Cookies dialog is opened. |
| 728 presenter_->RecordPageInfoAction( | 757 presenter_->RecordPageInfoAction( |
| 729 PageInfo::PAGE_INFO_COOKIES_DIALOG_OPENED); | 758 PageInfo::PAGE_INFO_COOKIES_DIALOG_OPENED); |
| 730 new CollectedCookiesViews(web_contents()); | 759 new CollectedCookiesViews(web_contents()); |
| 731 break; | 760 break; |
| 761 case LINK_CERTIFICATE_VIEWER: { |
| 762 gfx::NativeWindow top_window = web_contents()->GetTopLevelNativeWindow(); |
| 763 if (certificate_ && top_window) { |
| 764 presenter_->RecordPageInfoAction( |
| 765 PageInfo::PAGE_INFO_CERTIFICATE_DIALOG_OPENED); |
| 766 ShowCertificateViewer(web_contents(), top_window, certificate_.get()); |
| 767 } |
| 768 break; |
| 769 } |
| 732 default: | 770 default: |
| 733 NOTREACHED(); | 771 NOTREACHED(); |
| 734 } | 772 } |
| 735 } | 773 } |
| 736 | 774 |
| 737 void PageInfoBubbleView::StyledLabelLinkClicked(views::StyledLabel* label, | 775 void PageInfoBubbleView::StyledLabelLinkClicked(views::StyledLabel* label, |
| 738 const gfx::Range& range, | 776 const gfx::Range& range, |
| 739 int event_flags) { | 777 int event_flags) { |
| 740 switch (label->id()) { | 778 switch (label->id()) { |
| 741 case STYLED_LABEL_SECURITY_DETAILS: | 779 case STYLED_LABEL_SECURITY_DETAILS: |
| 742 web_contents()->OpenURL(content::OpenURLParams( | 780 web_contents()->OpenURL(content::OpenURLParams( |
| 743 GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), | 781 GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), |
| 744 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, | 782 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
| 745 false)); | 783 false)); |
| 746 presenter_->RecordPageInfoAction( | 784 presenter_->RecordPageInfoAction( |
| 747 PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); | 785 PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); |
| 748 break; | 786 break; |
| 749 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: | 787 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: |
| 750 presenter_->OnRevokeSSLErrorBypassButtonPressed(); | 788 presenter_->OnRevokeSSLErrorBypassButtonPressed(); |
| 751 GetWidget()->Close(); | 789 GetWidget()->Close(); |
| 752 break; | 790 break; |
| 753 default: | 791 default: |
| 754 NOTREACHED(); | 792 NOTREACHED(); |
| 755 } | 793 } |
| 756 } | 794 } |
| OLD | NEW |