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