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

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

Issue 2251323002: MD History: Synced Tabs fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@history_css_shuffle
Patch Set: Review comment, revulcanize Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/app.vulcanized.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8bb2aac3c7a5942c0b96d6bf4ca72597595a4e15..65115bfa8b147418520bc5268dc581e10c3fef0f 100644
--- a/chrome/browser/resources/md_history/app.crisper.js
+++ b/chrome/browser/resources/md_history/app.crisper.js
@@ -14611,7 +14611,7 @@ Polymer({
separatorIndexes: Array,
// Whether the card is open.
- cardOpen_: {type: Boolean, value: true},
+ opened: Boolean,
searchTerm: String,
@@ -14663,12 +14663,22 @@ Polymer({
},
/**
- * @param {boolean} cardOpen
+ * @param {boolean} opened
* @return {string}
+ * @private
+ */
+ getCollapseIcon_: function(opened) {
+ return opened ? 'cr:expand-less' : 'cr:expand-more';
+ },
+
+ /**
+ * @param {boolean} opened
+ * @return {string}
+ * @private
*/
- getCollapseTitle_: function(cardOpen) {
- return cardOpen ? loadTimeData.getString('collapseSessionButton') :
- loadTimeData.getString('expandSessionButton');
+ getCollapseTitle_: function(opened) {
+ return opened ? loadTimeData.getString('collapseSessionButton') :
+ loadTimeData.getString('expandSessionButton');
},
/**
@@ -14690,6 +14700,7 @@ Polymer({
/**
* @typedef {{device: string,
* lastUpdateTime: string,
+ * opened: boolean,
* separatorIndexes: !Array<number>,
* timestamp: number,
* tabs: !Array<!ForeignSessionTab>,
@@ -14744,6 +14755,7 @@ Polymer({
listeners: {
'toggle-menu': 'onToggleMenu_',
+ 'scroll': 'onListScroll_'
},
/** @override */
@@ -14790,6 +14802,7 @@ Polymer({
return {
device: session.name,
lastUpdateTime: '– ' + session.modifiedTime,
+ opened: true,
separatorIndexes: separatorIndexes,
timestamp: session.timestamp,
tabs: tabs,
@@ -14801,6 +14814,12 @@ Polymer({
chrome.send('startSignInFlow');
},
+ onListScroll_: function() {
+ var menu = this.$.menu.getIfExists();
+ if (menu)
+ menu.closeMenu();
+ },
+
onToggleMenu_: function(e) {
this.$.menu.get().then(function(menu) {
menu.toggleMenu(e.detail.target, e.detail.tag);
@@ -14894,9 +14913,16 @@ Polymer({
}
}
- // Then, append any new devices.
- for (var i = updateCount; i < sessionList.length; i++) {
- this.push('syncedDevices_', this.createInternalDevice_(sessionList[i]));
+ 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]));
+ }
+ } else {
+ // The list shrank; remove deleted items.
+ this.splice(
+ 'syncedDevices_', updateCount,
+ this.syncedDevices_.length - updateCount);
}
},
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/app.vulcanized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698