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 properties: { | 9 properties: { |
10 data: { | 10 data: { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 }, | 85 }, |
86 | 86 |
87 observers: [ | 87 observers: [ |
88 // TODO(dbeam): this gets called way more when I observe data.by_ext_id | 88 // TODO(dbeam): this gets called way more when I observe data.by_ext_id |
89 // and data.by_ext_name directly. Why? | 89 // and data.by_ext_name directly. Why? |
90 'observeControlledBy_(controlledBy_)', | 90 'observeControlledBy_(controlledBy_)', |
91 'observeIsDangerous_(isDangerous_, data.file_path)', | 91 'observeIsDangerous_(isDangerous_, data.file_path)', |
92 ], | 92 ], |
93 | 93 |
94 ready: function() { | 94 ready: function() { |
95 this.listen(this.$.remove, 'down', 'activateRipple_'); | |
96 this.listen(this.$.remove, 'up', 'deactivateRipple_'); | |
97 | |
95 this.content = this.$.content; | 98 this.content = this.$.content; |
96 }, | 99 }, |
97 | 100 |
101 /** | |
102 * @param {!Event} e | |
103 * @private | |
104 */ | |
105 activateRipple_: function(e) { | |
106 if (!this.removeRipple_) { | |
107 this.removeRipple_ = document.createElement('paper-ripple'); | |
108 this.removeRipple_.setAttribute('center', ''); | |
esprehn
2015/10/15 04:53:20
.center = true I think is better than going throug
| |
109 this.removeRipple_.classList.add('circle'); | |
110 this.$.remove.appendChild(this.removeRipple_); | |
111 } | |
112 this.removeRipple_.downAction(e); | |
113 }, | |
114 | |
98 /** @private */ | 115 /** @private */ |
99 computeClass_: function() { | 116 computeClass_: function() { |
100 var classes = []; | 117 var classes = []; |
101 | 118 |
102 if (this.isActive_) | 119 if (this.isActive_) |
103 classes.push('is-active'); | 120 classes.push('is-active'); |
104 | 121 |
105 if (this.isDangerous_) | 122 if (this.isDangerous_) |
106 classes.push('dangerous'); | 123 classes.push('dangerous'); |
107 | 124 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 return this.data.last_reason_text; | 252 return this.data.last_reason_text; |
236 | 253 |
237 case downloads.States.COMPLETE: | 254 case downloads.States.COMPLETE: |
238 return this.data.file_externally_removed ? | 255 return this.data.file_externally_removed ? |
239 loadTimeData.getString('statusRemoved') : ''; | 256 loadTimeData.getString('statusRemoved') : ''; |
240 } | 257 } |
241 | 258 |
242 return ''; | 259 return ''; |
243 }, | 260 }, |
244 | 261 |
262 /** | |
263 * @param {!Event} e | |
264 * @private | |
265 */ | |
266 deactivateRipple_: function(e) { | |
267 this.removeRipple_.upAction(e); | |
268 }, | |
269 | |
245 /** @private */ | 270 /** @private */ |
246 isIndeterminate_: function() { | 271 isIndeterminate_: function() { |
247 return this.data.percent == -1; | 272 return this.data.percent == -1; |
248 }, | 273 }, |
249 | 274 |
250 /** @private */ | 275 /** @private */ |
251 observeControlledBy_: function() { | 276 observeControlledBy_: function() { |
252 this.$['controlled-by'].innerHTML = this.controlledBy_; | 277 this.$['controlled-by'].innerHTML = this.controlledBy_; |
253 }, | 278 }, |
254 | 279 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 }, | 339 }, |
315 | 340 |
316 /** @private */ | 341 /** @private */ |
317 onShowTap_: function() { | 342 onShowTap_: function() { |
318 downloads.ActionService.getInstance().show(this.data.id); | 343 downloads.ActionService.getInstance().show(this.data.id); |
319 }, | 344 }, |
320 }); | 345 }); |
321 | 346 |
322 return {Item: Item}; | 347 return {Item: Item}; |
323 }); | 348 }); |
OLD | NEW |