OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 // Proxy settings. | 1036 // Proxy settings. |
1037 AddWrappingLabelRow(layout, change_proxies_label_, single_column_view_set_id, | 1037 AddWrappingLabelRow(layout, change_proxies_label_, single_column_view_set_id, |
1038 true); | 1038 true); |
1039 AddLeadingControl(layout, change_proxies_button_, indented_view_set_id, | 1039 AddLeadingControl(layout, change_proxies_button_, indented_view_set_id, |
1040 false); | 1040 false); |
1041 } | 1041 } |
1042 | 1042 |
1043 void NetworkSection::NotifyPrefChanged(const std::wstring* pref_name) { | 1043 void NetworkSection::NotifyPrefChanged(const std::wstring* pref_name) { |
1044 } | 1044 } |
1045 | 1045 |
1046 //////////////////////////////////////////////////////////////////////////////// | |
1047 // DevToolsSection | |
1048 | |
1049 class DevToolsSection : public AdvancedSection, | |
1050 public views::ButtonListener { | |
1051 public: | |
1052 explicit DevToolsSection(Profile* profile); | |
1053 virtual ~DevToolsSection() {} | |
1054 | |
1055 // Overridden from views::ButtonListener: | |
1056 virtual void ButtonPressed(views::Button* sender); | |
1057 | |
1058 protected: | |
1059 // OptionsPageView overrides: | |
1060 virtual void InitControlLayout(); | |
1061 virtual void NotifyPrefChanged(const std::wstring* pref_name); | |
1062 | |
1063 private: | |
1064 // Controls for this section: | |
1065 views::Checkbox* enable_devtools_checkbox_; | |
1066 | |
1067 // Preferences for this section: | |
1068 BooleanPrefMember enable_devtools_; | |
1069 | |
1070 DISALLOW_COPY_AND_ASSIGN(DevToolsSection); | |
1071 }; | |
1072 | |
1073 DevToolsSection::DevToolsSection(Profile* profile) | |
1074 : enable_devtools_checkbox_(NULL), | |
1075 AdvancedSection(profile, | |
1076 l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_DEVTOOLS)) { | |
1077 } | |
1078 | |
1079 void DevToolsSection::ButtonPressed(views::Button* sender) { | |
1080 if (sender == enable_devtools_checkbox_) { | |
1081 bool enabled = enable_devtools_checkbox_->checked(); | |
1082 UserMetricsRecordAction(enabled ? | |
1083 L"Options_DevToolsCheckbox_Enable" : | |
1084 L"Options_DevToolsCheckbox_Disable", | |
1085 profile()->GetPrefs()); | |
1086 enable_devtools_.SetValue(enabled); | |
1087 } | |
1088 } | |
1089 | |
1090 void DevToolsSection::InitControlLayout() { | |
1091 AdvancedSection::InitControlLayout(); | |
1092 | |
1093 enable_devtools_checkbox_ = new views::Checkbox( | |
1094 l10n_util::GetString(IDS_OPTIONS_ENABLE_DEVTOOLS)); | |
1095 enable_devtools_checkbox_->set_listener(this); | |
1096 | |
1097 GridLayout* layout = new GridLayout(contents_); | |
1098 contents_->SetLayoutManager(layout); | |
1099 | |
1100 const int single_column_view_set_id = 0; | |
1101 AddWrappingColumnSet(layout, single_column_view_set_id); | |
1102 | |
1103 AddWrappingCheckboxRow(layout, enable_devtools_checkbox_, | |
1104 single_column_view_set_id, false); | |
1105 | |
1106 // Init member prefs so we can update the controls if prefs change. | |
1107 enable_devtools_.Init(prefs::kWebKitDeveloperExtrasEnabled, | |
1108 profile()->GetPrefs(), this); | |
1109 } | |
1110 | |
1111 void DevToolsSection::NotifyPrefChanged(const std::wstring* pref_name) { | |
1112 if (!pref_name || *pref_name == prefs::kWebKitDeveloperExtrasEnabled) { | |
1113 enable_devtools_checkbox_->SetChecked( | |
1114 enable_devtools_.GetValue()); | |
1115 } | |
1116 } | |
1117 | |
1118 } // namespace | 1046 } // namespace |
1119 | 1047 |
1120 //////////////////////////////////////////////////////////////////////////////// | 1048 //////////////////////////////////////////////////////////////////////////////// |
1121 // AdvancedContentsView | 1049 // AdvancedContentsView |
1122 | 1050 |
1123 class AdvancedContentsView : public OptionsPageView { | 1051 class AdvancedContentsView : public OptionsPageView { |
1124 public: | 1052 public: |
1125 explicit AdvancedContentsView(Profile* profile); | 1053 explicit AdvancedContentsView(Profile* profile); |
1126 virtual ~AdvancedContentsView(); | 1054 virtual ~AdvancedContentsView(); |
1127 | 1055 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 GridLayout::USE_PREF, 0, 0); | 1131 GridLayout::USE_PREF, 0, 0); |
1204 | 1132 |
1205 layout->StartRow(0, single_column_view_set_id); | 1133 layout->StartRow(0, single_column_view_set_id); |
1206 layout->AddView(new PrivacySection(profile())); | 1134 layout->AddView(new PrivacySection(profile())); |
1207 layout->StartRow(0, single_column_view_set_id); | 1135 layout->StartRow(0, single_column_view_set_id); |
1208 layout->AddView(new NetworkSection(profile())); | 1136 layout->AddView(new NetworkSection(profile())); |
1209 layout->StartRow(0, single_column_view_set_id); | 1137 layout->StartRow(0, single_column_view_set_id); |
1210 layout->AddView(new WebContentSection(profile())); | 1138 layout->AddView(new WebContentSection(profile())); |
1211 layout->StartRow(0, single_column_view_set_id); | 1139 layout->StartRow(0, single_column_view_set_id); |
1212 layout->AddView(new SecuritySection(profile())); | 1140 layout->AddView(new SecuritySection(profile())); |
1213 layout->StartRow(0, single_column_view_set_id); | |
1214 layout->AddView(new DevToolsSection(profile())); | |
1215 } | 1141 } |
1216 | 1142 |
1217 //////////////////////////////////////////////////////////////////////////////// | 1143 //////////////////////////////////////////////////////////////////////////////// |
1218 // AdvancedContentsView, private: | 1144 // AdvancedContentsView, private: |
1219 | 1145 |
1220 void AdvancedContentsView::InitClass() { | 1146 void AdvancedContentsView::InitClass() { |
1221 static bool initialized = false; | 1147 static bool initialized = false; |
1222 if (!initialized) { | 1148 if (!initialized) { |
1223 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 1149 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
1224 line_height_ = rb.GetFont(ResourceBundle::BaseFont).height(); | 1150 line_height_ = rb.GetFont(ResourceBundle::BaseFont).height(); |
(...skipping 20 matching lines...) Expand all Loading... |
1245 | 1171 |
1246 void AdvancedScrollViewContainer::Layout() { | 1172 void AdvancedScrollViewContainer::Layout() { |
1247 gfx::Rect lb = GetLocalBounds(false); | 1173 gfx::Rect lb = GetLocalBounds(false); |
1248 | 1174 |
1249 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( | 1175 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( |
1250 gfx::NativeTheme::LIST); | 1176 gfx::NativeTheme::LIST); |
1251 lb.Inset(border.width(), border.height()); | 1177 lb.Inset(border.width(), border.height()); |
1252 scroll_view_->SetBounds(lb); | 1178 scroll_view_->SetBounds(lb); |
1253 scroll_view_->Layout(); | 1179 scroll_view_->Layout(); |
1254 } | 1180 } |
OLD | NEW |