| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/options/advanced_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/advanced_options_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 enable_metrics_recording_.Init(prefs::kMetricsReportingEnabled, | 229 enable_metrics_recording_.Init(prefs::kMetricsReportingEnabled, |
| 230 g_browser_process->local_state(), this); | 230 g_browser_process->local_state(), this); |
| 231 cloud_print_proxy_email_.Init(prefs::kCloudPrintEmail, prefs, this); | 231 cloud_print_proxy_email_.Init(prefs::kCloudPrintEmail, prefs, this); |
| 232 cloud_print_proxy_enabled_.Init(prefs::kCloudPrintProxyEnabled, prefs, this); | 232 cloud_print_proxy_enabled_.Init(prefs::kCloudPrintProxyEnabled, prefs, this); |
| 233 #endif | 233 #endif |
| 234 default_download_location_.Init(prefs::kDownloadDefaultDirectory, | 234 default_download_location_.Init(prefs::kDownloadDefaultDirectory, |
| 235 prefs, this); | 235 prefs, this); |
| 236 ask_for_save_location_.Init(prefs::kPromptForDownload, prefs, this); | 236 ask_for_save_location_.Init(prefs::kPromptForDownload, prefs, this); |
| 237 auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this); | 237 auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this); |
| 238 default_font_size_.Init(prefs::kWebKitDefaultFontSize, prefs, this); | 238 default_font_size_.Init(prefs::kWebKitDefaultFontSize, prefs, this); |
| 239 default_fixed_font_size_.Init(prefs::kWebKitDefaultFixedFontSize, prefs, | |
| 240 this); | |
| 241 proxy_prefs_.reset( | 239 proxy_prefs_.reset( |
| 242 PrefSetObserver::CreateProxyPrefSetObserver(prefs, this)); | 240 PrefSetObserver::CreateProxyPrefSetObserver(prefs, this)); |
| 243 | 241 |
| 244 // Return result from the superclass. | 242 // Return result from the superclass. |
| 245 return handler; | 243 return handler; |
| 246 } | 244 } |
| 247 | 245 |
| 248 void AdvancedOptionsHandler::RegisterMessages() { | 246 void AdvancedOptionsHandler::RegisterMessages() { |
| 249 // Setup handlers specific to this panel. | 247 // Setup handlers specific to this panel. |
| 250 DCHECK(web_ui_); | 248 DCHECK(web_ui_); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } else if (*pref_name == prefs::kDownloadExtensionsToOpen) { | 317 } else if (*pref_name == prefs::kDownloadExtensionsToOpen) { |
| 320 SetupAutoOpenFileTypesDisabledAttribute(); | 318 SetupAutoOpenFileTypesDisabledAttribute(); |
| 321 } else if (proxy_prefs_->IsObserved(*pref_name)) { | 319 } else if (proxy_prefs_->IsObserved(*pref_name)) { |
| 322 SetupProxySettingsSection(); | 320 SetupProxySettingsSection(); |
| 323 } else if ((*pref_name == prefs::kCloudPrintEmail) || | 321 } else if ((*pref_name == prefs::kCloudPrintEmail) || |
| 324 (*pref_name == prefs::kCloudPrintProxyEnabled)) { | 322 (*pref_name == prefs::kCloudPrintProxyEnabled)) { |
| 325 #if !defined(OS_CHROMEOS) | 323 #if !defined(OS_CHROMEOS) |
| 326 if (cloud_print_proxy_ui_enabled_) | 324 if (cloud_print_proxy_ui_enabled_) |
| 327 SetupCloudPrintProxySection(); | 325 SetupCloudPrintProxySection(); |
| 328 #endif | 326 #endif |
| 329 } else if (*pref_name == prefs::kWebKitDefaultFontSize || | 327 } else if (*pref_name == prefs::kWebKitDefaultFontSize) { |
| 330 *pref_name == prefs::kWebKitDefaultFixedFontSize) { | |
| 331 SetupFontSizeLabel(); | 328 SetupFontSizeLabel(); |
| 332 } | 329 } |
| 333 } | 330 } |
| 334 } | 331 } |
| 335 | 332 |
| 336 void AdvancedOptionsHandler::HandleSelectDownloadLocation( | 333 void AdvancedOptionsHandler::HandleSelectDownloadLocation( |
| 337 const ListValue* args) { | 334 const ListValue* args) { |
| 338 PrefService* pref_service = web_ui_->GetProfile()->GetPrefs(); | 335 PrefService* pref_service = web_ui_->GetProfile()->GetPrefs(); |
| 339 select_folder_dialog_ = SelectFileDialog::Create(this); | 336 select_folder_dialog_ = SelectFileDialog::Create(this); |
| 340 select_folder_dialog_->SelectFile( | 337 select_folder_dialog_->SelectFile( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 enable_metrics_recording_.SetValue(is_enabled); | 382 enable_metrics_recording_.SetValue(is_enabled); |
| 386 SetupMetricsReportingCheckbox(); | 383 SetupMetricsReportingCheckbox(); |
| 387 #endif | 384 #endif |
| 388 } | 385 } |
| 389 | 386 |
| 390 void AdvancedOptionsHandler::HandleDefaultFontSize(const ListValue* args) { | 387 void AdvancedOptionsHandler::HandleDefaultFontSize(const ListValue* args) { |
| 391 int font_size; | 388 int font_size; |
| 392 if (ExtractIntegerValue(args, &font_size)) { | 389 if (ExtractIntegerValue(args, &font_size)) { |
| 393 if (font_size > 0) { | 390 if (font_size > 0) { |
| 394 default_font_size_.SetValue(font_size); | 391 default_font_size_.SetValue(font_size); |
| 395 default_fixed_font_size_.SetValue(font_size); | |
| 396 SetupFontSizeLabel(); | 392 SetupFontSizeLabel(); |
| 397 } | 393 } |
| 398 } | 394 } |
| 399 } | 395 } |
| 400 | 396 |
| 401 #if defined(OS_WIN) | 397 #if defined(OS_WIN) |
| 402 void AdvancedOptionsHandler::HandleCheckRevocationCheckbox( | 398 void AdvancedOptionsHandler::HandleCheckRevocationCheckbox( |
| 403 const ListValue* args) { | 399 const ListValue* args) { |
| 404 std::string checked_str = WideToUTF8(ExtractStringValue(args)); | 400 std::string checked_str = WideToUTF8(ExtractStringValue(args)); |
| 405 bool enabled = checked_str == "true"; | 401 bool enabled = checked_str == "true"; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 FundamentalValue visible(false); | 548 FundamentalValue visible(false); |
| 553 web_ui_->CallJavascriptFunction( | 549 web_ui_->CallJavascriptFunction( |
| 554 "options.AdvancedOptions.SetMetricsReportingSettingVisibility", | 550 "options.AdvancedOptions.SetMetricsReportingSettingVisibility", |
| 555 visible); | 551 visible); |
| 556 } | 552 } |
| 557 #endif | 553 #endif |
| 558 } | 554 } |
| 559 | 555 |
| 560 void AdvancedOptionsHandler::SetupFontSizeLabel() { | 556 void AdvancedOptionsHandler::SetupFontSizeLabel() { |
| 561 // We're only interested in integer values, so convert to int. | 557 // We're only interested in integer values, so convert to int. |
| 562 FundamentalValue fixed_font_size(default_fixed_font_size_.GetValue()); | |
| 563 FundamentalValue font_size(default_font_size_.GetValue()); | 558 FundamentalValue font_size(default_font_size_.GetValue()); |
| 564 web_ui_->CallJavascriptFunction( | 559 web_ui_->CallJavascriptFunction( |
| 565 "options.AdvancedOptions.SetFontSize", fixed_font_size, font_size); | 560 "options.AdvancedOptions.SetFontSize", font_size); |
| 566 } | 561 } |
| 567 | 562 |
| 568 void AdvancedOptionsHandler::SetupDownloadLocationPath() { | 563 void AdvancedOptionsHandler::SetupDownloadLocationPath() { |
| 569 StringValue value(default_download_location_.GetValue().value()); | 564 StringValue value(default_download_location_.GetValue().value()); |
| 570 FundamentalValue disabled(default_download_location_.IsManaged()); | 565 FundamentalValue disabled(default_download_location_.IsManaged()); |
| 571 web_ui_->CallJavascriptFunction( | 566 web_ui_->CallJavascriptFunction( |
| 572 "options.AdvancedOptions.SetDownloadLocationPath", value, disabled); | 567 "options.AdvancedOptions.SetDownloadLocationPath", value, disabled); |
| 573 } | 568 } |
| 574 | 569 |
| 575 void AdvancedOptionsHandler::SetupPromptForDownload() { | 570 void AdvancedOptionsHandler::SetupPromptForDownload() { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 FundamentalValue useSSL3Value(useSSL3Setting); | 633 FundamentalValue useSSL3Value(useSSL3Setting); |
| 639 web_ui_->CallJavascriptFunction( | 634 web_ui_->CallJavascriptFunction( |
| 640 "options.AdvancedOptions.SetUseSSL3CheckboxState", | 635 "options.AdvancedOptions.SetUseSSL3CheckboxState", |
| 641 useSSL3Value, disabledValue); | 636 useSSL3Value, disabledValue); |
| 642 FundamentalValue useTLS1Value(useTLS1Setting); | 637 FundamentalValue useTLS1Value(useTLS1Setting); |
| 643 web_ui_->CallJavascriptFunction( | 638 web_ui_->CallJavascriptFunction( |
| 644 "options.AdvancedOptions.SetUseTLS1CheckboxState", | 639 "options.AdvancedOptions.SetUseTLS1CheckboxState", |
| 645 useTLS1Value, disabledValue); | 640 useTLS1Value, disabledValue); |
| 646 } | 641 } |
| 647 #endif | 642 #endif |
| OLD | NEW |