Index: chrome/browser/dom_ui/advanced_options_handler.cc |
=================================================================== |
--- chrome/browser/dom_ui/advanced_options_handler.cc (revision 56863) |
+++ chrome/browser/dom_ui/advanced_options_handler.cc (working copy) |
@@ -127,7 +127,7 @@ |
void AdvancedOptionsHandler::Initialize() { |
SetupDownloadLocationPath(); |
SetupAutoOpenFileTypesDisabledAttribute(); |
- SetupProxySettingsDisabledAttribute(); |
+ SetupProxySettingsSection(); |
#if defined(OS_WIN) |
SetupSSLConfigSettings(); |
#endif |
@@ -193,6 +193,9 @@ |
SetupDownloadLocationPath(); |
} else if (*pref_name == prefs::kDownloadExtensionsToOpen) { |
SetupAutoOpenFileTypesDisabledAttribute(); |
+ } else { |
+ // Assume that one of the proxy settings may have changed. |
+ SetupProxySettingsSection(); |
} |
} |
} |
@@ -267,12 +270,29 @@ |
L"options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value); |
} |
-void AdvancedOptionsHandler::SetupProxySettingsDisabledAttribute() { |
- // Set the enabled state for the proxy settings button. |
- // We enable the button if proxy settings are not managed by a sysadmin. |
- FundamentalValue value(proxy_prefs_->IsManaged()); |
+void AdvancedOptionsHandler::SetupProxySettingsSection() { |
+ // Disable the button if proxy settings are managed by a sysadmin or |
+ // overridden by an extension. |
+ PrefService* pref_service = dom_ui_->GetProfile()->GetPrefs(); |
+ const PrefService::Preference* proxy_server = |
+ pref_service->FindPreference(prefs::kProxyServer); |
+ CHECK(proxy_server); |
James Hawkins
2010/08/20 19:51:41
If you really want to check here, this should be a
csilv
2010/08/20 20:21:42
Done.
|
+ |
+ FundamentalValue disabled(proxy_prefs_->IsManaged() || |
+ proxy_server->IsExtensionControlled()); |
+ |
+ // Get the appropriate info string to describe the button. |
+ string16 label_str; |
+ if (proxy_server->IsExtensionControlled()) { |
+ label_str = l10n_util::GetStringUTF16(IDS_OPTIONS_EXTENSION_PROXIES_LABEL); |
+ } else { |
+ label_str = l10n_util::GetStringFUTF16(IDS_OPTIONS_SYSTEM_PROXIES_LABEL, |
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
+ } |
+ StringValue label(label_str); |
+ |
dom_ui_->CallJavascriptFunction( |
- L"options.AdvancedOptions.SetProxySettingsDisabledAttribute", value); |
+ L"options.AdvancedOptions.SetupProxySettingsSection", disabled, label); |
} |
#if defined(OS_WIN) |