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

Side by Side Diff: chrome/browser/resources/md_history/lazy_load.crisper.js

Issue 2360193002: [MD History] Hide empty synced device cards. (Closed)
Patch Set: rebase Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/lazy_load.vulcanized.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Polymer({ 1 Polymer({
2 is: 'iron-collapse', 2 is: 'iron-collapse',
3 behaviors: [ Polymer.IronResizableBehavior ], 3 behaviors: [ Polymer.IronResizableBehavior ],
4 properties: { 4 properties: {
5 horizontal: { 5 horizontal: {
6 type: Boolean, 6 type: Boolean,
7 value: false, 7 value: false,
8 observer: '_horizontalChanged' 8 observer: '_horizontalChanged'
9 }, 9 },
10 opened: { 10 opened: {
(...skipping 2196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 if (guestSession) return true; 2207 if (guestSession) return true;
2208 return signInState && syncedDevicesLength == 0; 2208 return signInState && syncedDevicesLength == 0;
2209 }, 2209 },
2210 showSignInGuide: function(signInState, guestSession) { 2210 showSignInGuide: function(signInState, guestSession) {
2211 var show = !signInState && !guestSession; 2211 var show = !signInState && !guestSession;
2212 if (show) { 2212 if (show) {
2213 md_history.BrowserService.getInstance().recordAction('Signin_Impression_Fr omRecentTabs'); 2213 md_history.BrowserService.getInstance().recordAction('Signin_Impression_Fr omRecentTabs');
2214 } 2214 }
2215 return show; 2215 return show;
2216 }, 2216 },
2217 noSyncedTabsMessage: function(fetchingSyncedTabs) { 2217 noSyncedTabsMessage: function() {
2218 return loadTimeData.getString(fetchingSyncedTabs ? 'loading' : 'noSyncedResu lts'); 2218 var stringName = this.fetchingSyncedTabs_ ? 'loading' : 'noSyncedResults';
2219 if (this.searchTerm !== '') stringName = 'noSearchResults';
2220 return loadTimeData.getString(stringName);
2219 }, 2221 },
2220 updateSyncedDevices: function(sessionList) { 2222 updateSyncedDevices: function(sessionList) {
2221 this.fetchingSyncedTabs_ = false; 2223 this.fetchingSyncedTabs_ = false;
2222 if (!sessionList) return; 2224 if (!sessionList) return;
2223 if (sessionList.length > 0 && !this.hasSeenForeignData_) { 2225 if (sessionList.length > 0 && !this.hasSeenForeignData_) {
2224 this.hasSeenForeignData_ = true; 2226 this.hasSeenForeignData_ = true;
2225 md_history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HISTOG RAM_NAME, SyncedTabsHistogram.HAS_FOREIGN_DATA, SyncedTabsHistogram.LIMIT); 2227 md_history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HISTOG RAM_NAME, SyncedTabsHistogram.HAS_FOREIGN_DATA, SyncedTabsHistogram.LIMIT);
2226 } 2228 }
2227 var updateCount = Math.min(sessionList.length, this.syncedDevices_.length); 2229 var updateCount = Math.min(sessionList.length, this.syncedDevices_.length);
2228 for (var i = 0; i < updateCount; i++) { 2230 for (var i = 0; i < updateCount; i++) {
2229 var oldDevice = this.syncedDevices_[i]; 2231 var oldDevice = this.syncedDevices_[i];
2230 if (oldDevice.tag != sessionList[i].tag || oldDevice.timestamp != sessionL ist[i].timestamp) { 2232 if (oldDevice.tag != sessionList[i].tag || oldDevice.timestamp != sessionL ist[i].timestamp) {
2231 this.splice('syncedDevices_', i, 1, this.createInternalDevice_(sessionLi st[i])); 2233 var device = this.createInternalDevice_(sessionList[i]);
2234 if (device.tabs.length != 0) this.splice('syncedDevices_', i, 1, device) ;
2232 } 2235 }
2233 } 2236 }
2234 if (sessionList.length >= this.syncedDevices_.length) { 2237 if (sessionList.length >= this.syncedDevices_.length) {
2235 for (var i = updateCount; i < sessionList.length; i++) { 2238 for (var i = updateCount; i < sessionList.length; i++) {
2236 this.push('syncedDevices_', this.createInternalDevice_(sessionList[i])); 2239 var device = this.createInternalDevice_(sessionList[i]);
2240 if (device.tabs.length != 0) this.push('syncedDevices_', device);
2237 } 2241 }
2238 } else { 2242 } else {
2239 this.splice('syncedDevices_', updateCount, this.syncedDevices_.length - up dateCount); 2243 this.splice('syncedDevices_', updateCount, this.syncedDevices_.length - up dateCount);
2240 } 2244 }
2241 }, 2245 },
2242 tabSyncDisabled: function() { 2246 tabSyncDisabled: function() {
2243 this.fetchingSyncedTabs_ = false; 2247 this.fetchingSyncedTabs_ = false;
2244 this.clearDisplayedSyncedDevices_(); 2248 this.clearDisplayedSyncedDevices_();
2245 }, 2249 },
2246 signInStateChanged_: function() { 2250 signInStateChanged_: function() {
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
3282 var cl = this.$.selectionBar.classList; 3286 var cl = this.$.selectionBar.classList;
3283 if (cl.contains('expand')) { 3287 if (cl.contains('expand')) {
3284 cl.remove('expand'); 3288 cl.remove('expand');
3285 cl.add('contract'); 3289 cl.add('contract');
3286 this._positionBar(this._pos.width, this._pos.left); 3290 this._positionBar(this._pos.width, this._pos.left);
3287 } else if (cl.contains('contract')) { 3291 } else if (cl.contains('contract')) {
3288 cl.remove('contract'); 3292 cl.remove('contract');
3289 } 3293 }
3290 } 3294 }
3291 }); 3295 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/lazy_load.vulcanized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698