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/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 Loading... | |
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 Loading... | |
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_, | 598 nullptr, |
610 reset_decisions_button_); | 599 reset_decisions_button_); |
611 | 600 |
612 ResetConnectionSection( | 601 ResetConnectionSection( |
613 connection_info_content_, | 602 connection_info_content_, |
614 WebsiteSettingsUI::GetConnectionIcon(identity_info.connection_status), | 603 WebsiteSettingsUI::GetConnectionIcon(identity_info.connection_status), |
615 base::string16(), // The connection section has no headline. | 604 base::string16(), // The connection section has no headline. |
616 base::UTF8ToUTF16(identity_info.connection_status_description), | 605 base::UTF8ToUTF16(identity_info.connection_status_description), |
617 nullptr, | 606 nullptr, |
618 nullptr, | 607 nullptr, |
619 nullptr); | 608 nullptr); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 layout->AddPaddingRow(1, kPermissionsSectionPaddingBottom); | 728 layout->AddPaddingRow(1, kPermissionsSectionPaddingBottom); |
740 return container; | 729 return container; |
741 } | 730 } |
742 | 731 |
743 void WebsiteSettingsPopupView::ResetConnectionSection( | 732 void WebsiteSettingsPopupView::ResetConnectionSection( |
744 views::View* section_container, | 733 views::View* section_container, |
745 const gfx::Image& icon, | 734 const gfx::Image& icon, |
746 const base::string16& headline, | 735 const base::string16& headline, |
747 const base::string16& text, | 736 const base::string16& text, |
748 views::Link* link, | 737 views::Link* link, |
749 views::Link* secondary_link, | 738 views::Link* secondary_link, |
Peter Kasting
2015/05/26 20:16:55
This argument always seems to be null now, so I th
| |
750 views::LabelButton* reset_decisions_button) { | 739 views::LabelButton* reset_decisions_button) { |
751 section_container->RemoveAllChildViews(true); | 740 section_container->RemoveAllChildViews(true); |
752 | 741 |
753 views::GridLayout* layout = new views::GridLayout(section_container); | 742 views::GridLayout* layout = new views::GridLayout(section_container); |
754 section_container->SetLayoutManager(layout); | 743 section_container->SetLayoutManager(layout); |
755 views::ColumnSet* column_set = layout->AddColumnSet(0); | 744 views::ColumnSet* column_set = layout->AddColumnSet(0); |
756 column_set->AddPaddingColumn(0, kConnectionSectionPaddingLeft); | 745 column_set->AddPaddingColumn(0, kConnectionSectionPaddingLeft); |
757 column_set->AddColumn(views::GridLayout::LEADING, | 746 column_set->AddColumn(views::GridLayout::LEADING, |
758 views::GridLayout::LEADING, | 747 views::GridLayout::LEADING, |
759 0, | 748 0, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
837 WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED); | 826 WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED); |
838 | 827 |
839 if (web_contents_ != NULL) | 828 if (web_contents_ != NULL) |
840 new CollectedCookiesViews(web_contents_); | 829 new CollectedCookiesViews(web_contents_); |
841 } else if (source == certificate_dialog_link_) { | 830 } else if (source == certificate_dialog_link_) { |
842 gfx::NativeWindow parent = GetAnchorView() ? | 831 gfx::NativeWindow parent = GetAnchorView() ? |
843 GetAnchorView()->GetWidget()->GetNativeWindow() : nullptr; | 832 GetAnchorView()->GetWidget()->GetNativeWindow() : nullptr; |
844 presenter_->RecordWebsiteSettingsAction( | 833 presenter_->RecordWebsiteSettingsAction( |
845 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); | 834 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); |
846 ShowCertificateViewerByID(web_contents_, parent, cert_id_); | 835 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_) { | 836 } else if (source == help_center_link_) { |
853 browser_->OpenURL( | 837 browser_->OpenURL( |
854 content::OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL), | 838 content::OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL), |
855 content::Referrer(), | 839 content::Referrer(), |
856 NEW_FOREGROUND_TAB, | 840 NEW_FOREGROUND_TAB, |
857 ui::PAGE_TRANSITION_LINK, | 841 ui::PAGE_TRANSITION_LINK, |
858 false)); | 842 false)); |
859 presenter_->RecordWebsiteSettingsAction( | 843 presenter_->RecordWebsiteSettingsAction( |
860 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); | 844 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); |
861 } else if (source == site_settings_link_) { | 845 } else if (source == site_settings_link_) { |
862 // TODO(palmer): This opens the general Content Settings pane, which is OK | 846 // 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 | 847 // 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 | 848 // shows all of the settings for that origin. If/when that's available on |
865 // desktop we should link to that here, too. | 849 // desktop we should link to that here, too. |
866 browser_->OpenURL(content::OpenURLParams( | 850 browser_->OpenURL(content::OpenURLParams( |
867 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), | 851 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), |
868 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); | 852 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); |
869 presenter_->RecordWebsiteSettingsAction( | 853 presenter_->RecordWebsiteSettingsAction( |
870 WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); | 854 WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); |
871 } else { | 855 } else { |
872 NOTREACHED(); | 856 NOTREACHED(); |
873 } | 857 } |
874 } | 858 } |
OLD | NEW |