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 Polymer = {dom: 'shadow'}; | 5 Polymer = {dom: 'shadow'}; |
6 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 6 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
7 // Use of this source code is governed by a BSD-style license that can be | 7 // Use of this source code is governed by a BSD-style license that can be |
8 // found in the LICENSE file. | 8 // found in the LICENSE file. |
9 | 9 |
10 /** | 10 /** |
(...skipping 12655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12666 }, | 12666 }, |
12667 | 12667 |
12668 observers: [ | 12668 observers: [ |
12669 // TODO(dbeam): this gets called way more when I observe data.by_ext_id | 12669 // TODO(dbeam): this gets called way more when I observe data.by_ext_id |
12670 // and data.by_ext_name directly. Why? | 12670 // and data.by_ext_name directly. Why? |
12671 'observeControlledBy_(controlledBy_)', | 12671 'observeControlledBy_(controlledBy_)', |
12672 'observeIsDangerous_(isDangerous_, data.file_path)', | 12672 'observeIsDangerous_(isDangerous_, data.file_path)', |
12673 ], | 12673 ], |
12674 | 12674 |
12675 ready: function() { | 12675 ready: function() { |
| 12676 this.listen(this.$.remove, 'down', 'activateRipple_'); |
| 12677 this.listen(this.$.remove, 'up', 'deactivateRipple_'); |
| 12678 |
12676 this.content = this.$.content; | 12679 this.content = this.$.content; |
12677 }, | 12680 }, |
12678 | 12681 |
| 12682 /** |
| 12683 * @param {!Event} e |
| 12684 * @private |
| 12685 */ |
| 12686 activateRipple_: function(e) { |
| 12687 if (!this.removeRipple_) { |
| 12688 this.removeRipple_ = document.createElement('paper-ripple'); |
| 12689 this.removeRipple_.setAttribute('center', ''); |
| 12690 this.removeRipple_.classList.add('circle'); |
| 12691 this.$.remove.appendChild(this.removeRipple_); |
| 12692 } |
| 12693 this.removeRipple_.downAction(e); |
| 12694 }, |
| 12695 |
12679 /** @private */ | 12696 /** @private */ |
12680 computeClass_: function() { | 12697 computeClass_: function() { |
12681 var classes = []; | 12698 var classes = []; |
12682 | 12699 |
12683 if (this.isActive_) | 12700 if (this.isActive_) |
12684 classes.push('is-active'); | 12701 classes.push('is-active'); |
12685 | 12702 |
12686 if (this.isDangerous_) | 12703 if (this.isDangerous_) |
12687 classes.push('dangerous'); | 12704 classes.push('dangerous'); |
12688 | 12705 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12816 return this.data.last_reason_text; | 12833 return this.data.last_reason_text; |
12817 | 12834 |
12818 case downloads.States.COMPLETE: | 12835 case downloads.States.COMPLETE: |
12819 return this.data.file_externally_removed ? | 12836 return this.data.file_externally_removed ? |
12820 loadTimeData.getString('statusRemoved') : ''; | 12837 loadTimeData.getString('statusRemoved') : ''; |
12821 } | 12838 } |
12822 | 12839 |
12823 return ''; | 12840 return ''; |
12824 }, | 12841 }, |
12825 | 12842 |
| 12843 /** |
| 12844 * @param {!Event} e |
| 12845 * @private |
| 12846 */ |
| 12847 deactivateRipple_: function(e) { |
| 12848 this.removeRipple_.upAction(e); |
| 12849 }, |
| 12850 |
12826 /** @private */ | 12851 /** @private */ |
12827 isIndeterminate_: function() { | 12852 isIndeterminate_: function() { |
12828 return this.data.percent == -1; | 12853 return this.data.percent == -1; |
12829 }, | 12854 }, |
12830 | 12855 |
12831 /** @private */ | 12856 /** @private */ |
12832 observeControlledBy_: function() { | 12857 observeControlledBy_: function() { |
12833 this.$['controlled-by'].innerHTML = this.controlledBy_; | 12858 this.$['controlled-by'].innerHTML = this.controlledBy_; |
12834 }, | 12859 }, |
12835 | 12860 |
(...skipping 4050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16886 }; | 16911 }; |
16887 | 16912 |
16888 Manager.onLoad = function() { | 16913 Manager.onLoad = function() { |
16889 document.querySelector('downloads-manager').onLoad_(); | 16914 document.querySelector('downloads-manager').onLoad_(); |
16890 }; | 16915 }; |
16891 | 16916 |
16892 return {Manager: Manager}; | 16917 return {Manager: Manager}; |
16893 }); | 16918 }); |
16894 | 16919 |
16895 window.addEventListener('load', downloads.Manager.onLoad); | 16920 window.addEventListener('load', downloads.Manager.onLoad); |
OLD | NEW |