| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 select_folder_dialog_->SelectFile( | 211 select_folder_dialog_->SelectFile( |
| 212 SelectFileDialog::SELECT_FOLDER, | 212 SelectFileDialog::SELECT_FOLDER, |
| 213 l10n_util::GetStringUTF16(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE), | 213 l10n_util::GetStringUTF16(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE), |
| 214 pref_service->GetFilePath(prefs::kDownloadDefaultDirectory), | 214 pref_service->GetFilePath(prefs::kDownloadDefaultDirectory), |
| 215 NULL, 0, FILE_PATH_LITERAL(""), | 215 NULL, 0, FILE_PATH_LITERAL(""), |
| 216 dom_ui_->tab_contents()->view()->GetTopLevelNativeWindow(), NULL); | 216 dom_ui_->tab_contents()->view()->GetTopLevelNativeWindow(), NULL); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void AdvancedOptionsHandler::FileSelected(const FilePath& path, int index, | 219 void AdvancedOptionsHandler::FileSelected(const FilePath& path, int index, |
| 220 void* params) { | 220 void* params) { |
| 221 UserMetricsRecordAction(UserMetricsAction("Options_SetDownloadDirectory"), | |
| 222 NULL); | |
| 223 default_download_location_.SetValue(path); | 221 default_download_location_.SetValue(path); |
| 224 SetupDownloadLocationPath(); | 222 SetupDownloadLocationPath(); |
| 225 } | 223 } |
| 226 | 224 |
| 227 void AdvancedOptionsHandler::HandleAutoOpenButton(const ListValue* args) { | 225 void AdvancedOptionsHandler::HandleAutoOpenButton(const ListValue* args) { |
| 228 UserMetricsRecordAction(UserMetricsAction("Options_ResetAutoOpenFiles"), | |
| 229 NULL); | |
| 230 DCHECK(dom_ui_); | 226 DCHECK(dom_ui_); |
| 231 DownloadManager* manager = dom_ui_->GetProfile()->GetDownloadManager(); | 227 DownloadManager* manager = dom_ui_->GetProfile()->GetDownloadManager(); |
| 232 if (manager) manager->ResetAutoOpenFiles(); | 228 if (manager) manager->ResetAutoOpenFiles(); |
| 233 } | 229 } |
| 234 | 230 |
| 235 #if defined(OS_WIN) | 231 #if defined(OS_WIN) |
| 236 void AdvancedOptionsHandler::HandleCheckRevocationCheckbox( | 232 void AdvancedOptionsHandler::HandleCheckRevocationCheckbox( |
| 237 const ListValue* args) { | 233 const ListValue* args) { |
| 238 UserMetricsRecordAction(UserMetricsAction(metric.c_str()), NULL); | |
| 239 std::string checked_str = WideToUTF8(ExtractStringValue(args)); | 234 std::string checked_str = WideToUTF8(ExtractStringValue(args)); |
| 240 std::string metric = | |
| 241 (checked_str == "true" ? "Options_CheckCertRevocation_Enable" | |
| 242 : "Options_CheckCertRevocation_Disable"); | |
| 243 net::SSLConfigServiceWin::SetRevCheckingEnabled(checked_str == "true"); | 235 net::SSLConfigServiceWin::SetRevCheckingEnabled(checked_str == "true"); |
| 244 } | 236 } |
| 245 | 237 |
| 246 void AdvancedOptionsHandler::HandleUseSSL2Checkbox(const ListValue* args) { | 238 void AdvancedOptionsHandler::HandleUseSSL2Checkbox(const ListValue* args) { |
| 247 UserMetricsRecordAction(UserMetricsAction(metric.c_str()), NULL); | |
| 248 std::string checked_str = WideToUTF8(ExtractStringValue(args)); | 239 std::string checked_str = WideToUTF8(ExtractStringValue(args)); |
| 249 std::string metric = | |
| 250 (checked_str == "true" ? "Options_SSL2_Enable" | |
| 251 : "Options_SSL2_Disable"); | |
| 252 net::SSLConfigServiceWin::SetSSL2Enabled(checked_str == "true"); | 240 net::SSLConfigServiceWin::SetSSL2Enabled(checked_str == "true"); |
| 253 } | 241 } |
| 254 | 242 |
| 255 void AdvancedOptionsHandler::HandleShowGearsSettings(const ListValue* args) { | 243 void AdvancedOptionsHandler::HandleShowGearsSettings(const ListValue* args) { |
| 256 UserMetricsRecordAction(UserMetricsAction("Options_GearsSettings"), NULL); | 244 UserMetricsRecordAction(UserMetricsAction("Options_GearsSettings"), NULL); |
| 257 GearsSettingsPressed( | 245 GearsSettingsPressed( |
| 258 dom_ui_->tab_contents()->view()->GetTopLevelNativeWindow()); | 246 dom_ui_->tab_contents()->view()->GetTopLevelNativeWindow()); |
| 259 } | 247 } |
| 260 #endif | 248 #endif |
| 261 | 249 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 318 } |
| 331 FundamentalValue checkRevocationValue(checkRevocationSetting); | 319 FundamentalValue checkRevocationValue(checkRevocationSetting); |
| 332 dom_ui_->CallJavascriptFunction( | 320 dom_ui_->CallJavascriptFunction( |
| 333 L"options.AdvancedOptions.SetCheckRevocationCheckboxState", | 321 L"options.AdvancedOptions.SetCheckRevocationCheckboxState", |
| 334 checkRevocationValue); | 322 checkRevocationValue); |
| 335 FundamentalValue useSSLValue(useSSLSetting); | 323 FundamentalValue useSSLValue(useSSLSetting); |
| 336 dom_ui_->CallJavascriptFunction( | 324 dom_ui_->CallJavascriptFunction( |
| 337 L"options.AdvancedOptions.SetUseSSL2CheckboxStatechecked", useSSLValue); | 325 L"options.AdvancedOptions.SetUseSSL2CheckboxStatechecked", useSSLValue); |
| 338 } | 326 } |
| 339 #endif | 327 #endif |
| OLD | NEW |