Commit 86eed02d authored by Sonny Sasaka's avatar Sonny Sasaka Committed by Commit Bot

settings: Disallow non-primary users to change Bluetooth settings

Since Bluetooth power preference became user-specific, we disallowed
non-primary users to change Bluetooth power setting for UX consistency
with system tray.

Bug: 853374
Change-Id: If61d2c0c048e7d8c764e24798da0ebbf2ab6c68f
Reviewed-on: https://chromium-review.googlesource.com/1187601
Commit-Queue: Sonny Sasaka <sonnysasaka@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586088}
parent a14ec485
......@@ -937,6 +937,9 @@
<message name="IDS_SETTINGS_BLUETOOTH_CONNECT_WRITE_NOT_PERMITTED">
Write operation is not permitted on: "<ph name="DEVICE_NAME">$1<ex>Nexus 4</ex></ph>".
</message>
<message name="IDS_SETTINGS_BLUETOOTH_PRIMARY_USER_CONTROLLED" desc="Settings > Bluetooth > Text to show when Bluetooth configuration is controlled by the primary user.">
Bluetooth configuration is controlled by <ph name="USER_EMAIL">$1<ex>joe@gmail.com</ex></ph>.
</message>
</if>
<if expr="use_nss_certs">
......
......@@ -3,6 +3,7 @@
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_pref_indicator.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/neon-animation/neon-animatable.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="../i18n_setup.html">
......@@ -21,36 +22,47 @@
<settings-animated-pages id="pages" section="bluetooth"
focus-config="[[focusConfig_]]">
<neon-animatable route-path="default">
<div id="bluetoothDevices"
class="settings-box two-line" actionable on-click="onTap_">
<iron-icon icon="[[getIcon_(bluetoothToggleState_)]]"></iron-icon>
<div class="middle">
$i18n{bluetoothPageTitle}
<div class="secondary" id="bluetoothSecondary">
[[getOnOffString_(bluetoothToggleState_,
'$i18nPolymer{deviceOn}', '$i18nPolymer{deviceOff}')]]
<template is="dom-if" if="[[!isSecondaryUser_]]">
<div id="bluetoothDevices"
class="settings-box two-line" actionable on-click="onTap_">
<iron-icon icon="[[getIcon_(bluetoothToggleState_)]]"></iron-icon>
<div class="middle">
$i18n{bluetoothPageTitle}
<div class="secondary" id="bluetoothSecondary">
[[getOnOffString_(bluetoothToggleState_,
'$i18nPolymer{deviceOn}', '$i18nPolymer{deviceOff}')]]
</div>
</div>
<cr-policy-pref-indicator
icon-aria-label="$i18n{bluetoothPageTitle}"
pref="[[prefs.cros.device.allow_bluetooth]]"
hidden="[[prefs.cros.device.allow_bluetooth.value]]">
</cr-policy-pref-indicator>
<template is="dom-if" if="[[bluetoothToggleState_]]">
<paper-icon-button-light class="subpage-arrow">
<button on-click="onSubpageArrowTap_"
aria-label="$i18n{bluetoothPageTitle}"
aria-describedby="bluetoothSecondary">
</button>
</paper-icon-button-light>
</template>
<div class="separator"></div>
<cr-toggle id="enableBluetooth"
checked="{{bluetoothToggleState_}}"
disabled$="[[!isToggleEnabled_(
adapterState_, stateChangeInProgress_)]]"
aria-label="$i18n{bluetoothToggleA11yLabel}">
</cr-toggle>
</div>
<cr-policy-pref-indicator icon-aria-label="$i18n{bluetoothPageTitle}"
pref="[[prefs.cros.device.allow_bluetooth]]"
hidden="[[prefs.cros.device.allow_bluetooth.value]]">
</cr-policy-pref-indicator>
<template is="dom-if" if="[[bluetoothToggleState_]]">
<paper-icon-button-light class="subpage-arrow">
<button on-click="onSubpageArrowTap_"
aria-label="$i18n{bluetoothPageTitle}"
aria-describedby="bluetoothSecondary">
</button>
</paper-icon-button-light>
</template>
<div class="separator"></div>
<cr-toggle id="enableBluetooth"
checked="{{bluetoothToggleState_}}"
disabled$=
"[[!isToggleEnabled_(adapterState_, stateChangeInProgress_)]]"
aria-label="$i18n{bluetoothToggleA11yLabel}">
</cr-toggle>
</div>
</template>
<template is="dom-if" if="[[isSecondaryUser_]]">
<div id="bluetoothDevices" class="settings-box two-line">
<iron-icon class="policy" icon="cr:group"></iron-icon>
<div class="middle">
[[i18n('bluetoothPrimaryUserControlled', primaryUserEmail_)]]
</div>
</div>
</template>
</neon-animatable>
<template is="dom-if" route-path="/bluetoothDevices">
......
......@@ -25,7 +25,7 @@ const bluetoothApis = window['bluetoothApis'] || {
Polymer({
is: 'settings-bluetooth-page',
behaviors: [PrefsBehavior],
behaviors: [I18nBehavior, PrefsBehavior],
properties: {
/** Preferences state. */
......@@ -99,6 +99,30 @@ Polymer({
type: Object,
value: chrome.bluetoothPrivate,
},
/**
* Whether the user is a secondary user.
* @private
*/
isSecondaryUser_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('isSecondaryUser');
},
readOnly: true,
},
/**
* Email address for the primary user.
* @private
*/
primaryUserEmail_: {
type: String,
value: function() {
return loadTimeData.getString('primaryUserEmail');
},
readOnly: true,
},
},
observers: ['deviceListChanged_(deviceList_.*)'],
......
......@@ -493,6 +493,8 @@ void AddBluetoothStrings(content::WebUIDataSource* html_source) {
{"bluetoothPairDevicePageTitle",
IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE_TITLE},
{"bluetoothRemove", IDS_SETTINGS_BLUETOOTH_REMOVE},
{"bluetoothPrimaryUserControlled",
IDS_SETTINGS_BLUETOOTH_PRIMARY_USER_CONTROLLED},
};
AddLocalizedStringsBulk(html_source, localized_strings,
arraysize(localized_strings));
......
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