diff options
author | kevers@chromium.org <kevers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 02:31:04 +0000 |
---|---|---|
committer | kevers@chromium.org <kevers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 02:31:04 +0000 |
commit | 80f07939e245cbccd898ee5742de79711d094914 (patch) | |
tree | 1a10be886efdcf9071e0fbad182a404b2569323f | |
parent | 16f799a44a9e871e2a5de8618ce1ed7d203414da (diff) | |
download | chromium_src-80f07939e245cbccd898ee5742de79711d094914.zip chromium_src-80f07939e245cbccd898ee5742de79711d094914.tar.gz chromium_src-80f07939e245cbccd898ee5742de79711d094914.tar.bz2 |
Move "Enable data roaming" to the "Mobile Data" menu.
BUG=chromium:116799
TEST=Manual.
Review URL: http://codereview.chromium.org/9751007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127881 0039d316-1c4b-4281-b951-d872f2087c98
6 files changed, 59 insertions, 24 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 564f813..db9206e 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -12639,9 +12639,15 @@ Some features may be unavailable. Please check that the profile exists and you <message name="IDS_OPTIONS_SETTINGS_USE_SHARED_PROXIES" desc="In the settings tab, the text next to the checkbox for allowing proxy settings for shared networks."> Allow proxies for shared networks </message> - <message name="IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING" desc="In the settings tab, the text next to the checkbox for data roaming."> + <message name="IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING" desc="Appears in the Mobile Data drop-down menu in the Internet Connections section of the Settigns tab."> Allow mobile data roaming </message> +<message name="IDS_OPTIONS_SETTINGS_TOGGLE_DATA_ROAMING_RESTRICTION" desc="Tooltip for the 'enable data roaming' entry in the Mobile Data drop-down menu indicating why the command is disabled."> + This setting may only be modified by the owner. + </message> + <message name="IDS_OPTIONS_SETTINGS_DISABLE_DATA_ROAMING" desc="Appears in the Mobile Data drop-down menu in the Internet Connections section of the Settigns tab."> + Disable mobile data roaming + </message> <message name="IDS_OPTIONS_ACCOUNTS_ALLOW_BWSI_DESCRIPTION" desc="In the Accounts settings tab, the text on the checkbox to allow browse without signing in."> Enable guest browsing </message> diff --git a/chrome/browser/resources/options2/browser_options.css b/chrome/browser/resources/options2/browser_options.css index 25478d9..bf46539 100644 --- a/chrome/browser/resources/options2/browser_options.css +++ b/chrome/browser/resources/options2/browser_options.css @@ -295,6 +295,10 @@ list:not([disabled]) > .network-group[selected] { white-space: nowrap; } +.network-disabled-control { + color: #999; +} + .network-menu-header { -webkit-padding-start: 36px; color: #999; diff --git a/chrome/browser/resources/options2/chromeos/internet_detail.html b/chrome/browser/resources/options2/chromeos/internet_detail.html index ce97b51..635710b 100644 --- a/chrome/browser/resources/options2/chromeos/internet_detail.html +++ b/chrome/browser/resources/options2/chromeos/internet_detail.html @@ -245,18 +245,6 @@ <span class="controlled-setting-indicator" data="autoConnect" for="autoConnectNetworkCellular"></span> </div> - <div id="internet-owner-only-warning" hidden> - <span i18n-content="ownerOnly"></span> - <span i18n-content="ownerUserId"></span> - </div> - <div id="data-roaming" class="checkbox"> - <label> - <input id="enable-data-roaming" - pref="cros.signed.data_roaming_enabled" - metric="Options_Internet_DataRoaming" type="checkbox"> - <span i18n-content="enableDataRoaming"></span> - </label> - </div> </td> </tr> </table> diff --git a/chrome/browser/resources/options2/chromeos/internet_options.js b/chrome/browser/resources/options2/chromeos/internet_options.js index c791952..2967108 100644 --- a/chrome/browser/resources/options2/chromeos/internet_options.js +++ b/chrome/browser/resources/options2/chromeos/internet_options.js @@ -212,13 +212,9 @@ cr.define('options', function() { $('enable-cellular').hidden = false; $('disable-cellular').hidden = true; } - if (!AccountsOptions.currentUserIsOwner()) - $('internet-owner-only-warning').hidden = false; - $('data-roaming').hidden = false; } else { $('enable-cellular').hidden = true; $('disable-cellular').hidden = true; - $('data-roaming').hidden = true; } }; diff --git a/chrome/browser/resources/options2/chromeos/network_list.js b/chrome/browser/resources/options2/chromeos/network_list.js index 38eb65d..6647983 100644 --- a/chrome/browser/resources/options2/chromeos/network_list.js +++ b/chrome/browser/resources/options2/chromeos/network_list.js @@ -83,6 +83,13 @@ cr.define('options.network', function() { var useSharedProxies_ = false; /** + * Indicates if mobile data roaming is enabled. + * @type {boolean} + * @private + */ + var enableDataRoaming_ = false; + + /** * Create an element in the network list for controlling network * connectivity. * @param {Object} data Description of the network list or command. @@ -395,6 +402,27 @@ cr.define('options.network', function() { command: 'connect', data: {networkType: Constants.TYPE_WIFI, servicePath: '?'}}); + } else if (this.data_.key == 'cellular') { + var label = enableDataRoaming_ ? 'disableDataRoaming' : + 'enableDataRoaming'; + var disabled = !AccountsOptions.currentUserIsOwner(); + var entry = {label: localStrings.getString(label), + data: {}}; + if (disabled) { + entry.command = null; + entry.tooltip = + localStrings.getString('dataRoamingDisableToggleTooltip'); + } else { + entry.command = function() { + options.Preferences.setBooleanPref( + 'cros.signed.data_roaming_enabled', + !enableDataRoaming_); + // Force revalidation of the menu the next time it is + // displayed. + this.menu_ = null; + }; + } + addendum.push(entry); } var list = this.data.rememberedNetworks; if (list && list.length > 0) { @@ -480,10 +508,12 @@ cr.define('options.network', function() { for (var i = 0; i < addendum.length; i++) { var value = addendum[i]; if (value.data) { - this.createCallback_(menu, - value.data, - value.label, - value.command); + var item = this.createCallback_(menu, + value.data, + value.label, + value.command); + if (value.tooltip) + item.title = value.tooltip; separator = false; } else if (!separator) { menu.appendChild(MenuItem.createSeparator()); @@ -520,12 +550,15 @@ cr.define('options.network', function() { [type, path, command]); closeMenu_(); }; - } else { + } else if (command != null) { callback = function() { command(data); }; } - button.addEventListener('click', callback); + if (callback != null) + button.addEventListener('click', callback); + else + buttonLabel.classList.add('network-disabled-control'); MenuItem.decorate(button); menu.appendChild(button); return button; @@ -652,6 +685,11 @@ cr.define('options.network', function() { $('network-list').updateToggleControl('useSharedProxies', useSharedProxies_); }); + prefs.addEventListener('cros.signed.data_roaming_enabled', + function(event) { + enableDataRoaming_ = event.value && event.value['value'] != + undefined ? event.value['value'] : event.value; + }); }, /** diff --git a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc index 0d957a8..50534cb 100644 --- a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc +++ b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc @@ -298,6 +298,10 @@ void InternetOptionsHandler::GetLocalizedValues( IDS_OPTIONS_SETTINGS_SECTION_TITLE_ADD_CONNECTION }, { "addConnectionWifi", IDS_OPTIONS_SETTINGS_ADD_CONNECTION_WIFI }, { "addConnectionVPN", IDS_STATUSBAR_NETWORK_ADD_VPN }, + { "enableDataRoaming", IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING }, + { "disableDataRoaming", IDS_OPTIONS_SETTINGS_DISABLE_DATA_ROAMING }, + { "dataRoamingDisableToggleTooltip", + IDS_OPTIONS_SETTINGS_TOGGLE_DATA_ROAMING_RESTRICTION }, // Network options dialog labels. // TODO(kevers): Remove once dialog is deprecated. @@ -404,7 +408,6 @@ void InternetOptionsHandler::GetLocalizedValues( IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN_CLEAR }, { "cellularApnSet", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN_SET }, { "cellularApnCancel", IDS_CANCEL }, - { "enableDataRoaming", IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING }, // Security Tab. |