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

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: Rebase + feedback + clang format 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 66db1a9cf1c5244464a27de0d3f4e7fc0440d63c..ea9118f6f73ff5d147cb48db2428a82d2453dcc6 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,6 +239,14 @@ Polymer({
/** @private */
deviceListChanged_: function() {
+ var devices = this.$.devices;
Dan Beam 2017/02/01 06:13:17 what's the point of this var? |this| wont change
stevenjb 2017/02/02 01:17:47 We use it twice below... Not sure I understand the
+ this.saveScroll(devices);
+ this.pairedDeviceList_ = this.deviceList_.filter(function(device) {
+ return !!device.paired || !!device.connecting;
+ });
+ this.updateScrollableContents();
+ this.restoreScroll(devices);
+
for (var i = 0; i < this.deviceList_.length; ++i) {
if (this.deviceList_[i].connected) {
this.deviceConnected_ = true;
@@ -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