Skip to content

Commit

Permalink
enhancement bugs for proxy:
Browse files Browse the repository at this point in the history
- specify network name for proxy page
- provide hint when use-shared-proxies is off for remembered shared networks

BUG=chromium-os:18014,chromium-os:18052
TEST=verify per bugs' reports.
Review URL: http://codereview.chromium.org/7488010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93654 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
kuan@chromium.org committed Jul 22, 2011
1 parent eeba404 commit 05d7cf8
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 8 deletions.
8 changes: 7 additions & 1 deletion chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -10891,9 +10891,12 @@ ls' lab.">
<message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_DNSSERVER" desc="In settings Internet options, the label dns server.">
DNS server:
</message>
<message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CHANGE_PROXY_BUTTON" desc="For ethernet and remembered services, change proxy button text in chrome:settings/internet.">
<message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CHANGE_PROXY_BUTTON" desc="In settings Internet options, the button to configure proxy settings.">
Change proxy settings...
</message>
<message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_ENABLE_SHARED_PROXIES_HINT" desc="In settings Internet options, when proxy can't be changed, the hint for user to do so by enabling the setting for IDS_OPTIONS_SETTINGS_USE_SHARED_PROXIES.">
To change proxy settings, enable "Use shared proxies" setting.
</message>
<message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_HARDWARE_ADDRESS" desc="In settings Internet options, the label hardware address.">
Hardware address:
</message>
Expand Down Expand Up @@ -11934,6 +11937,9 @@ ls' lab.">
<message name="IDS_VERSION_FIELD_PREFIX" desc="Display the OS version to the user.">
version
</message>
<message name="IDS_PROXY_PAGE_TITLE_FORMAT" desc="The title of the proxy page for a specific network.">
Network proxy for <ph name="NETWORK_NAME">$1<ex>Ethernet</ex></ph>
</message>
<message name="IDS_PROXY_CONFIG_TITLE" desc="The title of the basic proxy config.">
Proxy Configuration
</message>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ <h1 id="inetTitle"></h1>
</section>
<section id="change-proxy-section">
<div>
<button id="change-proxy" i18n-content="changeProxyButton"></button>
<button id="change-proxy-button" i18n-content="changeProxyButton">
</button>
</div>
<div id="enable-shared-proxies-hint"
i18n-content="enableSharedProxiesHint" hidden>
</div>
</section>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ cr.define('options.internet', function() {
buttonsDiv.appendChild(
this.createButton_('options_button', 'options',
function(e) {
options.ProxyOptions.getInstance().setNetworkName(
self.data.networkName);
chrome.send('buttonClickCallback',
[String(self.data.networkType),
self.data.servicePath,
Expand Down
11 changes: 8 additions & 3 deletions chrome/browser/resources/options/chromeos/internet_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ cr.define('options', function() {
event.target.disabled = true;
chrome.send('disableCellular', []);
});
$('change-proxy').addEventListener('click', function(event) {
$('change-proxy-button').addEventListener('click', function(event) {
OptionsPage.closeOverlay();
OptionsPage.showPageByName('proxy', false);
chrome.send('coreOptionsUserMetricsAction',
Expand Down Expand Up @@ -444,8 +444,13 @@ cr.define('options', function() {
$('ipTypeDHCPDiv').hidden = !data.showStaticIPConfig;
$('ipTypeStaticDiv').hidden = !data.showStaticIPConfig;

// Hide change-proxy-section if proxy is not configurable.
$('change-proxy-section').hidden = !data.proxyConfigurable;
// Hide change-proxy-button if proxy is not configurable.
$('change-proxy-button').hidden = !data.proxyConfigurable;
// Hide enable-shared-proxies-hint if proxy configuration cannot be enabled.
$('enable-shared-proxies-hint').hidden = !data.showSharedProxiesHint;
// Hide change-proxy-section if both button and hint are hidden.
$('change-proxy-section').hidden = !data.proxyConfigurable &&
!data.showSharedProxiesHint;

var ipConfigList = $('ipConfigList');
ipConfigList.disabled = $('ipTypeDHCP').checked || !data.showStaticIPConfig;
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/resources/options/chromeos/proxy.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="proxyPage" class="page" hidden>
<h1 i18n-content="proxyPage"></h1>
<h1 id="proxy-page-title" i18n-content="proxyPage"></h1>
<section>
<h3 i18n-content="proxy_config_title"></h3>
<div>
Expand Down
10 changes: 10 additions & 0 deletions chrome/browser/resources/options/chromeos/proxy_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ cr.define('options', function() {
for (var x = 0; x < selectedItems.length; x++) {
$('ignoredHostList').removeException(selectedItems[x]);
}
},

/**
* Sets proxy page title using given network name.
* @param {string} network The network name to use in page title.
* @public
*/
setNetworkName: function(network) {
$('proxy-page-title').textContent =
localStrings.getStringF('proxyPageTitleFormat', network);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ void InternetOptionsHandler::GetLocalizedValues(
localized_strings->SetString("changeProxyButton",
l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CHANGE_PROXY_BUTTON));
localized_strings->SetString("enableSharedProxiesHint",
l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_ENABLE_SHARED_PROXIES_HINT));

localized_strings->SetString("wifiNetworkTabLabel",
l10n_util::GetStringUTF16(
Expand Down Expand Up @@ -687,10 +690,14 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
dictionary.SetBoolean("connected", network->connected());
dictionary.SetString("connectionState", network->GetStateString());
bool remembered = (network->profile_type() != chromeos::PROFILE_NONE);
dictionary.SetBoolean("proxyConfigurable",
bool proxy_configurable =
(remembered && (network->profile_type() == chromeos::PROFILE_USER ||
use_shared_proxies)) ||
(type == chromeos::TYPE_ETHERNET && use_shared_proxies));
(type == chromeos::TYPE_ETHERNET && use_shared_proxies);
dictionary.SetBoolean("proxyConfigurable", proxy_configurable);
dictionary.SetBoolean("showSharedProxiesHint",
!proxy_configurable && !use_shared_proxies &&
(remembered || type == chromeos::TYPE_ETHERNET));

// Hide the dhcp/static radio if not ethernet or wifi (or if not enabled)
bool staticIPConfig = CommandLine::ForCurrentProcess()->HasSwitch(
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/ui/webui/options/chromeos/proxy_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ void ProxyHandler::GetLocalizedValues(
// Proxy page - ChromeOS
localized_strings->SetString("proxyPage",
l10n_util::GetStringUTF16(IDS_OPTIONS_PROXY_TAB_LABEL));
localized_strings->SetString("proxyPageTitleFormat",
l10n_util::GetStringUTF16(IDS_PROXY_PAGE_TITLE_FORMAT));
localized_strings->SetString("proxy_config_title",
l10n_util::GetStringUTF16(IDS_PROXY_CONFIG_TITLE));
localized_strings->SetString("proxyDirectInternetConnection",
Expand Down

0 comments on commit 05d7cf8

Please sign in to comment.