Commit 48f62a44 authored by csilv@chromium.org's avatar csilv@chromium.org

dom-ui options: Setup proxy settings UI accordingly if an Extension is managing proxies.

BUG=51376
TEST=Verify proxy settings UI matches proposal when proxy settings are managed by an extension.
Review URL: http://codereview.chromium.org/3132030

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56940 0039d316-1c4b-4281-b951-d872f2087c98
parent 6d87d61d
...@@ -6069,6 +6069,12 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -6069,6 +6069,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_OPTIONS_PROXIES_LABEL" desc="The info label for the 'Proxy settings' button"> <message name="IDS_OPTIONS_PROXIES_LABEL" desc="The info label for the 'Proxy settings' button">
Set up a proxy to connect to the network. Set up a proxy to connect to the network.
</message> </message>
<message name="IDS_OPTIONS_SYSTEM_PROXIES_LABEL" desc="The info label for the 'Proxy settings' button when managed by the system.">
<ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is using your computer's system proxy settings to connect to the network.
</message>
<message name="IDS_OPTIONS_EXTENSION_PROXIES_LABEL" desc="The info label for the 'Proxy settings' button when managed by an extension.">
Your network proxy settings are being managed by an extension.
</message>
<message name="IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON" desc="The label of the 'Configure proxy settings' button"> <message name="IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON" desc="The label of the 'Configure proxy settings' button">
Change proxy settings Change proxy settings
</message> </message>
......
...@@ -128,7 +128,7 @@ void AdvancedOptionsHandler::GetLocalizedValues( ...@@ -128,7 +128,7 @@ void AdvancedOptionsHandler::GetLocalizedValues(
void AdvancedOptionsHandler::Initialize() { void AdvancedOptionsHandler::Initialize() {
SetupDownloadLocationPath(); SetupDownloadLocationPath();
SetupAutoOpenFileTypesDisabledAttribute(); SetupAutoOpenFileTypesDisabledAttribute();
SetupProxySettingsDisabledAttribute(); SetupProxySettingsSection();
#if defined(OS_WIN) #if defined(OS_WIN)
SetupSSLConfigSettings(); SetupSSLConfigSettings();
#endif #endif
...@@ -197,6 +197,9 @@ void AdvancedOptionsHandler::Observe(NotificationType type, ...@@ -197,6 +197,9 @@ void AdvancedOptionsHandler::Observe(NotificationType type,
SetupDownloadLocationPath(); SetupDownloadLocationPath();
} else if (*pref_name == prefs::kDownloadExtensionsToOpen) { } else if (*pref_name == prefs::kDownloadExtensionsToOpen) {
SetupAutoOpenFileTypesDisabledAttribute(); SetupAutoOpenFileTypesDisabledAttribute();
} else {
// Assume that one of the proxy settings may have changed.
SetupProxySettingsSection();
} }
} }
} }
...@@ -277,12 +280,29 @@ void AdvancedOptionsHandler::SetupAutoOpenFileTypesDisabledAttribute() { ...@@ -277,12 +280,29 @@ void AdvancedOptionsHandler::SetupAutoOpenFileTypesDisabledAttribute() {
L"options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value); L"options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value);
} }
void AdvancedOptionsHandler::SetupProxySettingsDisabledAttribute() { void AdvancedOptionsHandler::SetupProxySettingsSection() {
// Set the enabled state for the proxy settings button. // Disable the button if proxy settings are managed by a sysadmin or
// We enable the button if proxy settings are not managed by a sysadmin. // overridden by an extension.
FundamentalValue value(proxy_prefs_->IsManaged()); PrefService* pref_service = dom_ui_->GetProfile()->GetPrefs();
const PrefService::Preference* proxy_server =
pref_service->FindPreference(prefs::kProxyServer);
DCHECK(proxy_server);
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( dom_ui_->CallJavascriptFunction(
L"options.AdvancedOptions.SetProxySettingsDisabledAttribute", value); L"options.AdvancedOptions.SetupProxySettingsSection", disabled, label);
} }
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -75,8 +75,8 @@ class AdvancedOptionsHandler ...@@ -75,8 +75,8 @@ class AdvancedOptionsHandler
// Setup the enabled state of the reset button. // Setup the enabled state of the reset button.
void SetupAutoOpenFileTypesDisabledAttribute(); void SetupAutoOpenFileTypesDisabledAttribute();
// Setup the enabled state of the proxy settings button. // Setup the proxy settings section UI.
void SetupProxySettingsDisabledAttribute(); void SetupProxySettingsSection();
#if defined(OS_WIN) #if defined(OS_WIN)
// Setup the checked state SSL related checkboxes. // Setup the checked state SSL related checkboxes.
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<section> <section>
<h3 i18n-content="advancedSectionTitleNetwork"></h3> <h3 i18n-content="advancedSectionTitleNetwork"></h3>
<div> <div>
<div i18n-content="proxiesLabel"></div> <div id="proxiesLabel"></div>
<button id="proxiesConfigureButton" <button id="proxiesConfigureButton"
i18n-content="proxiesConfigureButton"></button> i18n-content="proxiesConfigureButton"></button>
</div> </div>
......
...@@ -85,19 +85,20 @@ var OptionsPage = options.OptionsPage; ...@@ -85,19 +85,20 @@ var OptionsPage = options.OptionsPage;
// //
// Set the download path. // Set the download path.
AdvancedOptions.SetDownloadLocationPath = function (path) { AdvancedOptions.SetDownloadLocationPath = function(path) {
if (!cr.isChromeOS) if (!cr.isChromeOS)
$('downloadLocationPath').value = path; $('downloadLocationPath').value = path;
}; };
// Set the enabled state for the autoOpenFileTypesResetToDefault button. // Set the enabled state for the autoOpenFileTypesResetToDefault button.
AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute = function (disabled) { AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute = function(disabled) {
$('autoOpenFileTypesResetToDefault').disabled = disabled; $('autoOpenFileTypesResetToDefault').disabled = disabled;
}; };
// Set the enabled state for the proxy settings button. // Set the enabled state for the proxy settings button.
AdvancedOptions.SetProxySettingsDisabledAttribute = function (disabled) { AdvancedOptions.SetupProxySettingsSection = function(disabled, label) {
$('proxiesConfigureButton').disabled = disabled; $('proxiesConfigureButton').disabled = disabled;
$('proxiesLabel').textContent = label;
}; };
// Set the checked state for the sslCheckRevocation checkbox. // Set the checked state for the sslCheckRevocation checkbox.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment