Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1635)

Unified Diff: chrome/browser/dom_ui/advanced_options_handler.cc

Issue 3132030: dom-ui options: Setup proxy settings UI accordingly if an Extension is managi... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)
« no previous file with comments | « chrome/browser/dom_ui/advanced_options_handler.h ('k') | chrome/browser/resources/options/advanced_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698