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

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

Issue 2627373002: MD Settings: Save and restore scroll position in iron-list (Closed)
Patch Set: Use scrollTop Created 3 years, 11 months 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 35054c2c1ce4ede61e2d090f91b7aac4b6588d5f..c4c883fae65d1a566595358b1999d6ab189b031b 100644
--- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
+++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
@@ -80,6 +80,17 @@ Polymer({
},
/**
+ * The ordered list of paired or connecting bluetooth devices.
+ * @type {!Array<!chrome.bluetooth.Device>}
+ */
+ pairedDeviceList_: {
+ type: Array,
+ value: /** @return {Array} */ function() {
+ return [];
+ },
+ },
+
+ /**
* Reflects the iron-list selecteditem property.
* @type {!chrome.bluetooth.Device}
* @private
@@ -228,7 +239,15 @@ Polymer({
/** @private */
deviceListChanged_: function() {
- for (let device of this.deviceList_) {
+ var devices = this.$.devices;
+ this.saveScroll(devices);
+ this.pairedDeviceList_ = this.deviceList_.filter(function(device) {
+ return !!device.paired || !!device.connecting;
+ });
+ this.updateScrollableContents();
+ this.restoreScroll(devices);
+
+ for (let device of this.pairedDeviceList_) {
if (device.connected) {
this.deviceConnected_ = true;
return;
@@ -289,7 +308,6 @@ Polymer({
}
this.bluetooth.getDevices(function(devices) {
this.deviceList_ = devices;
- this.updateScrollableContents();
}.bind(this));
},
@@ -486,16 +504,6 @@ Polymer({
},
/**
- * @return {!Array<!chrome.bluetooth.Device>}
- * @private
- */
- getPairedOrConnecting_: function() {
- return this.deviceList_.filter(function(device) {
- return !!device.paired || !!device.connecting;
- });
- },
-
- /**
* @return {boolean} True if deviceList contains any paired devices.
* @private
*/

Powered by Google App Engine
This is Rietveld 408576698