OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/options/advanced_contents_view.h" | 5 #include "chrome/browser/views/options/advanced_contents_view.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <cryptuiapi.h> | 9 #include <cryptuiapi.h> |
10 #pragma comment(lib, "cryptui.lib") | 10 #pragma comment(lib, "cryptui.lib") |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 783 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
784 | 784 |
785 protected: | 785 protected: |
786 // OptionsPageView overrides: | 786 // OptionsPageView overrides: |
787 virtual void InitControlLayout(); | 787 virtual void InitControlLayout(); |
788 virtual void NotifyPrefChanged(const std::string* pref_name); | 788 virtual void NotifyPrefChanged(const std::string* pref_name); |
789 | 789 |
790 private: | 790 private: |
791 // Controls for this section: | 791 // Controls for this section: |
792 views::Label* ssl_info_label_; | 792 views::Label* ssl_info_label_; |
793 views::Checkbox* enable_ssl2_checkbox_; | |
794 views::Checkbox* enable_ssl3_checkbox_; | 793 views::Checkbox* enable_ssl3_checkbox_; |
795 views::Checkbox* enable_tls1_checkbox_; | 794 views::Checkbox* enable_tls1_checkbox_; |
796 views::Checkbox* check_for_cert_revocation_checkbox_; | 795 views::Checkbox* check_for_cert_revocation_checkbox_; |
797 views::Label* manage_certificates_label_; | 796 views::Label* manage_certificates_label_; |
798 views::NativeButton* manage_certificates_button_; | 797 views::NativeButton* manage_certificates_button_; |
799 | 798 |
800 DISALLOW_COPY_AND_ASSIGN(SecuritySection); | 799 DISALLOW_COPY_AND_ASSIGN(SecuritySection); |
801 }; | 800 }; |
802 | 801 |
803 SecuritySection::SecuritySection(Profile* profile) | 802 SecuritySection::SecuritySection(Profile* profile) |
804 : ssl_info_label_(NULL), | 803 : ssl_info_label_(NULL), |
805 enable_ssl2_checkbox_(NULL), | |
806 enable_ssl3_checkbox_(NULL), | 804 enable_ssl3_checkbox_(NULL), |
807 enable_tls1_checkbox_(NULL), | 805 enable_tls1_checkbox_(NULL), |
808 check_for_cert_revocation_checkbox_(NULL), | 806 check_for_cert_revocation_checkbox_(NULL), |
809 manage_certificates_label_(NULL), | 807 manage_certificates_label_(NULL), |
810 manage_certificates_button_(NULL), | 808 manage_certificates_button_(NULL), |
811 AdvancedSection(profile, | 809 AdvancedSection(profile, |
812 l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY)) { | 810 l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY)) { |
813 } | 811 } |
814 | 812 |
815 void SecuritySection::ButtonPressed( | 813 void SecuritySection::ButtonPressed( |
816 views::Button* sender, const views::Event& event) { | 814 views::Button* sender, const views::Event& event) { |
817 if (sender == enable_ssl2_checkbox_) { | 815 if (sender == enable_ssl3_checkbox_) { |
818 bool enabled = enable_ssl2_checkbox_->checked(); | |
819 if (enabled) { | |
820 UserMetricsRecordAction(UserMetricsAction("Options_SSL2_Enable"), NULL); | |
821 } else { | |
822 UserMetricsRecordAction(UserMetricsAction("Options_SSL2_Disable"), NULL); | |
823 } | |
824 net::SSLConfigServiceWin::SetSSL2Enabled(enabled); | |
825 } else if (sender == enable_ssl3_checkbox_) { | |
826 bool enabled = enable_ssl3_checkbox_->checked(); | 816 bool enabled = enable_ssl3_checkbox_->checked(); |
827 if (enabled) { | 817 if (enabled) { |
828 UserMetricsRecordAction(UserMetricsAction("Options_SSL3_Enable"), NULL); | 818 UserMetricsRecordAction(UserMetricsAction("Options_SSL3_Enable"), NULL); |
829 } else { | 819 } else { |
830 UserMetricsRecordAction(UserMetricsAction("Options_SSL3_Disable"), NULL); | 820 UserMetricsRecordAction(UserMetricsAction("Options_SSL3_Disable"), NULL); |
831 } | 821 } |
832 net::SSLConfigServiceWin::SetSSL3Enabled(enabled); | 822 net::SSLConfigServiceWin::SetSSL3Enabled(enabled); |
833 } else if (sender == enable_tls1_checkbox_) { | 823 } else if (sender == enable_tls1_checkbox_) { |
834 bool enabled = enable_tls1_checkbox_->checked(); | 824 bool enabled = enable_tls1_checkbox_->checked(); |
835 if (enabled) { | 825 if (enabled) { |
(...skipping 19 matching lines...) Expand all Loading... |
855 cert_mgr.hwndParent = GetWindow()->GetNativeWindow(); | 845 cert_mgr.hwndParent = GetWindow()->GetNativeWindow(); |
856 ::CryptUIDlgCertMgr(&cert_mgr); | 846 ::CryptUIDlgCertMgr(&cert_mgr); |
857 } | 847 } |
858 } | 848 } |
859 | 849 |
860 void SecuritySection::InitControlLayout() { | 850 void SecuritySection::InitControlLayout() { |
861 AdvancedSection::InitControlLayout(); | 851 AdvancedSection::InitControlLayout(); |
862 | 852 |
863 ssl_info_label_ = new views::Label( | 853 ssl_info_label_ = new views::Label( |
864 l10n_util::GetString(IDS_OPTIONS_SSL_GROUP_DESCRIPTION)); | 854 l10n_util::GetString(IDS_OPTIONS_SSL_GROUP_DESCRIPTION)); |
865 enable_ssl2_checkbox_ = new views::Checkbox( | |
866 l10n_util::GetString(IDS_OPTIONS_SSL_USESSL2)); | |
867 enable_ssl2_checkbox_->set_listener(this); | |
868 enable_ssl3_checkbox_ = new views::Checkbox( | 855 enable_ssl3_checkbox_ = new views::Checkbox( |
869 l10n_util::GetString(IDS_OPTIONS_SSL_USESSL3)); | 856 l10n_util::GetString(IDS_OPTIONS_SSL_USESSL3)); |
870 enable_ssl3_checkbox_->set_listener(this); | 857 enable_ssl3_checkbox_->set_listener(this); |
871 enable_tls1_checkbox_ = new views::Checkbox( | 858 enable_tls1_checkbox_ = new views::Checkbox( |
872 l10n_util::GetString(IDS_OPTIONS_SSL_USETLS1)); | 859 l10n_util::GetString(IDS_OPTIONS_SSL_USETLS1)); |
873 enable_tls1_checkbox_->set_listener(this); | 860 enable_tls1_checkbox_->set_listener(this); |
874 check_for_cert_revocation_checkbox_ = new views::Checkbox( | 861 check_for_cert_revocation_checkbox_ = new views::Checkbox( |
875 l10n_util::GetString(IDS_OPTIONS_SSL_CHECKREVOCATION)); | 862 l10n_util::GetString(IDS_OPTIONS_SSL_CHECKREVOCATION)); |
876 check_for_cert_revocation_checkbox_->set_listener(this); | 863 check_for_cert_revocation_checkbox_->set_listener(this); |
877 manage_certificates_label_ = new views::Label( | 864 manage_certificates_label_ = new views::Label( |
(...skipping 15 matching lines...) Expand all Loading... |
893 const int indented_view_set_id = 4; | 880 const int indented_view_set_id = 4; |
894 AddIndentedColumnSet(layout, indented_view_set_id); | 881 AddIndentedColumnSet(layout, indented_view_set_id); |
895 | 882 |
896 // SSL connection controls and Certificates. | 883 // SSL connection controls and Certificates. |
897 AddWrappingLabelRow(layout, manage_certificates_label_, | 884 AddWrappingLabelRow(layout, manage_certificates_label_, |
898 single_column_view_set_id, true); | 885 single_column_view_set_id, true); |
899 AddLeadingControl(layout, manage_certificates_button_, | 886 AddLeadingControl(layout, manage_certificates_button_, |
900 indented_column_set_id, false); | 887 indented_column_set_id, false); |
901 AddWrappingLabelRow(layout, ssl_info_label_, single_column_view_set_id, | 888 AddWrappingLabelRow(layout, ssl_info_label_, single_column_view_set_id, |
902 true); | 889 true); |
903 AddWrappingCheckboxRow(layout, enable_ssl2_checkbox_, | |
904 indented_column_set_id, true); | |
905 AddWrappingCheckboxRow(layout, enable_ssl3_checkbox_, | 890 AddWrappingCheckboxRow(layout, enable_ssl3_checkbox_, |
906 indented_column_set_id, true); | 891 indented_column_set_id, true); |
907 AddWrappingCheckboxRow(layout, enable_tls1_checkbox_, | 892 AddWrappingCheckboxRow(layout, enable_tls1_checkbox_, |
908 indented_column_set_id, true); | 893 indented_column_set_id, true); |
909 AddWrappingCheckboxRow(layout, check_for_cert_revocation_checkbox_, | 894 AddWrappingCheckboxRow(layout, check_for_cert_revocation_checkbox_, |
910 indented_column_set_id, false); | 895 indented_column_set_id, false); |
911 } | 896 } |
912 | 897 |
913 // This method is called with a null pref_name when the dialog is initialized. | 898 // This method is called with a null pref_name when the dialog is initialized. |
914 void SecuritySection::NotifyPrefChanged(const std::string* pref_name) { | 899 void SecuritySection::NotifyPrefChanged(const std::string* pref_name) { |
915 // These SSL options are system settings and stored in the OS. | 900 // These SSL options are system settings and stored in the OS. |
916 if (!pref_name) { | 901 if (!pref_name) { |
917 net::SSLConfig config; | 902 net::SSLConfig config; |
918 if (net::SSLConfigServiceWin::GetSSLConfigNow(&config)) { | 903 if (net::SSLConfigServiceWin::GetSSLConfigNow(&config)) { |
919 enable_ssl2_checkbox_->SetChecked(config.ssl2_enabled); | |
920 enable_ssl3_checkbox_->SetChecked(config.ssl3_enabled); | 904 enable_ssl3_checkbox_->SetChecked(config.ssl3_enabled); |
921 enable_tls1_checkbox_->SetChecked(config.tls1_enabled); | 905 enable_tls1_checkbox_->SetChecked(config.tls1_enabled); |
922 check_for_cert_revocation_checkbox_->SetChecked( | 906 check_for_cert_revocation_checkbox_->SetChecked( |
923 config.rev_checking_enabled); | 907 config.rev_checking_enabled); |
924 } else { | 908 } else { |
925 enable_ssl2_checkbox_->SetEnabled(false); | |
926 enable_ssl3_checkbox_->SetEnabled(false); | 909 enable_ssl3_checkbox_->SetEnabled(false); |
927 enable_tls1_checkbox_->SetEnabled(false); | 910 enable_tls1_checkbox_->SetEnabled(false); |
928 check_for_cert_revocation_checkbox_->SetEnabled(false); | 911 check_for_cert_revocation_checkbox_->SetEnabled(false); |
929 } | 912 } |
930 } | 913 } |
931 } | 914 } |
932 | 915 |
933 //////////////////////////////////////////////////////////////////////////////// | 916 //////////////////////////////////////////////////////////////////////////////// |
934 // NetworkSection | 917 // NetworkSection |
935 | 918 |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 // AdvancedScrollViewContainer, views::View overrides: | 1610 // AdvancedScrollViewContainer, views::View overrides: |
1628 | 1611 |
1629 void AdvancedScrollViewContainer::Layout() { | 1612 void AdvancedScrollViewContainer::Layout() { |
1630 gfx::Rect lb = GetLocalBounds(false); | 1613 gfx::Rect lb = GetLocalBounds(false); |
1631 | 1614 |
1632 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( | 1615 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( |
1633 gfx::NativeTheme::LIST); | 1616 gfx::NativeTheme::LIST); |
1634 lb.Inset(border.width(), border.height()); | 1617 lb.Inset(border.width(), border.height()); |
1635 scroll_view_->SetBounds(lb); | 1618 scroll_view_->SetBounds(lb); |
1636 } | 1619 } |
OLD | NEW |