Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc

Issue 1150173002: Remove the SCT viewer UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/website_settings/website_settings_popup_view.h " 5 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h "
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 browser_(browser), 305 browser_(browser),
306 header_(nullptr), 306 header_(nullptr),
307 tabbed_pane_(nullptr), 307 tabbed_pane_(nullptr),
308 permissions_tab_(nullptr), 308 permissions_tab_(nullptr),
309 site_data_content_(nullptr), 309 site_data_content_(nullptr),
310 cookie_dialog_link_(nullptr), 310 cookie_dialog_link_(nullptr),
311 permissions_content_(nullptr), 311 permissions_content_(nullptr),
312 connection_tab_(nullptr), 312 connection_tab_(nullptr),
313 identity_info_content_(nullptr), 313 identity_info_content_(nullptr),
314 certificate_dialog_link_(nullptr), 314 certificate_dialog_link_(nullptr),
315 signed_certificate_timestamps_link_(nullptr),
316 reset_decisions_button_(nullptr), 315 reset_decisions_button_(nullptr),
317 cert_id_(0), 316 cert_id_(0),
318 help_center_link_(nullptr), 317 help_center_link_(nullptr),
319 connection_info_content_(nullptr), 318 connection_info_content_(nullptr),
320 page_info_content_(nullptr), 319 page_info_content_(nullptr),
321 weak_factory_(this) { 320 weak_factory_(this) {
322 // Compensate for built-in vertical padding in the anchor view's image. 321 // Compensate for built-in vertical padding in the anchor view's image.
323 set_anchor_view_insets(gfx::Insets(kLocationIconVerticalMargin, 0, 322 set_anchor_view_insets(gfx::Insets(kLocationIconVerticalMargin, 0,
324 kLocationIconVerticalMargin, 0)); 323 kLocationIconVerticalMargin, 0));
325 324
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 header_->SetIdentityStatus(identity_status_text, text_color); 567 header_->SetIdentityStatus(identity_status_text, text_color);
569 568
570 // The headline and the certificate dialog link of the site's identity 569 // The headline and the certificate dialog link of the site's identity
571 // section is only displayed if the site's identity was verified. If the 570 // section is only displayed if the site's identity was verified. If the
572 // site's identity was verified, then the headline contains the organization 571 // site's identity was verified, then the headline contains the organization
573 // name from the provided certificate. If the organization name is not 572 // name from the provided certificate. If the organization name is not
574 // available than the hostname of the site is used instead. 573 // available than the hostname of the site is used instead.
575 base::string16 headline; 574 base::string16 headline;
576 if (identity_info.cert_id) { 575 if (identity_info.cert_id) {
577 cert_id_ = identity_info.cert_id; 576 cert_id_ = identity_info.cert_id;
578 signed_certificate_timestamp_ids_.assign(
579 identity_info.signed_certificate_timestamp_ids.begin(),
580 identity_info.signed_certificate_timestamp_ids.end());
581 577
582 certificate_dialog_link_ = new views::Link( 578 certificate_dialog_link_ = new views::Link(
583 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON)); 579 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON));
584 certificate_dialog_link_->set_listener(this); 580 certificate_dialog_link_->set_listener(this);
585 581
586 if (!signed_certificate_timestamp_ids_.empty()) {
587 signed_certificate_timestamps_link_ =
588 new views::Link(l10n_util::GetStringUTF16(
589 IDS_PAGEINFO_CERT_TRANSPARENCY_INFO_BUTTON));
590 signed_certificate_timestamps_link_->set_listener(this);
591 }
592
593 if (identity_info.show_ssl_decision_revoke_button) { 582 if (identity_info.show_ssl_decision_revoke_button) {
594 reset_decisions_button_ = new views::LabelButton( 583 reset_decisions_button_ = new views::LabelButton(
595 this, 584 this,
596 l10n_util::GetStringUTF16( 585 l10n_util::GetStringUTF16(
597 IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON)); 586 IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON));
598 reset_decisions_button_->SetStyle(views::Button::STYLE_BUTTON); 587 reset_decisions_button_->SetStyle(views::Button::STYLE_BUTTON);
599 } 588 }
600 589
601 headline = base::UTF8ToUTF16(identity_info.site_identity); 590 headline = base::UTF8ToUTF16(identity_info.site_identity);
602 } 591 }
603 ResetConnectionSection( 592 ResetConnectionSection(
604 identity_info_content_, 593 identity_info_content_,
605 WebsiteSettingsUI::GetIdentityIcon(identity_info.identity_status), 594 WebsiteSettingsUI::GetIdentityIcon(identity_info.identity_status),
606 base::string16(), // The identity section has no headline. 595 base::string16(), // The identity section has no headline.
607 base::UTF8ToUTF16(identity_info.identity_status_description), 596 base::UTF8ToUTF16(identity_info.identity_status_description),
608 certificate_dialog_link_, 597 certificate_dialog_link_,
609 signed_certificate_timestamps_link_,
610 reset_decisions_button_); 598 reset_decisions_button_);
611 599
612 ResetConnectionSection( 600 ResetConnectionSection(
613 connection_info_content_, 601 connection_info_content_,
614 WebsiteSettingsUI::GetConnectionIcon(identity_info.connection_status), 602 WebsiteSettingsUI::GetConnectionIcon(identity_info.connection_status),
615 base::string16(), // The connection section has no headline. 603 base::string16(), // The connection section has no headline.
616 base::UTF8ToUTF16(identity_info.connection_status_description), 604 base::UTF8ToUTF16(identity_info.connection_status_description),
617 nullptr, 605 nullptr,
618 nullptr,
619 nullptr); 606 nullptr);
620 607
621 connection_tab_->InvalidateLayout(); 608 connection_tab_->InvalidateLayout();
622 Layout(); 609 Layout();
623 SizeToContents(); 610 SizeToContents();
624 } 611 }
625 612
626 void WebsiteSettingsPopupView::SetFirstVisit( 613 void WebsiteSettingsPopupView::SetFirstVisit(
627 const base::string16& first_visit) { 614 const base::string16& first_visit) {
628 ResetConnectionSection( 615 ResetConnectionSection(
629 page_info_content_, 616 page_info_content_,
630 WebsiteSettingsUI::GetFirstVisitIcon(first_visit), 617 WebsiteSettingsUI::GetFirstVisitIcon(first_visit),
631 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE), 618 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE),
632 first_visit, 619 first_visit,
633 nullptr, 620 nullptr,
634 nullptr,
635 nullptr); 621 nullptr);
636 connection_tab_->InvalidateLayout(); 622 connection_tab_->InvalidateLayout();
637 Layout(); 623 Layout();
638 SizeToContents(); 624 SizeToContents();
639 } 625 }
640 626
641 void WebsiteSettingsPopupView::SetSelectedTab(TabId tab_id) { 627 void WebsiteSettingsPopupView::SetSelectedTab(TabId tab_id) {
642 tabbed_pane_->SelectTabAt(tab_id); 628 tabbed_pane_->SelectTabAt(tab_id);
643 } 629 }
644 630
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 layout->AddPaddingRow(1, kPermissionsSectionPaddingBottom); 725 layout->AddPaddingRow(1, kPermissionsSectionPaddingBottom);
740 return container; 726 return container;
741 } 727 }
742 728
743 void WebsiteSettingsPopupView::ResetConnectionSection( 729 void WebsiteSettingsPopupView::ResetConnectionSection(
744 views::View* section_container, 730 views::View* section_container,
745 const gfx::Image& icon, 731 const gfx::Image& icon,
746 const base::string16& headline, 732 const base::string16& headline,
747 const base::string16& text, 733 const base::string16& text,
748 views::Link* link, 734 views::Link* link,
749 views::Link* secondary_link,
750 views::LabelButton* reset_decisions_button) { 735 views::LabelButton* reset_decisions_button) {
751 section_container->RemoveAllChildViews(true); 736 section_container->RemoveAllChildViews(true);
752 737
753 views::GridLayout* layout = new views::GridLayout(section_container); 738 views::GridLayout* layout = new views::GridLayout(section_container);
754 section_container->SetLayoutManager(layout); 739 section_container->SetLayoutManager(layout);
755 views::ColumnSet* column_set = layout->AddColumnSet(0); 740 views::ColumnSet* column_set = layout->AddColumnSet(0);
756 column_set->AddPaddingColumn(0, kConnectionSectionPaddingLeft); 741 column_set->AddPaddingColumn(0, kConnectionSectionPaddingLeft);
757 column_set->AddColumn(views::GridLayout::LEADING, 742 column_set->AddColumn(views::GridLayout::LEADING,
758 views::GridLayout::LEADING, 743 views::GridLayout::LEADING,
759 0, 744 0,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 description_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 793 description_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
809 description_label->SetAllowCharacterBreak(true); 794 description_label->SetAllowCharacterBreak(true);
810 content_layout->StartRow(1, 0); 795 content_layout->StartRow(1, 0);
811 content_layout->AddView(description_label); 796 content_layout->AddView(description_label);
812 797
813 if (link) { 798 if (link) {
814 content_layout->StartRow(1, 0); 799 content_layout->StartRow(1, 0);
815 content_layout->AddView(link); 800 content_layout->AddView(link);
816 } 801 }
817 802
818 if (secondary_link) {
819 content_layout->StartRow(1, 0);
820 content_layout->AddView(secondary_link);
821 }
822
823 if (reset_decisions_button) { 803 if (reset_decisions_button) {
824 content_layout->StartRow(1, 0); 804 content_layout->StartRow(1, 0);
825 content_layout->AddView(reset_decisions_button); 805 content_layout->AddView(reset_decisions_button);
826 } 806 }
827 807
828 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, 808 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING,
829 views::GridLayout::LEADING); 809 views::GridLayout::LEADING);
830 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); 810 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom);
831 } 811 }
832 812
833 void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) { 813 void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) {
834 if (source == cookie_dialog_link_) { 814 if (source == cookie_dialog_link_) {
835 // Count how often the Collected Cookies dialog is opened. 815 // Count how often the Collected Cookies dialog is opened.
836 presenter_->RecordWebsiteSettingsAction( 816 presenter_->RecordWebsiteSettingsAction(
837 WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED); 817 WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED);
838 818
839 if (web_contents_ != NULL) 819 if (web_contents_ != NULL)
840 new CollectedCookiesViews(web_contents_); 820 new CollectedCookiesViews(web_contents_);
841 } else if (source == certificate_dialog_link_) { 821 } else if (source == certificate_dialog_link_) {
842 gfx::NativeWindow parent = GetAnchorView() ? 822 gfx::NativeWindow parent = GetAnchorView() ?
843 GetAnchorView()->GetWidget()->GetNativeWindow() : nullptr; 823 GetAnchorView()->GetWidget()->GetNativeWindow() : nullptr;
844 presenter_->RecordWebsiteSettingsAction( 824 presenter_->RecordWebsiteSettingsAction(
845 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); 825 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED);
846 ShowCertificateViewerByID(web_contents_, parent, cert_id_); 826 ShowCertificateViewerByID(web_contents_, parent, cert_id_);
847 } else if (source == signed_certificate_timestamps_link_) {
848 chrome::ShowSignedCertificateTimestampsViewer(
849 web_contents_, signed_certificate_timestamp_ids_);
850 presenter_->RecordWebsiteSettingsAction(
851 WebsiteSettings::WEBSITE_SETTINGS_TRANSPARENCY_VIEWER_OPENED);
852 } else if (source == help_center_link_) { 827 } else if (source == help_center_link_) {
853 browser_->OpenURL( 828 browser_->OpenURL(
854 content::OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL), 829 content::OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL),
855 content::Referrer(), 830 content::Referrer(),
856 NEW_FOREGROUND_TAB, 831 NEW_FOREGROUND_TAB,
857 ui::PAGE_TRANSITION_LINK, 832 ui::PAGE_TRANSITION_LINK,
858 false)); 833 false));
859 presenter_->RecordWebsiteSettingsAction( 834 presenter_->RecordWebsiteSettingsAction(
860 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); 835 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED);
861 } else if (source == site_settings_link_) { 836 } else if (source == site_settings_link_) {
862 // TODO(palmer): This opens the general Content Settings pane, which is OK 837 // TODO(palmer): This opens the general Content Settings pane, which is OK
863 // for now. But on Android, it opens a page specific to a given origin that 838 // for now. But on Android, it opens a page specific to a given origin that
864 // shows all of the settings for that origin. If/when that's available on 839 // shows all of the settings for that origin. If/when that's available on
865 // desktop we should link to that here, too. 840 // desktop we should link to that here, too.
866 browser_->OpenURL(content::OpenURLParams( 841 browser_->OpenURL(content::OpenURLParams(
867 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), 842 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(),
868 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); 843 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false));
869 presenter_->RecordWebsiteSettingsAction( 844 presenter_->RecordWebsiteSettingsAction(
870 WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); 845 WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED);
871 } else { 846 } else {
872 NOTREACHED(); 847 NOTREACHED();
873 } 848 }
874 } 849 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698