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/dom_ui/advanced_options_handler.h" | 5 #include "chrome/browser/dom_ui/advanced_options_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
25 #include "grit/locale_settings.h" | 25 #include "grit/locale_settings.h" |
26 | 26 |
27 #if !defined(OS_CHROMEOS) | 27 #if !defined(OS_CHROMEOS) |
28 #include "chrome/browser/dom_ui/advanced_options_utils.h" | 28 #include "chrome/browser/dom_ui/advanced_options_utils.h" |
29 #endif | 29 #endif |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 32 #include "chrome/browser/gears_integration.h" |
32 #include "net/base/ssl_config_service_win.h" | 33 #include "net/base/ssl_config_service_win.h" |
33 #endif | 34 #endif |
34 | 35 |
35 AdvancedOptionsHandler::AdvancedOptionsHandler() { | 36 AdvancedOptionsHandler::AdvancedOptionsHandler() { |
36 } | 37 } |
37 | 38 |
38 AdvancedOptionsHandler::~AdvancedOptionsHandler() { | 39 AdvancedOptionsHandler::~AdvancedOptionsHandler() { |
39 } | 40 } |
40 | 41 |
41 void AdvancedOptionsHandler::GetLocalizedValues( | 42 void AdvancedOptionsHandler::GetLocalizedValues( |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 NewCallback(this, | 170 NewCallback(this, |
170 &AdvancedOptionsHandler::ShowManageSSLCertificates)); | 171 &AdvancedOptionsHandler::ShowManageSSLCertificates)); |
171 dom_ui_->RegisterMessageCallback("showNetworkProxySettings", | 172 dom_ui_->RegisterMessageCallback("showNetworkProxySettings", |
172 NewCallback(this, | 173 NewCallback(this, |
173 &AdvancedOptionsHandler::ShowNetworkProxySettings)); | 174 &AdvancedOptionsHandler::ShowNetworkProxySettings)); |
174 #endif | 175 #endif |
175 | 176 |
176 #if defined(OS_WIN) | 177 #if defined(OS_WIN) |
177 // Setup Windows specific callbacks. | 178 // Setup Windows specific callbacks. |
178 dom_ui_->RegisterMessageCallback("checkRevocationCheckboxAction", | 179 dom_ui_->RegisterMessageCallback("checkRevocationCheckboxAction", |
179 NewCallback(this, | 180 NewCallback(this, |
180 &AdvancedOptionsHandler::HandleCheckRevocationCheckbox)); | 181 &AdvancedOptionsHandler::HandleCheckRevocationCheckbox)); |
181 dom_ui_->RegisterMessageCallback("useSSL2CheckboxAction", | 182 dom_ui_->RegisterMessageCallback("useSSL2CheckboxAction", |
182 NewCallback(this, | 183 NewCallback(this, |
183 &AdvancedOptionsHandler::HandleUseSSL2Checkbox)); | 184 &AdvancedOptionsHandler::HandleUseSSL2Checkbox)); |
| 185 dom_ui_->RegisterMessageCallback("showGearsSettings", |
| 186 NewCallback(this, |
| 187 &AdvancedOptionsHandler::HandleShowGearsSettings)); |
184 #endif | 188 #endif |
185 } | 189 } |
186 | 190 |
187 void AdvancedOptionsHandler::Observe(NotificationType type, | 191 void AdvancedOptionsHandler::Observe(NotificationType type, |
188 const NotificationSource& source, | 192 const NotificationSource& source, |
189 const NotificationDetails& details) { | 193 const NotificationDetails& details) { |
190 if (type == NotificationType::PREF_CHANGED) { | 194 if (type == NotificationType::PREF_CHANGED) { |
191 std::string* pref_name = Details<std::string>(details).ptr(); | 195 std::string* pref_name = Details<std::string>(details).ptr(); |
192 if (*pref_name == prefs::kDownloadDefaultDirectory) { | 196 if (*pref_name == prefs::kDownloadDefaultDirectory) { |
193 SetupDownloadLocationPath(); | 197 SetupDownloadLocationPath(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 void AdvancedOptionsHandler::HandleCheckRevocationCheckbox( | 229 void AdvancedOptionsHandler::HandleCheckRevocationCheckbox( |
226 const ListValue* args) { | 230 const ListValue* args) { |
227 std::string checked_str = WideToUTF8(ExtractStringValue(args)); | 231 std::string checked_str = WideToUTF8(ExtractStringValue(args)); |
228 net::SSLConfigServiceWin::SetRevCheckingEnabled(checked_str == "true"); | 232 net::SSLConfigServiceWin::SetRevCheckingEnabled(checked_str == "true"); |
229 } | 233 } |
230 | 234 |
231 void AdvancedOptionsHandler::HandleUseSSL2Checkbox(const ListValue* args) { | 235 void AdvancedOptionsHandler::HandleUseSSL2Checkbox(const ListValue* args) { |
232 std::string checked_str = WideToUTF8(ExtractStringValue(args)); | 236 std::string checked_str = WideToUTF8(ExtractStringValue(args)); |
233 net::SSLConfigServiceWin::SetSSL2Enabled(checked_str == "true"); | 237 net::SSLConfigServiceWin::SetSSL2Enabled(checked_str == "true"); |
234 } | 238 } |
| 239 |
| 240 void AdvancedOptionsHandler::HandleShowGearsSettings(const ListValue* args) { |
| 241 UserMetricsRecordAction(UserMetricsAction("Options_GearsSettings"), NULL); |
| 242 GearsSettingsPressed( |
| 243 dom_ui_->tab_contents()->view()->GetTopLevelNativeWindow()); |
| 244 } |
235 #endif | 245 #endif |
236 | 246 |
237 #if !defined(OS_CHROMEOS) | 247 #if !defined(OS_CHROMEOS) |
238 void AdvancedOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { | 248 void AdvancedOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { |
239 UserMetricsRecordAction(UserMetricsAction("Options_ShowProxySettings"), NULL); | 249 UserMetricsRecordAction(UserMetricsAction("Options_ShowProxySettings"), NULL); |
240 DCHECK(dom_ui_); | 250 DCHECK(dom_ui_); |
241 AdvancedOptionsUtilities::ShowNetworkProxySettings(dom_ui_->tab_contents()); | 251 AdvancedOptionsUtilities::ShowNetworkProxySettings(dom_ui_->tab_contents()); |
242 } | 252 } |
243 | 253 |
244 void AdvancedOptionsHandler::ShowManageSSLCertificates(const ListValue* args) { | 254 void AdvancedOptionsHandler::ShowManageSSLCertificates(const ListValue* args) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 298 } |
289 FundamentalValue checkRevocationValue(checkRevocationSetting); | 299 FundamentalValue checkRevocationValue(checkRevocationSetting); |
290 dom_ui_->CallJavascriptFunction( | 300 dom_ui_->CallJavascriptFunction( |
291 L"options.AdvancedOptions.SetCheckRevocationCheckboxState", | 301 L"options.AdvancedOptions.SetCheckRevocationCheckboxState", |
292 checkRevocationValue); | 302 checkRevocationValue); |
293 FundamentalValue useSSLValue(useSSLSetting); | 303 FundamentalValue useSSLValue(useSSLSetting); |
294 dom_ui_->CallJavascriptFunction( | 304 dom_ui_->CallJavascriptFunction( |
295 L"options.AdvancedOptions.SetUseSSL2CheckboxStatechecked", useSSLValue); | 305 L"options.AdvancedOptions.SetUseSSL2CheckboxStatechecked", useSSLValue); |
296 } | 306 } |
297 #endif | 307 #endif |
OLD | NEW |