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 Item = Polymer({ | 6 var Item = Polymer({ |
7 is: 'downloads-item', | 7 is: 'downloads-item', |
8 | 8 |
9 /** | 9 /** |
10 * @param {!downloads.ThrottledIconLoader} iconLoader | 10 * @param {!downloads.ThrottledIconLoader} iconLoader |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 readyPromise: { | 28 readyPromise: { |
29 type: Object, | 29 type: Object, |
30 value: function() { | 30 value: function() { |
31 return new Promise(function(resolve, reject) { | 31 return new Promise(function(resolve, reject) { |
32 this.resolveReadyPromise_ = resolve; | 32 this.resolveReadyPromise_ = resolve; |
33 }.bind(this)); | 33 }.bind(this)); |
34 }, | 34 }, |
35 }, | 35 }, |
36 | 36 |
37 scrollbarWidth: { | |
38 observer: 'onScrollbarWidthChange_', | |
39 type: Number, | |
40 value: 0, | |
41 }, | |
42 | |
43 completelyOnDisk_: { | 37 completelyOnDisk_: { |
44 computed: 'computeCompletelyOnDisk_(' + | 38 computed: 'computeCompletelyOnDisk_(' + |
45 'data_.state, data_.file_externally_removed)', | 39 'data_.state, data_.file_externally_removed)', |
46 type: Boolean, | 40 type: Boolean, |
47 value: true, | 41 value: true, |
48 }, | 42 }, |
49 | 43 |
50 i18n_: { | 44 i18n_: { |
51 readOnly: true, | 45 readOnly: true, |
52 type: Object, | 46 type: Object, |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 onRetryClick_: function() { | 314 onRetryClick_: function() { |
321 this.actionService_.download(this.$['file-link'].href); | 315 this.actionService_.download(this.$['file-link'].href); |
322 }, | 316 }, |
323 | 317 |
324 /** @private */ | 318 /** @private */ |
325 onSaveDangerous_: function() { | 319 onSaveDangerous_: function() { |
326 this.actionService_.saveDangerous(this.data_.id); | 320 this.actionService_.saveDangerous(this.data_.id); |
327 }, | 321 }, |
328 | 322 |
329 /** @private */ | 323 /** @private */ |
330 onScrollbarWidthChange_: function() { | |
331 if (!this.$) | |
332 return; | |
333 | |
334 var endCap = this.$['end-cap']; | |
335 endCap.style.flexBasis = ''; | |
336 | |
337 if (this.scrollbarWidth) { | |
338 var basis = parseInt(getComputedStyle(endCap).flexBasis, 10); | |
339 endCap.style.flexBasis = basis - this.scrollbarWidth + 'px'; | |
340 } | |
341 }, | |
342 | |
343 /** @private */ | |
344 onShowClick_: function() { | 324 onShowClick_: function() { |
345 this.actionService_.show(this.data_.id); | 325 this.actionService_.show(this.data_.id); |
346 }, | 326 }, |
347 }); | 327 }); |
348 | 328 |
349 return {Item: Item}; | 329 return {Item: Item}; |
350 }); | 330 }); |
OLD | NEW |