Chromium Code Reviews| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 // TODO(dbeam): this gets called way more when I observe data.by_ext_id | 71 // TODO(dbeam): this gets called way more when I observe data.by_ext_id |
| 72 // and data.by_ext_name directly. Why? | 72 // and data.by_ext_name directly. Why? |
| 73 'observeControlledBy_(controlledBy_)', | 73 'observeControlledBy_(controlledBy_)', |
| 74 'observeIsDangerous_(isDangerous_, data)', | 74 'observeIsDangerous_(isDangerous_, data)', |
| 75 ], | 75 ], |
| 76 | 76 |
| 77 ready: function() { | 77 ready: function() { |
| 78 this.content = this.$.content; | 78 this.content = this.$.content; |
| 79 }, | 79 }, |
| 80 | 80 |
| 81 /** | |
| 82 * @param {string} text | |
| 83 * @param {number} maxLength | |
| 84 * @return {string} A string that's as long (or shorter) than |maxLength|. | |
| 85 * @private | |
| 86 */ | |
| 87 chopString_: function(text, maxLength) { | |
|
dpapad
2016/10/29 00:53:15
Nit (optional): Perhaps don't bother passing the m
Dan Beam
2016/10/29 01:00:52
Done.
| |
| 88 return text.slice(0, maxLength); | |
| 89 }, | |
| 90 | |
| 81 /** @private */ | 91 /** @private */ |
| 82 computeClass_: function() { | 92 computeClass_: function() { |
| 83 var classes = []; | 93 var classes = []; |
| 84 | 94 |
| 85 if (this.isActive_) | 95 if (this.isActive_) |
| 86 classes.push('is-active'); | 96 classes.push('is-active'); |
| 87 | 97 |
| 88 if (this.isDangerous_) | 98 if (this.isDangerous_) |
| 89 classes.push('dangerous'); | 99 classes.push('dangerous'); |
| 90 | 100 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 }, | 324 }, |
| 315 | 325 |
| 316 /** @private */ | 326 /** @private */ |
| 317 onShowTap_: function() { | 327 onShowTap_: function() { |
| 318 downloads.ActionService.getInstance().show(this.data.id); | 328 downloads.ActionService.getInstance().show(this.data.id); |
| 319 }, | 329 }, |
| 320 }); | 330 }); |
| 321 | 331 |
| 322 return {Item: Item}; | 332 return {Item: Item}; |
| 323 }); | 333 }); |
| OLD | NEW |