Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Unified Diff: chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js

Issue 2562123002: MD Settings: Bluetooth: Update icon and title to reflect state (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698