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

Unified Diff: chrome/browser/resources/md_history/app.crisper.js

Issue 2360193002: [MD History] Hide empty synced device cards. (Closed)
Patch Set: 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/app.crisper.js
diff --git a/chrome/browser/resources/md_history/app.crisper.js b/chrome/browser/resources/md_history/app.crisper.js
index 5e2c14c595aec7c80c83e20c07f005151a999de5..b7f6ff5ad6e15daa35f43d9b8f9194c9d3981495 100644
--- a/chrome/browser/resources/md_history/app.crisper.js
+++ b/chrome/browser/resources/md_history/app.crisper.js
@@ -6475,10 +6475,10 @@ Polymer({
}
this.menuOpen = false;
},
- openMenu: function(anchor, itemData) {
+ openMenu: function(anchor, opt_itemData) {
if (this.lastAnchor_ == anchor && this.menuOpen) return;
if (this.menuOpen) this.closeMenu();
- this.itemData = itemData;
+ this.itemData = opt_itemData || null;
this.lastAnchor_ = anchor;
this.$.dropdown.restoreFocusOnClose = true;
var focusableChildren = Polymer.dom(this).querySelectorAll('[tabindex]:not([disabled]):not([hidden]),' + 'button:not([disabled]):not([hidden])');
@@ -6490,8 +6490,8 @@ Polymer({
this.$.dropdown.positionTarget = anchor;
this.menuOpen = true;
},
- toggleMenu: function(anchor, itemData) {
- if (anchor == this.lastAnchor_ && this.menuOpen) this.closeMenu(); else this.openMenu(anchor, itemData);
+ toggleMenu: function(anchor, opt_itemData) {
+ if (anchor == this.lastAnchor_ && this.menuOpen) this.closeMenu(); else this.openMenu(anchor, opt_itemData);
},
onTabPressed_: function(e) {
if (!this.firstFocus_ || !this.lastFocus_) return;
@@ -8643,8 +8643,10 @@ Polymer({
}
return show;
},
- 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);
},
updateSyncedDevices: function(sessionList) {
this.fetchingSyncedTabs_ = false;
@@ -8657,12 +8659,14 @@ Polymer({
for (var i = 0; i < updateCount; i++) {
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]));
+ device = this.createInternalDevice_(sessionList[i]);
+ if (device.tabs.length != 0) this.splice('syncedDevices_', i, 1, device);
}
}
if (sessionList.length >= this.syncedDevices_.length) {
for (var i = updateCount; i < sessionList.length; i++) {
- this.push('syncedDevices_', this.createInternalDevice_(sessionList[i]));
+ device = this.createInternalDevice_(sessionList[i]);
+ if (device.tabs.length != 0) this.push('syncedDevices_', device);
}
} else {
this.splice('syncedDevices_', updateCount, this.syncedDevices_.length - updateCount);

Powered by Google App Engine
This is Rietveld 408576698