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 27 matching lines...) Expand all Loading... |
38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
39 #include "grit/locale_settings.h" | 39 #include "grit/locale_settings.h" |
40 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
41 | 41 |
42 #if !defined(OS_CHROMEOS) | 42 #if !defined(OS_CHROMEOS) |
43 #include "chrome/browser/browser_process.h" | 43 #include "chrome/browser/browser_process.h" |
44 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" | 44 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" |
45 #endif | 45 #endif |
46 | 46 |
47 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
48 #include "chrome/browser/gears_integration.h" | |
49 #include "net/base/ssl_config_service_win.h" | 48 #include "net/base/ssl_config_service_win.h" |
50 #endif | 49 #endif |
51 | 50 |
52 AdvancedOptionsHandler::AdvancedOptionsHandler() { | 51 AdvancedOptionsHandler::AdvancedOptionsHandler() { |
53 #if (defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)) || defined(OS_MACOSX) | 52 #if (defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)) || defined(OS_MACOSX) |
54 cloud_print_proxy_ui_enabled_ = true; | 53 cloud_print_proxy_ui_enabled_ = true; |
55 #elif !defined(OS_CHROMEOS) | 54 #elif !defined(OS_CHROMEOS) |
56 cloud_print_proxy_ui_enabled_ = | 55 cloud_print_proxy_ui_enabled_ = |
57 CommandLine::ForCurrentProcess()->HasSwitch( | 56 CommandLine::ForCurrentProcess()->HasSwitch( |
58 switches::kEnableCloudPrintProxy); | 57 switches::kEnableCloudPrintProxy); |
(...skipping 15 matching lines...) Expand all Loading... |
74 { "downloadLocationBrowseTitle", | 73 { "downloadLocationBrowseTitle", |
75 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE }, | 74 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE }, |
76 { "downloadLocationBrowseWindowTitle", | 75 { "downloadLocationBrowseWindowTitle", |
77 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_WINDOW_TITLE }, | 76 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_WINDOW_TITLE }, |
78 { "downloadLocationAskForSaveLocation", | 77 { "downloadLocationAskForSaveLocation", |
79 IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION }, | 78 IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION }, |
80 { "autoOpenFileTypesInfo", | 79 { "autoOpenFileTypesInfo", |
81 IDS_OPTIONS_OPEN_FILE_TYPES_AUTOMATICALLY }, | 80 IDS_OPTIONS_OPEN_FILE_TYPES_AUTOMATICALLY }, |
82 { "autoOpenFileTypesResetToDefault", | 81 { "autoOpenFileTypesResetToDefault", |
83 IDS_OPTIONS_AUTOOPENFILETYPES_RESETTODEFAULT }, | 82 IDS_OPTIONS_AUTOOPENFILETYPES_RESETTODEFAULT }, |
84 { "gearSettingsConfigureGearsButton", | |
85 IDS_OPTIONS_GEARSSETTINGS_CONFIGUREGEARS_BUTTON }, | |
86 { "translateEnableTranslate", | 83 { "translateEnableTranslate", |
87 IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE }, | 84 IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE }, |
88 { "certificatesManageButton", | 85 { "certificatesManageButton", |
89 IDS_OPTIONS_CERTIFICATES_MANAGE_BUTTON }, | 86 IDS_OPTIONS_CERTIFICATES_MANAGE_BUTTON }, |
90 { "proxiesLabel", | 87 { "proxiesLabel", |
91 IDS_OPTIONS_PROXIES_LABEL }, | 88 IDS_OPTIONS_PROXIES_LABEL }, |
92 { "proxiesConfigureButton", | 89 { "proxiesConfigureButton", |
93 IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON }, | 90 IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON }, |
94 { "safeBrowsingEnableProtection", | 91 { "safeBrowsingEnableProtection", |
95 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION }, | 92 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION }, |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 // Setup Windows specific callbacks. | 297 // Setup Windows specific callbacks. |
301 web_ui_->RegisterMessageCallback("checkRevocationCheckboxAction", | 298 web_ui_->RegisterMessageCallback("checkRevocationCheckboxAction", |
302 NewCallback(this, | 299 NewCallback(this, |
303 &AdvancedOptionsHandler::HandleCheckRevocationCheckbox)); | 300 &AdvancedOptionsHandler::HandleCheckRevocationCheckbox)); |
304 web_ui_->RegisterMessageCallback("useSSL3CheckboxAction", | 301 web_ui_->RegisterMessageCallback("useSSL3CheckboxAction", |
305 NewCallback(this, | 302 NewCallback(this, |
306 &AdvancedOptionsHandler::HandleUseSSL3Checkbox)); | 303 &AdvancedOptionsHandler::HandleUseSSL3Checkbox)); |
307 web_ui_->RegisterMessageCallback("useTLS1CheckboxAction", | 304 web_ui_->RegisterMessageCallback("useTLS1CheckboxAction", |
308 NewCallback(this, | 305 NewCallback(this, |
309 &AdvancedOptionsHandler::HandleUseTLS1Checkbox)); | 306 &AdvancedOptionsHandler::HandleUseTLS1Checkbox)); |
310 web_ui_->RegisterMessageCallback("showGearsSettings", | |
311 NewCallback(this, | |
312 &AdvancedOptionsHandler::HandleShowGearsSettings)); | |
313 #endif | 307 #endif |
314 } | 308 } |
315 | 309 |
316 void AdvancedOptionsHandler::Observe(NotificationType type, | 310 void AdvancedOptionsHandler::Observe(NotificationType type, |
317 const NotificationSource& source, | 311 const NotificationSource& source, |
318 const NotificationDetails& details) { | 312 const NotificationDetails& details) { |
319 if (type == NotificationType::PREF_CHANGED) { | 313 if (type == NotificationType::PREF_CHANGED) { |
320 std::string* pref_name = Details<std::string>(details).ptr(); | 314 std::string* pref_name = Details<std::string>(details).ptr(); |
321 if ((*pref_name == prefs::kDownloadDefaultDirectory) || | 315 if ((*pref_name == prefs::kDownloadDefaultDirectory) || |
322 (*pref_name == prefs::kPromptForDownload)) { | 316 (*pref_name == prefs::kPromptForDownload)) { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 } | 420 } |
427 | 421 |
428 void AdvancedOptionsHandler::HandleUseTLS1Checkbox(const ListValue* args) { | 422 void AdvancedOptionsHandler::HandleUseTLS1Checkbox(const ListValue* args) { |
429 std::string checked_str = WideToUTF8(ExtractStringValue(args)); | 423 std::string checked_str = WideToUTF8(ExtractStringValue(args)); |
430 bool enabled = checked_str == "true"; | 424 bool enabled = checked_str == "true"; |
431 std::string metric = | 425 std::string metric = |
432 (enabled ? "Options_TLS1_Enable" : "Options_TLS1_Disable"); | 426 (enabled ? "Options_TLS1_Enable" : "Options_TLS1_Disable"); |
433 UserMetricsRecordAction(UserMetricsAction(metric.c_str())); | 427 UserMetricsRecordAction(UserMetricsAction(metric.c_str())); |
434 net::SSLConfigServiceWin::SetTLS1Enabled(enabled); | 428 net::SSLConfigServiceWin::SetTLS1Enabled(enabled); |
435 } | 429 } |
436 | |
437 void AdvancedOptionsHandler::HandleShowGearsSettings(const ListValue* args) { | |
438 UserMetricsRecordAction(UserMetricsAction("Options_GearsSettings")); | |
439 GearsSettingsPressed( | |
440 web_ui_->tab_contents()->view()->GetTopLevelNativeWindow()); | |
441 } | |
442 #endif | 430 #endif |
443 | 431 |
444 #if !defined(OS_CHROMEOS) | 432 #if !defined(OS_CHROMEOS) |
445 void AdvancedOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { | 433 void AdvancedOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { |
446 UserMetricsRecordAction(UserMetricsAction("Options_ShowProxySettings")); | 434 UserMetricsRecordAction(UserMetricsAction("Options_ShowProxySettings")); |
447 AdvancedOptionsUtilities::ShowNetworkProxySettings(web_ui_->tab_contents()); | 435 AdvancedOptionsUtilities::ShowNetworkProxySettings(web_ui_->tab_contents()); |
448 } | 436 } |
449 #endif | 437 #endif |
450 | 438 |
451 #if !defined(USE_NSS) && !defined(USE_OPENSSL) | 439 #if !defined(USE_NSS) && !defined(USE_OPENSSL) |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 FundamentalValue useSSL3Value(useSSL3Setting); | 637 FundamentalValue useSSL3Value(useSSL3Setting); |
650 web_ui_->CallJavascriptFunction( | 638 web_ui_->CallJavascriptFunction( |
651 "options.AdvancedOptions.SetUseSSL3CheckboxState", | 639 "options.AdvancedOptions.SetUseSSL3CheckboxState", |
652 useSSL3Value, disabledValue); | 640 useSSL3Value, disabledValue); |
653 FundamentalValue useTLS1Value(useTLS1Setting); | 641 FundamentalValue useTLS1Value(useTLS1Setting); |
654 web_ui_->CallJavascriptFunction( | 642 web_ui_->CallJavascriptFunction( |
655 "options.AdvancedOptions.SetUseTLS1CheckboxState", | 643 "options.AdvancedOptions.SetUseTLS1CheckboxState", |
656 useTLS1Value, disabledValue); | 644 useTLS1Value, disabledValue); |
657 } | 645 } |
658 #endif | 646 #endif |
OLD | NEW |