| Index: chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
|
| diff --git a/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js b/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
|
| index dd3c281e58615160224b1b420dacb2ddbd7afe32..a042d6fd3dde2aa4f8fedc4d1bc4302bcc398f84 100644
|
| --- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
|
| +++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
|
| @@ -62,6 +62,12 @@ Polymer({
|
| adapterState_: Object,
|
|
|
| /**
|
| + * Whether or not a bluetooth device is connected.
|
| + * @private
|
| + */
|
| + deviceConnected_: Boolean,
|
| +
|
| + /**
|
| * The ordered list of bluetooth devices.
|
| * @type {!Array<!chrome.bluetooth.Device>}
|
| * @private
|
| @@ -134,6 +140,8 @@ Polymer({
|
| },
|
| },
|
|
|
| + observers: ['deviceListChanged_(deviceList_.*)'],
|
| +
|
| /**
|
| * Listener for chrome.bluetooth.onAdapterStateChanged events.
|
| * @type {function(!chrome.bluetooth.AdapterState)|undefined}
|
| @@ -219,11 +227,43 @@ Polymer({
|
| },
|
|
|
| /** @private */
|
| + deviceListChanged_: function() {
|
| + for (let device of this.deviceList_) {
|
| + if (device.connected) {
|
| + this.deviceConnected_ = true;
|
| + return;
|
| + }
|
| + }
|
| + this.deviceConnected_ = false;
|
| + },
|
| +
|
| + /** @private */
|
| selectedItemChanged_: function() {
|
| if (this.selectedItem_)
|
| this.connectDevice_(this.selectedItem_);
|
| },
|
|
|
| + /**
|
| + * @return {string}
|
| + * @private
|
| + */
|
| + getIcon_: function() {
|
| + if (!this.bluetoothEnabled_)
|
| + return 'settings:bluetooth-disabled';
|
| + if (this.deviceConnected_)
|
| + return 'settings:bluetooth-connected';
|
| + return 'settings:bluetooth';
|
| + },
|
| +
|
| + /**
|
| + * @return {string}
|
| + * @private
|
| + */
|
| + getTitle_: function() {
|
| + return this.i18n(
|
| + this.bluetoothEnabled_ ? 'bluetoothEnabled' : 'bluetoothDisabled');
|
| + },
|
| +
|
| /** @private */
|
| toggleDeviceListExpanded_: function() {
|
| this.deviceListExpanded_ = !this.deviceListExpanded_;
|
|
|