| OLD | NEW |
| 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_: { |
| 11 observer: 'hasDownloadsChanged_', | 11 observer: 'hasDownloadsChanged_', |
| 12 type: Boolean, | 12 type: Boolean, |
| 13 }, | 13 }, |
| 14 | 14 |
| 15 items_: { | 15 items_: { |
| 16 type: Array, | 16 type: Array, |
| 17 value: function() { return []; }, | 17 value: function() { return []; }, |
| 18 }, | 18 }, |
| 19 |
| 20 spinnerActive_: { |
| 21 type: Boolean, |
| 22 notify: true, |
| 23 }, |
| 19 }, | 24 }, |
| 20 | 25 |
| 21 hostAttributes: { | 26 hostAttributes: { |
| 22 loading: true, | 27 loading: true, |
| 23 }, | 28 }, |
| 24 | 29 |
| 25 listeners: { | 30 listeners: { |
| 26 'downloads-list.scroll': 'onListScroll_', | 31 'downloads-list.scroll': 'onListScroll_', |
| 27 }, | 32 }, |
| 28 | 33 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 52 | 57 |
| 53 /** | 58 /** |
| 54 * @param {number} index | 59 * @param {number} index |
| 55 * @param {!Array<!downloads.Data>} list | 60 * @param {!Array<!downloads.Data>} list |
| 56 * @private | 61 * @private |
| 57 */ | 62 */ |
| 58 insertItems_: function(index, list) { | 63 insertItems_: function(index, list) { |
| 59 this.splice.apply(this, ['items_', index, 0].concat(list)); | 64 this.splice.apply(this, ['items_', index, 0].concat(list)); |
| 60 this.updateHideDates_(index, index + list.length); | 65 this.updateHideDates_(index, index + list.length); |
| 61 this.removeAttribute('loading'); | 66 this.removeAttribute('loading'); |
| 67 this.spinnerActive_ = false; |
| 62 }, | 68 }, |
| 63 | 69 |
| 64 /** @private */ | 70 /** @private */ |
| 65 itemsChanged_: function() { | 71 itemsChanged_: function() { |
| 66 this.hasDownloads_ = this.items_.length > 0; | 72 this.hasDownloads_ = this.items_.length > 0; |
| 67 }, | 73 }, |
| 68 | 74 |
| 69 /** | 75 /** |
| 70 * @param {Event} e | 76 * @param {Event} e |
| 71 * @private | 77 * @private |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 Manager.removeItem = function(index) { | 181 Manager.removeItem = function(index) { |
| 176 Manager.get().removeItem_(index); | 182 Manager.get().removeItem_(index); |
| 177 }; | 183 }; |
| 178 | 184 |
| 179 Manager.updateItem = function(index, data) { | 185 Manager.updateItem = function(index, data) { |
| 180 Manager.get().updateItem_(index, data); | 186 Manager.get().updateItem_(index, data); |
| 181 }; | 187 }; |
| 182 | 188 |
| 183 return {Manager: Manager}; | 189 return {Manager: Manager}; |
| 184 }); | 190 }); |
| OLD | NEW |