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/gtk/options/advanced_contents_gtk.h" | 5 #include "chrome/browser/gtk/options/advanced_contents_gtk.h" |
6 | 6 |
7 #include <sys/types.h> | 7 #include <sys/types.h> |
8 #include <sys/wait.h> | 8 #include <sys/wait.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 958 matching lines...) Loading... |
969 | 969 |
970 private: | 970 private: |
971 // Overridden from OptionsPageBase. | 971 // Overridden from OptionsPageBase. |
972 virtual void NotifyPrefChanged(const std::string* pref_name); | 972 virtual void NotifyPrefChanged(const std::string* pref_name); |
973 | 973 |
974 // The callback functions for the options widgets. | 974 // The callback functions for the options widgets. |
975 static void OnManageCertificatesClicked(GtkButton* button, | 975 static void OnManageCertificatesClicked(GtkButton* button, |
976 SecuritySection* section); | 976 SecuritySection* section); |
977 static void OnRevCheckingEnabledToggled(GtkToggleButton* togglebutton, | 977 static void OnRevCheckingEnabledToggled(GtkToggleButton* togglebutton, |
978 SecuritySection* section); | 978 SecuritySection* section); |
979 static void OnSSL2EnabledToggled(GtkToggleButton* togglebutton, | |
980 SecuritySection* section); | |
981 static void OnSSL3EnabledToggled(GtkToggleButton* togglebutton, | 979 static void OnSSL3EnabledToggled(GtkToggleButton* togglebutton, |
982 SecuritySection* section); | 980 SecuritySection* section); |
983 static void OnTLS1EnabledToggled(GtkToggleButton* togglebutton, | 981 static void OnTLS1EnabledToggled(GtkToggleButton* togglebutton, |
984 SecuritySection* section); | 982 SecuritySection* section); |
985 | 983 |
986 // The widget containing the options for this section. | 984 // The widget containing the options for this section. |
987 GtkWidget* page_; | 985 GtkWidget* page_; |
988 GtkWidget* rev_checking_enabled_checkbox_; | 986 GtkWidget* rev_checking_enabled_checkbox_; |
989 GtkWidget* ssl2_enabled_checkbox_; | |
990 GtkWidget* ssl3_enabled_checkbox_; | 987 GtkWidget* ssl3_enabled_checkbox_; |
991 GtkWidget* tls1_enabled_checkbox_; | 988 GtkWidget* tls1_enabled_checkbox_; |
992 | 989 |
993 // SSLConfigService prefs. | 990 // SSLConfigService prefs. |
994 BooleanPrefMember rev_checking_enabled_; | 991 BooleanPrefMember rev_checking_enabled_; |
995 BooleanPrefMember ssl2_enabled_; | |
996 BooleanPrefMember ssl3_enabled_; | 992 BooleanPrefMember ssl3_enabled_; |
997 BooleanPrefMember tls1_enabled_; | 993 BooleanPrefMember tls1_enabled_; |
998 | 994 |
999 // Flag to ignore gtk callbacks while we are loading prefs, to avoid | 995 // Flag to ignore gtk callbacks while we are loading prefs, to avoid |
1000 // then turning around and saving them again. | 996 // then turning around and saving them again. |
1001 bool pref_changing_; | 997 bool pref_changing_; |
1002 | 998 |
1003 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; | 999 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; |
1004 | 1000 |
1005 DISALLOW_COPY_AND_ASSIGN(SecuritySection); | 1001 DISALLOW_COPY_AND_ASSIGN(SecuritySection); |
(...skipping 28 matching lines...) Loading... |
1034 G_CALLBACK(OnManageCertificatesClicked), this); | 1030 G_CALLBACK(OnManageCertificatesClicked), this); |
1035 | 1031 |
1036 // TODO(mattm): should have a description label here and have the checkboxes | 1032 // TODO(mattm): should have a description label here and have the checkboxes |
1037 // indented, but IDS_OPTIONS_SSL_GROUP_DESCRIPTION isn't appropriate and | 1033 // indented, but IDS_OPTIONS_SSL_GROUP_DESCRIPTION isn't appropriate and |
1038 // didn't think of adding a Linux specific one before the string freeze. | 1034 // didn't think of adding a Linux specific one before the string freeze. |
1039 rev_checking_enabled_checkbox_ = AddCheckButtonWithWrappedLabel( | 1035 rev_checking_enabled_checkbox_ = AddCheckButtonWithWrappedLabel( |
1040 IDS_OPTIONS_SSL_CHECKREVOCATION, page_, | 1036 IDS_OPTIONS_SSL_CHECKREVOCATION, page_, |
1041 G_CALLBACK(OnRevCheckingEnabledToggled), this); | 1037 G_CALLBACK(OnRevCheckingEnabledToggled), this); |
1042 accessible_widget_helper_->SetWidgetName( | 1038 accessible_widget_helper_->SetWidgetName( |
1043 rev_checking_enabled_checkbox_, IDS_OPTIONS_SSL_CHECKREVOCATION); | 1039 rev_checking_enabled_checkbox_, IDS_OPTIONS_SSL_CHECKREVOCATION); |
1044 ssl2_enabled_checkbox_ = AddCheckButtonWithWrappedLabel( | |
1045 IDS_OPTIONS_SSL_USESSL2, page_, G_CALLBACK(OnSSL2EnabledToggled), this); | |
1046 accessible_widget_helper_->SetWidgetName( | |
1047 ssl2_enabled_checkbox_, IDS_OPTIONS_SSL_USESSL2); | |
1048 ssl3_enabled_checkbox_ = AddCheckButtonWithWrappedLabel( | 1040 ssl3_enabled_checkbox_ = AddCheckButtonWithWrappedLabel( |
1049 IDS_OPTIONS_SSL_USESSL3, page_, G_CALLBACK(OnSSL3EnabledToggled), this); | 1041 IDS_OPTIONS_SSL_USESSL3, page_, G_CALLBACK(OnSSL3EnabledToggled), this); |
1050 accessible_widget_helper_->SetWidgetName( | 1042 accessible_widget_helper_->SetWidgetName( |
1051 ssl3_enabled_checkbox_, IDS_OPTIONS_SSL_USESSL3); | 1043 ssl3_enabled_checkbox_, IDS_OPTIONS_SSL_USESSL3); |
1052 tls1_enabled_checkbox_ = AddCheckButtonWithWrappedLabel( | 1044 tls1_enabled_checkbox_ = AddCheckButtonWithWrappedLabel( |
1053 IDS_OPTIONS_SSL_USETLS1, page_, G_CALLBACK(OnTLS1EnabledToggled), this); | 1045 IDS_OPTIONS_SSL_USETLS1, page_, G_CALLBACK(OnTLS1EnabledToggled), this); |
1054 accessible_widget_helper_->SetWidgetName( | 1046 accessible_widget_helper_->SetWidgetName( |
1055 tls1_enabled_checkbox_, IDS_OPTIONS_SSL_USETLS1); | 1047 tls1_enabled_checkbox_, IDS_OPTIONS_SSL_USETLS1); |
1056 | 1048 |
1057 rev_checking_enabled_.Init(prefs::kCertRevocationCheckingEnabled, | 1049 rev_checking_enabled_.Init(prefs::kCertRevocationCheckingEnabled, |
1058 profile->GetPrefs(), this); | 1050 profile->GetPrefs(), this); |
1059 ssl2_enabled_.Init(prefs::kSSL2Enabled, profile->GetPrefs(), this); | |
1060 ssl3_enabled_.Init(prefs::kSSL3Enabled, profile->GetPrefs(), this); | 1051 ssl3_enabled_.Init(prefs::kSSL3Enabled, profile->GetPrefs(), this); |
1061 tls1_enabled_.Init(prefs::kTLS1Enabled, profile->GetPrefs(), this); | 1052 tls1_enabled_.Init(prefs::kTLS1Enabled, profile->GetPrefs(), this); |
1062 | 1053 |
1063 NotifyPrefChanged(NULL); | 1054 NotifyPrefChanged(NULL); |
1064 } | 1055 } |
1065 | 1056 |
1066 void SecuritySection::NotifyPrefChanged(const std::string* pref_name) { | 1057 void SecuritySection::NotifyPrefChanged(const std::string* pref_name) { |
1067 pref_changing_ = true; | 1058 pref_changing_ = true; |
1068 if (!pref_name || *pref_name == prefs::kCertRevocationCheckingEnabled) { | 1059 if (!pref_name || *pref_name == prefs::kCertRevocationCheckingEnabled) { |
1069 gtk_toggle_button_set_active( | 1060 gtk_toggle_button_set_active( |
1070 GTK_TOGGLE_BUTTON(rev_checking_enabled_checkbox_), | 1061 GTK_TOGGLE_BUTTON(rev_checking_enabled_checkbox_), |
1071 rev_checking_enabled_.GetValue()); | 1062 rev_checking_enabled_.GetValue()); |
1072 } | 1063 } |
1073 if (!pref_name || *pref_name == prefs::kSSL2Enabled) { | |
1074 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ssl2_enabled_checkbox_), | |
1075 ssl2_enabled_.GetValue()); | |
1076 } | |
1077 if (!pref_name || *pref_name == prefs::kSSL3Enabled) { | 1064 if (!pref_name || *pref_name == prefs::kSSL3Enabled) { |
1078 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ssl3_enabled_checkbox_), | 1065 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ssl3_enabled_checkbox_), |
1079 ssl3_enabled_.GetValue()); | 1066 ssl3_enabled_.GetValue()); |
1080 } | 1067 } |
1081 if (!pref_name || *pref_name == prefs::kTLS1Enabled) { | 1068 if (!pref_name || *pref_name == prefs::kTLS1Enabled) { |
1082 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tls1_enabled_checkbox_), | 1069 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tls1_enabled_checkbox_), |
1083 tls1_enabled_.GetValue()); | 1070 tls1_enabled_.GetValue()); |
1084 } | 1071 } |
1085 pref_changing_ = false; | 1072 pref_changing_ = false; |
1086 } | 1073 } |
(...skipping 19 matching lines...) Loading... |
1106 NULL); | 1093 NULL); |
1107 } else { | 1094 } else { |
1108 section->UserMetricsRecordAction( | 1095 section->UserMetricsRecordAction( |
1109 UserMetricsAction("Options_CheckCertRevocation_Disable"), | 1096 UserMetricsAction("Options_CheckCertRevocation_Disable"), |
1110 NULL); | 1097 NULL); |
1111 } | 1098 } |
1112 section->rev_checking_enabled_.SetValue(enabled); | 1099 section->rev_checking_enabled_.SetValue(enabled); |
1113 } | 1100 } |
1114 | 1101 |
1115 // static | 1102 // static |
1116 void SecuritySection::OnSSL2EnabledToggled(GtkToggleButton* togglebutton, | |
1117 SecuritySection* section) { | |
1118 if (section->pref_changing_) | |
1119 return; | |
1120 | |
1121 bool enabled = gtk_toggle_button_get_active(togglebutton); | |
1122 if (enabled) { | |
1123 section->UserMetricsRecordAction(UserMetricsAction("Options_SSL2_Enable"), | |
1124 NULL); | |
1125 } else { | |
1126 section->UserMetricsRecordAction(UserMetricsAction("Options_SSL2_Disable"), | |
1127 NULL); | |
1128 } | |
1129 section->ssl2_enabled_.SetValue(enabled); | |
1130 } | |
1131 | |
1132 // static | |
1133 void SecuritySection::OnSSL3EnabledToggled(GtkToggleButton* togglebutton, | 1103 void SecuritySection::OnSSL3EnabledToggled(GtkToggleButton* togglebutton, |
1134 SecuritySection* section) { | 1104 SecuritySection* section) { |
1135 if (section->pref_changing_) | 1105 if (section->pref_changing_) |
1136 return; | 1106 return; |
1137 | 1107 |
1138 bool enabled = gtk_toggle_button_get_active(togglebutton); | 1108 bool enabled = gtk_toggle_button_get_active(togglebutton); |
1139 if (enabled) { | 1109 if (enabled) { |
1140 section->UserMetricsRecordAction(UserMetricsAction("Options_SSL3_Enable"), | 1110 section->UserMetricsRecordAction(UserMetricsAction("Options_SSL3_Enable"), |
1141 NULL); | 1111 NULL); |
1142 } else { | 1112 } else { |
(...skipping 118 matching lines...) Loading... |
1261 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT), | 1231 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT), |
1262 web_content_section_->get_page_widget(), false); | 1232 web_content_section_->get_page_widget(), false); |
1263 | 1233 |
1264 security_section_.reset(new SecuritySection(profile_)); | 1234 security_section_.reset(new SecuritySection(profile_)); |
1265 options_builder->AddOptionGroup( | 1235 options_builder->AddOptionGroup( |
1266 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY), | 1236 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY), |
1267 security_section_->get_page_widget(), false); | 1237 security_section_->get_page_widget(), false); |
1268 | 1238 |
1269 page_ = options_builder->get_page_widget(); | 1239 page_ = options_builder->get_page_widget(); |
1270 } | 1240 } |
OLD | NEW |