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

Unified Diff: chrome/browser/resources/md_history/synced_device_manager.js

Issue 2360193002: [MD History] Hide empty synced device cards. (Closed)
Patch Set: rebase Created 4 years, 3 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/md_history/synced_device_manager.js
diff --git a/chrome/browser/resources/md_history/synced_device_manager.js b/chrome/browser/resources/md_history/synced_device_manager.js
index 476d8a2129f13531021b58ada2f06bdbf8607e14..2177863b37b0316955cf9a1099d9f4b65c4acf0a 100644
--- a/chrome/browser/resources/md_history/synced_device_manager.js
+++ b/chrome/browser/resources/md_history/synced_device_manager.js
@@ -204,12 +204,13 @@ Polymer({
/**
* Decide what message should be displayed when user is logged in and there
* are no synced tabs.
- * @param {boolean} fetchingSyncedTabs
* @return {string}
*/
- noSyncedTabsMessage: function(fetchingSyncedTabs) {
- return loadTimeData.getString(
- fetchingSyncedTabs ? 'loading' : 'noSyncedResults');
+ noSyncedTabsMessage: function() {
+ var stringName = this.fetchingSyncedTabs_ ? 'loading' : 'noSyncedResults';
+ if (this.searchTerm !== '')
+ stringName = 'noSearchResults';
+ return loadTimeData.getString(stringName);
},
/**
@@ -239,15 +240,18 @@ Polymer({
var oldDevice = this.syncedDevices_[i];
if (oldDevice.tag != sessionList[i].tag ||
oldDevice.timestamp != sessionList[i].timestamp) {
- this.splice(
- 'syncedDevices_', i, 1, this.createInternalDevice_(sessionList[i]));
+ var device = this.createInternalDevice_(sessionList[i]);
+ if (device.tabs.length != 0)
+ this.splice('syncedDevices_', i, 1, device);
}
}
if (sessionList.length >= this.syncedDevices_.length) {
// The list grew; append new items.
for (var i = updateCount; i < sessionList.length; i++) {
- this.push('syncedDevices_', this.createInternalDevice_(sessionList[i]));
+ var device = this.createInternalDevice_(sessionList[i]);
+ if (device.tabs.length != 0)
+ this.push('syncedDevices_', device);
}
} else {
// The list shrank; remove deleted items.

Powered by Google App Engine
This is Rietveld 408576698