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

Side by Side Diff: chrome/browser/resources/md_downloads/manager.js

Issue 2449853006: MD Downloads: handle date hiding/showing more sanely (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('downloads', function() { 5 cr.define('downloads', function() {
6 var Manager = Polymer({ 6 var Manager = Polymer({
7 is: 'downloads-manager', 7 is: 'downloads-manager',
8 8
9 properties: { 9 properties: {
10 hasDownloads_: { 10 hasDownloads_: {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 * @param {number} start 143 * @param {number} start
144 * @param {number} end 144 * @param {number} end
145 * @private 145 * @private
146 */ 146 */
147 updateHideDates_: function(start, end) { 147 updateHideDates_: function(start, end) {
148 for (var i = start; i <= end; ++i) { 148 for (var i = start; i <= end; ++i) {
149 var current = this.items_[i]; 149 var current = this.items_[i];
150 if (!current) 150 if (!current)
151 continue; 151 continue;
152 var prev = this.items_[i - 1]; 152 var prev = this.items_[i - 1];
153 current.hideDate = !!prev && prev.date_string == current.date_string; 153 var hideDate = !!prev && prev.date_string == current.date_string;
154 this.set('items_.' + i + '.hideDate', hideDate);
154 } 155 }
155 }, 156 },
156 157
157 /** 158 /**
158 * @param {number} index 159 * @param {number} index
159 * @param {!downloads.Data} data 160 * @param {!downloads.Data} data
160 * @private 161 * @private
161 */ 162 */
162 updateItem_: function(index, data) { 163 updateItem_: function(index, data) {
163 this.set('items_.' + index, data); 164 this.set('items_.' + index, data);
(...skipping 24 matching lines...) Expand all
188 Manager.removeItem = function(index) { 189 Manager.removeItem = function(index) {
189 Manager.get().removeItem_(index); 190 Manager.get().removeItem_(index);
190 }; 191 };
191 192
192 Manager.updateItem = function(index, data) { 193 Manager.updateItem = function(index, data) {
193 Manager.get().updateItem_(index, data); 194 Manager.get().updateItem_(index, data);
194 }; 195 };
195 196
196 return {Manager: Manager}; 197 return {Manager: Manager};
197 }); 198 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_downloads/manager.html ('k') | chrome/browser/resources/md_downloads/vulcanized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698